Skip to content

Commit

Permalink
Enable the internal code analyzer for test projects (#4731)
Browse files Browse the repository at this point in the history
Existing rules which report diagnostics are disabled.
  • Loading branch information
sharwell committed Jan 30, 2020
1 parent 4779b81 commit 647771c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
25 changes: 24 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,27 @@ root = true

[*.cs]
# Sort using directives with System.* appearing first
dotnet_sort_system_directives_first = true
dotnet_sort_system_directives_first = true

[test/**/*.cs]

# MSML_GeneralName: This name should be PascalCased
dotnet_diagnostic.MSML_GeneralName.severity = none

# MSML_PrivateFieldName: Private field name not in: _camelCase format
dotnet_diagnostic.MSML_PrivateFieldName.severity = none

# MSML_SingleVariableDeclaration: Have only a single variable present per declaration
dotnet_diagnostic.MSML_SingleVariableDeclaration.severity = none

# MSML_NoBestFriendInternal: Cross-assembly internal access requires referenced item to have Microsoft.ML.BestFriendAttribute attribute.
dotnet_diagnostic.MSML_NoBestFriendInternal.severity = none

# MSML_NoInstanceInitializers: No initializers on instance fields or properties
dotnet_diagnostic.MSML_NoInstanceInitializers.severity = none

# MSML_ParameterLocalVarName: Parameter or local variable name not standard
dotnet_diagnostic.MSML_ParameterLocalVarName.severity = none

# MSML_TypeParamName: Type parameter name not standard
dotnet_diagnostic.MSML_TypeParamName.severity = none
9 changes: 9 additions & 0 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
<PackageReference Include="coverlet.msbuild" Version="$(CoverletVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference
Condition="'$(UseMLCodeAnalyzer)' != 'false' and '$(MSBuildProjectExtension)' == '.csproj'"
Include="$(MSBuildThisFileDirectory)\..\tools-local\Microsoft.ML.InternalCodeAnalyzer\Microsoft.ML.InternalCodeAnalyzer.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Analyzer</OutputItemType>
</ProjectReference>
</ItemGroup>

<PropertyGroup Condition="'$(Coverage)' == 'true'">
<!-- https://github.com/tonerdo/coverlet/issues/618 -->
<IncludeTestAssembly>true</IncludeTestAssembly>
Expand Down

0 comments on commit 647771c

Please sign in to comment.