jbenden / vscode-c-cpp-flylint

A VS Code extension for advanced, modern, static analysis of C/C++ that supports a number of back-end analyzer programs.
MIT License
152 stars 29 forks source link

cppcheck - Suppressions have no effect #184

Closed zhengliw closed 3 months ago

zhengliw commented 1 year ago

Hello to everyone!

I have been experiencing an issue which is only seems to occur on Windows. I haven't tested on Linux yet, but on MacOS, the issue is not present.

When you set c-cpp-flylint.cppcheck.suppressions to something like unusedStructMember:${workspaceFolder}/include/* so that the config option contains a asterix or a question mark, the extension throws this error:

'Line could not be parsed: ${workspaceFolder}\include\*  -1  information unmatchedSuppression: Unmatched suppression: unusedStructMember' while validating: c:\Users\user\source\repos\clist\include\clist.h. Please analyze the 'C/C++ FlyLint' Output console. Stacktrace: Error: Line could not be parsed: ${workspaceFolder}\include\*  -1  information unmatchedSuppression: Unmatched suppression: unusedStructMember
    at c:\Users\user\.vscode\extensions\jbenden.c-cpp-flylint-1.12.1\server\out\server.js:2:39162
    at Array.forEach (<anonymous>)
    at u.parseLines (c:\Users\user\.vscode\extensions\jbenden.c-cpp-flylint-1.12.1\server\out\server.js:2:38911)
    at u.lint (c:\Users\user\.vscode\extensions\jbenden.c-cpp-flylint-1.12.1\server\out\server.js:2:38814)
    at c:\Users\user\.vscode\extensions\jbenden.c-cpp-flylint-1.12.1\server\out\server.js:2:48254
    at Array.forEach (<anonymous>)
    at Function.L (c:\Users\user\.vscode\extensions\jbenden.c-cpp-flylint-1.12.1\server\out\server.js:2:48229)

If it helps, here is my work in progress repository where this error occurs, although I believe that this is an independent error: clist - linked list in c

I have already done some research and have taken a look at other relating issues in this repository. But they all don't seem to have a direct solution, and along with many already closed issues.

I would really appreciate your help and will definitly recommend this add-on to other people. Thanks!

zhengliw commented 1 year ago

Okay, now I can also confirm the issue on MacOS.

By the way, I have the following configuration in .vscode/settings to suppress unusedStructMember in headers:

"c-cpp-flylint.cppcheck.suppressions": [
        "unusedStructMember:*.h"
    ]
zhengliw commented 1 year ago

Hmm, I changed my config to this and it magically started working.

"c-cpp-flylint.cppcheck.suppressions": [
        "cstyleCast",
        "unusedStructMember:?.h"
    ],

I will reopen the issue if the problem persists. All the best for this extension!

zhengliw commented 1 year ago

PREVIOUS ISSUE TITLE: Line could not be parsed: ${workspaceFolder}\include*

zhengliw commented 1 year ago

Hello!

Sorry that the issue persists and I have to bother you all again. Above you can already find some useful information related to my problem, but this time, the issue appears differently.

Instead of reporting line could not be parsed, the suppressions I have set in the settings.json file in the project folder have been ignored, i.e., the reports just show normally.

Here is the part defining the suppressions, in .vscode/settings.json:

    "c-cpp-flylint.cppcheck.suppressions": [
        "cstyleCast",
        "*:README:*",
        "*:Doxyfile:*",
        "*:LICENSE:*",
        "*:include/clist.h:*"
    ],

Here is my directory structure:

├── .github
│   └── workflows
├── .gitignore
├── .vscode
│   ├── c_cpp_properties.json
│   └── settings.json
├── Doxyfile
├── LICENSE
├── README.md
├── doc
│   ├── html
│   ├── index.html
│   └── theme
├── include
│   └── clist.h
└── src
    └── clist.c

I am very confused right now. I would appreciate any source of help. Thank you!

YusufSuleman commented 1 year ago

Project is dead I think

jbenden commented 3 months ago

With variable substitution in parameters, you should be able to use the suppressions settings. (pending the publishing of the extension)