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

Use SonarAnalyzer.CSharp.Styling #1912

Merged
merged 1 commit into from Apr 29, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion NuGet.Config
Expand Up @@ -34,7 +34,8 @@
<owners>Microsoft;sharwell;meirb;kzu;dotnetfoundation;castleproject;jonorossi;onovotny;fluentassertions;jamesnk;CycloneDX;grpc-packages;protobuf-packages</owners>
</repository>
<author name="SonarSource">
<certificate fingerprint="FC4D3F3F815C1B56A656F1A5D9456AF04B469267D945786057175049B15A62A0" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
<!-- Subject Name: CN=SonarSource SA, valid from 2023-10-17 -->
<certificate fingerprint="A943C46DBA193D99C1135FFE33D3337524E9B3F05B416B9314E168CD206EF427" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
</author>
<author name="James Newton-King">
<certificate fingerprint="A3AF7AF11EBB8EF729D2D91548509717E7E0FF55A129ABC3AEAA8A6940267641" hashAlgorithm="SHA256" allowUntrustedRoot="false" />
Expand Down
4 changes: 4 additions & 0 deletions StyleCopAnalyzers.targets → StylingAnalyzers.targets
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp.Styling" Version="9.24.0.89429">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to let dependatbot/renovate do the update?

Not sure how hard it could be, but our set-script.ps1 could set the version as well to use the latest. To make things easier, we could set the version like so:

Suggested change
<PackageReference Include="SonarAnalyzer.CSharp.Styling" Version="9.24.0.89429">
<PackageReference Include="SonarAnalyzer.CSharp.Styling" Version="9.24.0.*">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use "*" due to json lock files. Each release of sonar-dotnet would break build of all other projects.

We will let update it manually, or let renovate do the job for us.

<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Directory.Build.targets
Expand Up @@ -27,5 +27,5 @@
</Compile>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)\..\StyleCopAnalyzers.targets" />
<Import Project="$(MSBuildThisFileDirectory)\..\StylingAnalyzers.targets" />
</Project>
2 changes: 1 addition & 1 deletion src/Directory.Build.targets
Expand Up @@ -23,7 +23,7 @@
<None Include="$(MSBuildProjectFileDirectory)$(AssemblyOriginatorKeyFile)" Link="%(Filename)%(Extension)" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)\..\StyleCopAnalyzers.targets" />
<Import Project="$(MSBuildThisFileDirectory)\..\StylingAnalyzers.targets" />

<PropertyGroup Condition=" '$(SignAssembly)' == 'true' ">
<DefineConstants>$(DefineConstants);SignAssembly</DefineConstants>
Expand Down