Skip to content

Commit 59de0c5

Browse files
authored
Generate the editorconfig files from analyzer (#16)
* Generate editorconfig for analyzers * Add IDE rules * Add linter on CI * Trigger a new pipeline * Generate the configuration files in the Build.ps1 * Add a meaningful error message when an editorconfig file is not up to date
1 parent 2790a07 commit 59de0c5

13 files changed

+2817
-751
lines changed

Build.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Process {
2727
# Let GitVersion compute the NuGet package version
2828
$version = Exec { & dotnet dotnet-gitversion /output json /showvariable SemVer }
2929

30+
# Generate .editorconfig files for analyzers
31+
Exec { & dotnet run --project=tools/ConfigurationFilesGenerator/ConfigurationFilesGenerator.csproj --configuration Release }
32+
3033
# Pack using NuGet.exe
3134
Exec { & nuget pack Workleap.DotNet.CodingStandards.nuspec -OutputDirectory $outputDir -Version $version -ForceEnglishOutput }
3235

src/build/Workleap.DotNet.CodingStandards.targets

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@
99
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\2_CodeStyle.editorconfig" />
1010

1111
<!-- .NET analyzers configuration for all projects, enforcing C# code style, quality, performance and security -->
12-
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\3_AllProjectsAnalyzers.editorconfig" />
12+
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\analyzers\*.editorconfig" />
1313

1414
<!-- Configure ReSharper analyzers that overlaps with built-in .NET analyzers (only appears in Rider and VisualStudio IDEs) -->
15-
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\4_ReSharperAnalyzers.editorconfig" />
15+
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\3_ReSharperAnalyzers.editorconfig" />
1616

1717
<!-- .NET analyzers configuration only for test projects -->
18-
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\5_TestProjectsAnalyzers.editorconfig" Condition="'$(IsTestProject)' == 'true'" />
19-
20-
<!-- StyleCop analyzers configuration, only included to fill the gap with a very few rules that are not available out of the box in .NET analyzers -->
21-
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\6_StyleCopAnalyzers.editorconfig" />
18+
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)\..\files\4_TestProjectsAnalyzers.editorconfig" Condition="'$(IsTestProject)' == 'true'" />
2219
</ItemGroup>
2320

2421
<!-- Banned Symbols -->

0 commit comments

Comments
 (0)