buerokratt / POC.CentOps

Central administration of components in external networks and monitoring their technical parameters and performance
MIT License
1 stars 0 forks source link

CentOps: Implement code style rules #34

Closed martinkearn closed 2 years ago

martinkearn commented 2 years ago

AS A Developer I WANT to ensure my CentOps code conforms to .net style rules SO THAT code is consistently styled

Dependency on https://github.com/buerokratt/Cross-functional-requirements/issues/34

Acceptance Criteria

Steps to apply Code Analysis

Repeat for all projects in solution (including test projects)

  1. Copy the .editorconfig file from https://github.com/buerokratt/DMR/blob/main/src/Dmr.Api/.editorconfig
  2. Add .editorconfig from step 1 to root of project
  3. Add the following settings to the *.csproj file within the first <PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  1. Add the following package to the *.csproj within the <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> 
  1. Build the solution and address any rule violations
  2. Update the CI pipeline so the format action only verifies. It should read: dotnet format src/*.sln --no-restore --verify-no-changes