Skip to content

Commit

Permalink
Extract code analysis to its own build slice and update analyzers to …
Browse files Browse the repository at this point in the history
…latest versions (#60)

* Move CodeAnalysis to own build slice and fix duplicate and missing references

* Update analyzers to latest versions
  • Loading branch information
MattKotsenas authored Jun 6, 2024
1 parent 30cd4c0 commit de15874
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 42 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<Import Project="build/targets/reproducible/Reproducible.props" />
<Import Project="build/targets/versioning/Versioning.props" />
<Import Project="build/targets/tests/Tests.props" />
<Import Project="build/targets/codeanalysis/CodeAnalysis.props" />
</Project>
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<Import Project="build/targets/reproducible/Reproducible.targets" />
<Import Project="build/targets/versioning/Versioning.targets" />
<Import Project="build/targets/tests/Tests.targets" />
<Import Project="build/targets/codeanalysis/CodeAnalysis.targets" />
</Project>
5 changes: 1 addition & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<Import Project="build/targets/reproducible/Packages.props" />
<Import Project="build/targets/codeanalysis/Packages.props" />
<ItemGroup>
<PackageVersion Include="GetPackFromProject" Version="1.0.6" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.155" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.6.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageVersion Include="Moq" Version="4.8.2" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Roslynator.Analyzers" Version="2.1.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageVersion Include="Verify.Nupkg" Version="1.1.5" />
<PackageVersion Include="Verify.Xunit" Version="24.2.0" />
<PackageVersion Include="xunit" Version="2.8.1" />
Expand Down
9 changes: 0 additions & 9 deletions Source/Moq.Analyzers.Test/Moq.Analyzers.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,8 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="Moq" />
<PackageReference Include="Roslynator.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Verify.Nupkg" />
<PackageReference Include="Verify.Xunit" />
<PackageReference Include="xunit" />
Expand Down
4 changes: 4 additions & 0 deletions Source/Moq.Analyzers/Moq.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" />
<EmbeddedResource Update="Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" />
Expand Down
28 changes: 28 additions & 0 deletions build/targets/codeanalysis/CodeAnalysis.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project>
<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisMode>preview</AnalysisMode>
<WarningLevel>9999</WarningLevel>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="$(RepoRoot)/Source/stylecop.json" Visible="false" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions build/targets/codeanalysis/CodeAnalysis.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
8 changes: 8 additions & 0 deletions build/targets/codeanalysis/Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<ItemGroup>
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.155" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.4" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>
</Project>
30 changes: 1 addition & 29 deletions build/targets/compiler/Compiler.props
Original file line number Diff line number Diff line change
@@ -1,35 +1,7 @@
<Project>
<PropertyGroup Label="Language options">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Label="Code analysis">
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisMode>preview</AnalysisMode>
<WarningLevel>9999</WarningLevel>
</PropertyGroup>

<ItemGroup>
<AdditionalFiles Include="$(RepoRoot)/Source/stylecop.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Analyzer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

0 comments on commit de15874

Please sign in to comment.