Fix 6 SonarCloud code smell issues (S927, S3267, S3776, S3261)#74
Merged
304NotModified merged 3 commits intomainfrom Apr 17, 2026
Merged
Fix 6 SonarCloud code smell issues (S927, S3267, S3776, S3261)#74304NotModified merged 3 commits intomainfrom
304NotModified merged 3 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/304NotModified/SLNX-validator/sessions/6df1aa82-2af8-4187-b1f3-29b91d96cf94 Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix SonarCloud code smell issues in multiple files
Fix 6 SonarCloud code smell issues (S927, S3267, S3776, S3261)
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves six open SonarCloud code smells spanning parameter naming, loop simplification, cognitive complexity, and an empty namespace.
Changes
S927 — parameter name mismatch (
SarifReporter.cs,SonarReporter.cs): Renamed override parameterreportResults→resultsto match theReporterBasedeclaration.S3267 — loop simplification (
SlnxFile.cs): Replaced manualforeach+ inner variable extraction with a LINQ projection:S3267 — loop simplification (
RequiredFilesChecker.cs): Moved theif (!Contains(...))guard into a.Where(...)clause on the loop source.S3776 — cognitive complexity (
SlnxCollector.cs): Extracted per-file processing fromCollectAsync(complexity 20) into a newProcessFileAsyncprivate method, bringingCollectAsyncwell under the allowed threshold of 15.S3261 — empty namespace (
SonarRuleSeverity.cs): Removed the emptynamespacedeclaration; file now contains only the explanatory comments.Original prompt
Doel
Los de volgende 6 openstaande SonarCloud code smell issues op in één PR:
1. S927 —
SarifReporter.csregel 15Bericht: Rename parameter
reportResultstoresultsto match the base class declaration.ReporterBase.WriteReportAsyncdeclareert de parameter alsresults. De override inSarifReportergebruiktreportResults.Fix: Hernoem de parameter
reportResultsnaarresultsin de methode-signatuur én in de body vanWriteReportAsyncinsrc/SLNX-validator.Core/SarifReporting/SarifReporter.cs.2. S927 —
SonarReporter.csregel 10Bericht: Rename parameter
reportResultstoresultsto match the base class declaration.Zelfde probleem als hierboven maar in
src/SLNX-validator.Core/SonarQubeReporting/SonarReporter.cs.Fix: Hernoem de parameter
reportResultsnaarresultsin de methode-signatuur én in de body.3. S3267 —
SlnxFile.csregel 108Bericht: Loop should be simplified by calling
Select(entry => entry.Path)In
ComputeAbsoluteFilesstaat:Fix: Gebruik
Selectomentry.Pathdirect te projecteren:4. S3776 —
SlnxCollector.csregel 11Bericht: Refactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.
De
CollectAsyncmethode insrc/SLNX-validator/SlnxCollector.csis te complex.Fix: Extraheer de binnenste logica voor het verwerken van een enkel bestand naar een aparte private methode, bijv.
ProcessFileAsync. De foreach-lus inCollectAsyncroept danProcessFileAsyncaan. Dit verlaagt de cognitive complexity vanCollectAsyncsignificant.5. S3267 —
RequiredFilesChecker.csregel 38Bericht: Loops should be simplified using the "Where" LINQ method
In
CheckInSlnx:Fix: Gebruik LINQ
Whereom de conditie te verplaatsen:6. S3261 —
SonarRuleSeverity.csregel 3Bericht: Remove this empty namespace.
src/SLNX-validator.Core/SonarQubeReporting/SonarRuleSeverity.csbevat alleen een comment en een lege namespace:Fix: Verwijder de namespace declaratie (laat alleen de comments staan, of verwijder het hele bestand als er geen referenties meer zijn).
Algemene opmerkingen
The following is the prior conversation context from the user's chat exploration (may be truncated):
Assistant: Helaas kan ik de SonarCloud-link niet direct openen of uitlezen — ik heb geen toegang tot externe webservices zoals SonarCloud.
Wat ik wel kan doen:
304NotModified/SLNX-validatorals je weet welke code-issues aangepakt moeten worden.Wat is het makkelijkst voor jou?
User: Heb je een export url?
Assistant: Ja! SonarCloud heeft een publieke REST API. Je kunt de issues ophalen via:
Plak die URL in je browser (of stuur me de JSON-output), dan kan ik de issues analyseren en helpen oplossen.
Als het project privé is, heb je een token nodig. Die kun je aanmaken op: sonarcloud.io/account/security
Probeer het eens en plak de output hier!
User: {"total":7,"p":1,"ps":100,"paging":{"pageIndex":1,"pageSize":100,"total":7},"effortTotal":58,"debtTotal":58,"issues":[{"key":"AZ1puUd_P77SLJn5J6UV","rule":"csharpsquid:S927","severity":"CRITICAL","component":"slnx-validator:src/SLNX-validator.Core/SarifReporting/SarifReporter.cs","project":"slnx-validator","line":15,"hash":"247cfac9bd39dfac92b3b3a004be4845","textRange":{"startLine":15,"endLine":15,"startOffset":62,"endOffset":75},"flows":[],"status":"OPEN","message":"Rename parameter \u0027reportResults\u0027 to \u0027results\u0027 to match the base class declaration.","effort":"10min","debt":"10min","tags":["suspicious"],"creationDate":"2026-04-06T18:13:31+0000","updateDate":"2026-04-06T22:46:01+0000","type":"CODE_SMELL","organization":"304notmodifie...
This pull request was created from Copilot chat.