|
| 1 | +## General |
| 2 | + |
| 3 | +* Make only high confidence suggestions when reviewing code changes. |
| 4 | +* Always use the latest version C#, currently C# 13 features. |
| 5 | +* Never change global.json unless explicitly asked to. |
| 6 | +* Never change package.json or package-lock.json files unless explicitly asked to. |
| 7 | +* Never change NuGet.config files unless explicitly asked to. |
| 8 | + |
| 9 | +## Formatting |
| 10 | + |
| 11 | +* Apply code-formatting style defined in `.editorconfig`. |
| 12 | +* Prefer file-scoped namespace declarations and single-line using directives. |
| 13 | +* Insert a newline before the opening curly brace of any code block (e.g., after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.). |
| 14 | +* Ensure that the final return statement of a method is on its own line. |
| 15 | +* Use pattern matching and switch expressions wherever possible. |
| 16 | +* Use `nameof` instead of string literals when referring to member names. |
| 17 | +* Ensure that XML doc comments are created for any public APIs. When applicable, include `<example>` and `<code>` documentation in the comments. |
| 18 | + |
| 19 | +### Nullable Reference Types |
| 20 | + |
| 21 | +* Declare variables non-nullable, and check for `null` at entry points. |
| 22 | +* Always use `is null` or `is not null` instead of `== null` or `!= null`. |
| 23 | +* Trust the C# null annotations and don't add null checks when the type system says a value cannot be null. |
| 24 | + |
| 25 | +### Testing |
| 26 | + |
| 27 | +* We use xUnit SDK v3 for tests. |
| 28 | +* Do not emit "Act", "Arrange" or "Assert" comments. |
| 29 | +* Use Moq for mocking in tests. |
| 30 | +* Copy existing style in nearby files for test method names and capitalization. |
| 31 | + |
| 32 | +## Running tests |
| 33 | + |
| 34 | +* To build and run tests in the repo, use the `build.sh` script that is located in each subdirectory within the `src` folder. For example, to run the build with tests in the `src/Http` directory, run `./src/Http/build.sh -test`. |
0 commit comments