Most of these rules are enforced by .editorconfig. Please run a format pass before opening a PR.
Always use braces, even for single-line bodies.
This is ok:
if (!something)
{
return;
}This is not:
if (!something)
return;We use CSharpier to keep the project styled and formatted. Install it with dotnet tool install -g csharpier and run csharpier format . before opening a PR. A workflow will fail if formatting changes are required. See the Style Guide in the README for format-on-save setup.
This is ok:
namespace SPTarkov.Server.Core.Utils;
public class JsonUtil
{
}This is not:
namespace SPTarkov.Server.Core.Utils
{
public class JsonUtil
{
}
}System.* directives come first, then the rest sorted alphabetically. They belong above the namespace declaration, never inside it.
This is ok:
_logger.Debug(message);This is not:
this._logger.Debug(this.message);private/internalfields are_camelCasewith a leading underscore.constfields arePascalCase.- Prefer the language keyword over the BCL type (
stringnotString,intnotInt32).
Use block bodies for methods, constructors, properties, and accessors. Expression-bodied lambdas are fine.
This is ok:
public int GetCount()
{
return _items.Count;
}This is not:
public int GetCount() => _items.Count;We do not allow AI-generated code from first-time contributors. We reserve the right to reject any submissions we suspect to be AI-generated. The only exception is using AI to generate comments or documentation for code you write yourself.
By submitting code to this repository, you agree that your contributions are licensed to the project under the terms of the LICENSE file. This gives the project the right to use, modify, and redistribute your contributions. Once submitted, contributions cannot be removed or retracted, and the project may continue to use your code even if you later wish to withdraw it.