Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the internal code analyzer for test projects #4731

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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