fix(S1075): replace hardcoded ToolInformationUri with ThisAssembly.Info.RepositoryUrl#73
Merged
304NotModified merged 2 commits intomainfrom Apr 17, 2026
Merged
Conversation
…embly.Info.RepositoryUrl Agent-Logs-Url: https://github.com/304NotModified/SLNX-validator/sessions/7405df7a-70cc-4543-b4af-eae493ce9100 Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix SonarCloud issue S1075 in SarifReporter.cs
fix(S1075): replace hardcoded ToolInformationUri with ThisAssembly.Info.RepositoryUrl
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.
SonarCloud S1075 flagged the hardcoded
"https://github.com/304NotModified/SLNX-validator"URI inSarifReporter.cs. The URL already lives insrc/Directory.Build.propsas<RepositoryUrl>.Changes
SLNX-validator.Core.csproj: addsThisAssembly.AssemblyInfo(PrivateAssets="all") and aConstantitem that bridges$(RepositoryUrl)into theThisAssembly.Infonamespace (necessary because the SDK emitsRepositoryUrlasAssemblyMetadata, whichThisAssembly.AssemblyInfoexplicitly excludes from its auto-generation)SarifReporter.cs: replaces the hardcodedconstwith the source-generated propertyNo reflection; value resolved at compile time via Roslyn source generation.
Original prompt
Doel
Los SonarCloud issue S1075 op in
SarifReporter.csdoor de hardcoded URI te vervangen met deThisAssemblysource generator, die de waarde compile-time uitRepositoryUrlinsrc/Directory.Build.propshaalt.Context
SarifReporter.cs(regel 13) heeft een hardcodedconst string ToolInformationUri = "https://github.com/304NotModified/SLNX-validator"— dit triggert SonarCloud regel S1075 (geen hardcoded absolute URIs).src/Directory.Build.propsals<RepositoryUrl>https://github.com/304NotModified/SLNX-validator</RepositoryUrl>.ThisAssembly.AssemblyInfoNuGet package gebruiken, die via source generation een compile-timeThisAssembly.Info.RepositoryUrlproperty genereert — geen reflection, geen file-generatie in de pipeline.Wijzigingen
1. Voeg
ThisAssembly.AssemblyInfotoe aansrc/SLNX-validator.Core/SLNX-validator.Core.csproj2. Pas
src/SLNX-validator.Core/SarifReporting/SarifReporter.csaanVervang:
Door:
Opmerkingen
PrivateAssets="all"zorgt dat de source generator niet als transitieve dependency meekomt.RepositoryUrlinsrc/Directory.Build.propshoeft niet gewijzigd te worden.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Kan je deze issues lezen? https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&sinceLeakPeriod=true&id=slnx-validator
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":"304notmodified","cleanCodeAttribute":"IDENTIFIABLE","cleanCodeAttributeCategory":"CONSISTENT","impacts":[{"softwareQuality":"MAINTAINABILITY","severity":"HIGH"}],"issueStatus":"OPEN","projectName":"SLNX-validator","internalTags":[],"lastChangeAnalysisUuid":"29213cdc-cfdd-4f9e-9cb6-d3f3ef148fde","lastChangeSource":"ANALYSIS"},{"key":"AZ1puUe-P77SLJn5J6UW","rule":"csharpsquid:S927","severity":"CRITICAL","component":"slnx-validator:src/SLNX-validator.Core/SonarQubeReporting/SonarReporter.cs","project":"slnx-validator","line":10,"hash":"247cfac9bd39dfac92b3b3a004be4845","textRange":{"startLine":10,"endLine":10,"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":"304notmodified","cleanCodeAttribute":"IDENTIFIABLE","cleanCodeAttributeCategory":"CONSISTENT","impacts":[{"softwareQuality":"MAINTAINABILITY","severity":"HIGH"}],"issueStatus":"OPEN","projectName":"SLNX-validator","internalTags":[],"lastChangeAnalysisUuid":"29213cdc-cfdd-4f9e-9cb6-d3f3ef148fde","l...
This pull request was created from Copilot chat.