Skip to content

Commit

Permalink
Trick the build into enabling IDE1006 but still allowing per-rule sev…
Browse files Browse the repository at this point in the history
…erity configuration
  • Loading branch information
sharwell committed Mar 31, 2023
1 parent ed618e6 commit e8e42f7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions eng/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Diagnostics with a default severity of suggestion or lower (including IDE* rules) do not run during command line
# builds unless they have been elevated to warning or greater using the compiler-designated syntax. Since the compiler
# syntax prevents the use of fine-grained severity configuration for rules like IDE1006 (Naming styles), we use this
# configuration file to only force the severity to warning for a single known file in the compilation.

[CodeAnalysisSource.{cs,vb}]

# IDE1006: Naming styles
dotnet_diagnostic.IDE1006.severity = warning

# SA1518: Code should not contain blank lines at the end of the file
dotnet_diagnostic.SA1518.severity = none
3 changes: 2 additions & 1 deletion eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,8 @@ dotnet_diagnostic.IDE0230.severity = suggestion
dotnet_diagnostic.IDE1005.severity = warning

# IDE1006: Naming styles
dotnet_diagnostic.IDE1006.severity = silent
# This rule is configured by individual rules in .editorconfig. Do not override the severity here.
#dotnet_diagnostic.IDE1006.severity = silent

# IDE2000: Allow multiple blank lines
dotnet_diagnostic.IDE2000.severity = silent
Expand Down
1 change: 1 addition & 0 deletions eng/CodeAnalysisSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions eng/CodeAnalysisSource.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions eng/CodeStyle.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,12 @@

</PropertyGroup>

<ItemGroup Condition="'$(Language)' == 'C#'">
<Compile Include="$(MSBuildThisFileDirectory)CodeAnalysisSource.cs" Visible="false" />
</ItemGroup>

<ItemGroup Condition="'$(Language)' == 'VB'">
<Compile Include="$(MSBuildThisFileDirectory)CodeAnalysisSource.vb" Visible="false" />
</ItemGroup>

</Project>

0 comments on commit e8e42f7

Please sign in to comment.