Skip to content

Fix #14225 (addons; add optional "hash" attribute for warning messages)#7915

Merged
danmar merged 2 commits intodanmar:mainfrom
cppchecksolutions:fix-14225
Nov 1, 2025
Merged

Fix #14225 (addons; add optional "hash" attribute for warning messages)#7915
danmar merged 2 commits intodanmar:mainfrom
cppchecksolutions:fix-14225

Conversation

@danmar
Copy link
Copy Markdown
Owner

@danmar danmar commented Oct 26, 2025

No description provided.

@danmar
Copy link
Copy Markdown
Owner Author

danmar commented Oct 26, 2025

@mario-campos I guess you might be interested in this PR. The Sarif output from Cppcheck will sometimes provide a partialFingerprints for warnings. It's rarelly provided today but I hope we can provide it more in the future.

Example:

{
  "$schema": "https:\/\/docs.oasis-open.org\/sarif\/sarif\/v2.1.0\/errata01\/os\/schemas\/sarif-schema-2.1.0.json",
  "runs": [
    {
      "results": [
        {
          "level": "error",
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "test1.c"
                },
                "region": {
                  "endColumn": 14,
                  "endLine": 3,
                  "startColumn": 14,
                  "startLine": 3
                }
              }
            }
          ],
          "message": {
            "text": "Ensure that operations on signed integers do not result in overflow"
          },
          "partialFingerprints": {
            "hash": "11638054069549063377",
            "id": "premium-cert-int32-c"
          },
          "ruleId": "premium-cert-int32-c"
        }
      ],
      "tool": {
        "driver": {
          "informationUri": "https:\/\/cppcheck.sourceforge.io",
          "name": "Cppcheck",
          "rules": [
            {
              "defaultConfiguration": {
                "level": "error"
              },
              "fullDescription": {
                "text": ""
              },
              "help": {
                "text": ""
              },
              "id": "premium-cert-int32-c",
              "name": "",
              "properties": {
                "precision": "high",
                "problem.severity": "error"
              },
              "shortDescription": {
                "text": ""
              }
            }
          ],
          "semanticVersion": "2.19"
        }
      }
    }
  ],
  "version": "2.1.0"
}

Comment thread lib/sarifreport.cpp Outdated
Comment thread lib/sarifreport.cpp Outdated
@mario-campos
Copy link
Copy Markdown
Contributor

Hey, @danmar. I provided some minor nitpicks, but I agree—it would be nice to see that SARIF output more complete. Nice job!

@sonarqubecloud
Copy link
Copy Markdown

Comment thread test/cli/premium_test.py Dismissed
@danmar danmar merged commit f3d9a37 into danmar:main Nov 1, 2025
55 checks passed
@danmar danmar deleted the fix-14225 branch November 1, 2025 15:01
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.

3 participants