Skip to content

Commit e8e42f7

Browse files
committed
Trick the build into enabling IDE1006 but still allowing per-rule severity configuration
1 parent ed618e6 commit e8e42f7

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

eng/.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Diagnostics with a default severity of suggestion or lower (including IDE* rules) do not run during command line
2+
# builds unless they have been elevated to warning or greater using the compiler-designated syntax. Since the compiler
3+
# syntax prevents the use of fine-grained severity configuration for rules like IDE1006 (Naming styles), we use this
4+
# configuration file to only force the severity to warning for a single known file in the compilation.
5+
6+
[CodeAnalysisSource.{cs,vb}]
7+
8+
# IDE1006: Naming styles
9+
dotnet_diagnostic.IDE1006.severity = warning
10+
11+
# SA1518: Code should not contain blank lines at the end of the file
12+
dotnet_diagnostic.SA1518.severity = none

eng/CodeAnalysis.src.globalconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,8 @@ dotnet_diagnostic.IDE0230.severity = suggestion
17261726
dotnet_diagnostic.IDE1005.severity = warning
17271727

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

17311732
# IDE2000: Allow multiple blank lines
17321733
dotnet_diagnostic.IDE2000.severity = silent

eng/CodeAnalysisSource.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


eng/CodeAnalysisSource.vb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


eng/CodeStyle.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,12 @@
1818

1919
</PropertyGroup>
2020

21+
<ItemGroup Condition="'$(Language)' == 'C#'">
22+
<Compile Include="$(MSBuildThisFileDirectory)CodeAnalysisSource.cs" Visible="false" />
23+
</ItemGroup>
24+
25+
<ItemGroup Condition="'$(Language)' == 'VB'">
26+
<Compile Include="$(MSBuildThisFileDirectory)CodeAnalysisSource.vb" Visible="false" />
27+
</ItemGroup>
28+
2129
</Project>

0 commit comments

Comments
 (0)