Closed jonyscathe closed 3 months ago
facing the same issue. any solution or workaround available for the relative path
I never found any workaround and I am now just using cppcheck via command line (as well as pre-commit hooks and in CI builds). Not ideal, but anyway, would love for this to be fixed.
I have just added variable substitution on the various fields of the configuration; so you should now be able to specify ${workspaceFolder}
. The change will appear in the next (upcoming) release.
Hey, I may be missing something here, but I am struggling getting suppressions working with cppcheck.
When running from command line, I have a suppressions.txt file that I pass to cppcheck with the
--suppressions-list
option and that works fine. I thought I would just be able to pass this into the cppcheck.extraArgs, but this does not work. Rules that are 100% suppressed still work, but any rule that is only suppressed for a given file does not work. From looking through the debug logs I can see that the full path to the file being linted is given to cppcheck rather than a relative path so I think it doesn't work with relative paths in the suppressions.txt file. If I give full paths in the suppressions.txt file then the suppressions do work. I tried usingc-cpp-flylint.cppcheck.suppressions
and had a similar issue. Relative paths (to either the vscode workspace folder or to the local file) do not work, absolute paths do work. I had thought that using${workspaceFolder}
inc-cpp-flylint.cppcheck.suppressions
might work, but that doesn't seem to work for me (in Linux or Windows), as I just get something like this in the debugs:--suppress=arrayIndexOutOfBounds:${workspaceFolder}/path_to_file/file.c
This tool looks really useful, and this is the only major issue I have come across so far. But it is a bit of a problem for me given that I need this to work for multiple users across Windows/Ubuntu/macOS who will have the project checked out to different folders, so having relative file paths is very important. The best solution for me would be for the relative paths within my suppressions.txt file to just work. But defining my suppressions twice (once there for CI tools and once in
c-cpp-flylint.cppcheck.suppressions
) is at least workable if the easiest solution is to get ${workspaceFolder} expanding to the workspace folder so that cppcheck is given the suppressions with the full filenames.Note: Only other slight issue I have come across with cppcheck is the --platform argument. I am using cppcheck with an embedded project and want to define my own platform.xml (which I have done). I am passing platform.xml to cppcheck using
cppcheck.extraArgs
, but the full execution script contains both--platform=native
and--platform=platform.xml
. This doesn't seem to be causing any issues as far as I can tell, but probably isn't ideal.