arangodb-net-standard icon indicating copy to clipboard operation
arangodb-net-standard copied to clipboard

Use .editorconfig file to define code style standards and apply to all existing files

Open rossmills99 opened this issue 3 years ago • 2 comments

Proposal:

  • adopt the code style standards defined in the default .editorconfig file published here: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?view=vs-2022
  • apply the styles to all existing files, via Visual Studio, documented here: https://docs.microsoft.com/en-us/visualstudio/ide/code-styles-and-code-cleanup?view=vs-2022#apply-code-styles
  • enforce the styles are adhered to on build, documented here: https://docs.microsoft.com/en-us/visualstudio/ide/code-styles-and-code-cleanup?view=vs-2022#enforce-code-styles-on-build

Note: the last step requires using .NET 5.0 SDK for build, we'd need to make sure we can do that on the CI builds (maybe we already do, I haven't checked)

rossmills99 avatar Feb 25 '22 12:02 rossmills99

Regarding the third point, I think we could use dotnet-format to apply CI checks. The option --verify-no-changes allows "verifying" rather than "applying" the changes. We can run the command in an additional build step.

Example of possible commands: dotnet tool install -g dotnet-format dotnet-format arangodb-net-standard.sln

DiscoPYF avatar Feb 27 '22 12:02 DiscoPYF

.NET 5 support for this exists though, so we might not need any additional tooling: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#enable-on-build

rossmills99 avatar Feb 28 '22 11:02 rossmills99