Skip to content

Add SonarAnalyzer.CSharp and fix S3267 loop simplification#75

Merged
Malcolmnixon merged 2 commits intomainfrom
copilot/add-sonaranalyzer-csharp-dependency
Dec 15, 2025
Merged

Add SonarAnalyzer.CSharp and fix S3267 loop simplification#75
Malcolmnixon merged 2 commits intomainfrom
copilot/add-sonaranalyzer-csharp-dependency

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Adds SonarAnalyzer.CSharp v10.16.1.129956 as an analyzer dependency to both library and test projects. Addresses one violation (S3267) requiring loop simplification via LINQ Where.

Changes

  • Package references: Added SonarAnalyzer.CSharp to both csproj files with PrivateAssets to keep it as a build-time analyzer
  • SpdxCreationInformation.cs: Refactored creator validation loop to use Where filter

Before

foreach (var creator in Creators)
    if (!creator.StartsWith("Person:") &&
        !creator.StartsWith("Organization:") &&
        !creator.StartsWith("Tool:"))
        issues.Add($"Document Invalid Creator Entry '{creator}'");

After

foreach (var creator in Creators.Where(c =>
    !c.StartsWith("Person:") &&
    !c.StartsWith("Organization:") &&
    !c.StartsWith("Tool:")))
{
    issues.Add($"Document Invalid Creator Entry '{creator}'");
}
Original prompt

please add the SonarAnalyzer.CSharp dependency to the csproj files and fix any issues it causes.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 15, 2025
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
@Malcolmnixon Malcolmnixon marked this pull request as ready for review December 15, 2025 18:10
Copilot AI changed the title [WIP] Add SonarAnalyzer.CSharp dependency and resolve issues Add SonarAnalyzer.CSharp and fix S3267 loop simplification Dec 15, 2025
Copilot AI requested a review from Malcolmnixon December 15, 2025 18:11
@Malcolmnixon Malcolmnixon merged commit 7cebb50 into main Dec 15, 2025
8 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/add-sonaranalyzer-csharp-dependency branch December 15, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants