Skip to content

feature/#88 suppress warnings based on symbol name and file - #97

Merged
davidramnero merged 9 commits into
mainfrom
feature/#88-suppress-warnings-based-on-symbol-name-and-file
Aug 4, 2026
Merged

feature/#88 suppress warnings based on symbol name and file#97
davidramnero merged 9 commits into
mainfrom
feature/#88-suppress-warnings-based-on-symbol-name-and-file

Conversation

@davidramnero

@davidramnero davidramnero commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator
Screenshot 2026-07-30 at 19 28 39 Screenshot 2026-07-30 at 19 28 48 Screenshot 2026-07-30 at 19 28 59 Screenshot 2026-07-30 at 19 29 11 Screenshot 2026-07-30 at 19 29 39

@davidramnero
davidramnero requested a review from danmar July 30, 2026 17:31
@danmar

danmar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

do I have to manually write the filename or symbol name?

@davidramnero

Copy link
Copy Markdown
Collaborator Author

do I have to manually write the filename or symbol name?

Filename will auto-fill based on the document being analyzed. There is a function that tries to guess symbol name based on the line affected (trying to parse out a function or variable name). The result of this will be set as a suggested symbol name filled into the text box, but can be edited manually

@danmar

danmar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

hmm the symbolname is written for warnings when available if xml output is used. there is a <symbol> element.

$ ./cppcheck --xml 1.c --enable=unusedFunction -q
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
    <cppcheck version="2.21 dev"/>
    <errors>
        <error id="unusedFunction" severity="style" msg="The function &apos;foo&apos; is never used." verbose="The function &apos;foo&apos; is never used." cwe="561">
            <location file="1.c" line="2" column="6"/>
            <symbol>foo</symbol>
        </error>
    </errors>
</results>

@davidramnero

Copy link
Copy Markdown
Collaborator Author

hmm the symbolname is written for warnings when available if xml output is used. there is a <symbol> element.

$ ./cppcheck --xml 1.c --enable=unusedFunction -q
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
    <cppcheck version="2.21 dev"/>
    <errors>
        <error id="unusedFunction" severity="style" msg="The function &apos;foo&apos; is never used." verbose="The function &apos;foo&apos; is never used." cwe="561">
            <location file="1.c" line="2" column="6"/>
            <symbol>foo</symbol>
        </error>
    </errors>
</results>

Aah okay nice, did not realise! Will use this instead

@davidramnero

Copy link
Copy Markdown
Collaborator Author

Okay, I updated it so that we use symbol from the XML. It is not always present, so currently I let the user edit the symbol name or enter something else manually (the symbol name from the XML is pre-filled if preset). We might want the flow to work differently, what do you think @danmar ?

@danmar

danmar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

would it be possible to have:

  • if warning has no symbol then don't write anything about symbolname.
  • if warning has symbol, add a checkbox so the user can select if he wants to suppress warnings for that symbol only or all such warnings. I.e. only suppress if symbolname is 'util_broken' or something like that.

…w suppression by symbol if symbol is received from cppcheck
@davidramnero

Copy link
Copy Markdown
Collaborator Author

Okay, now the action is sensitive to if a diagnostic has a symbol associated with it recieved from cppcheck. This affects the flow of creating the suppression as well as text displayed in UI:

Screenshot 2026-08-03 at 16 06 46 Screenshot 2026-08-03 at 16 07 03 Screenshot 2026-08-03 at 16 07 19 Screenshot 2026-08-03 at 16 07 30

@davidramnero

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-08-03 at 16 07 44

@davidramnero
davidramnero merged commit 88c4c38 into main Aug 4, 2026
7 checks passed
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