Cppcheck GUI: Excluding a file or folder from checking

8.3k views Asked by At

I am using Cppcheck GUI to scan my projects (new in Cppcheck, just starded to use it) and want to exclude some sub folders when I am scanning my project.

How to exclude some sub folder when scanning project folder with cppcheck GUI?

I have watched some videos on YouTube and tried to exclude as shown in this video but it still scanning excluded sub folders.

Thanks in advance.

3

There are 3 answers

1
Wolf On

As of version 1.80, the manual still misses to describe the structure of GUI project files (chapter 12). The GUI itself has a lot of flaws, so I consider editing the project file through the GUI a waste of time. On the other hand, having these project files (under version control) and editing them by hand proved to be useful.

Here is the structure of a minimal project:

<?xml version="1.0" encoding="UTF-8"?>
<project version="1"/>

With such a file, Cppcheck is run on all potential C/C++ source files in the directory the cppcheck project file resides in (recursively including subfolders). You may exclude files or paths like this:

<?xml version="1.0" encoding="UTF-8"?>
<project version="1">
    <exclude>
        <path name="utilities/fileToExclude.c"/>
        <path name="utilities/pathToExclude/"/>
    </exclude>
</project>

Note: If you have the project already open in the GUI and edited its project file, remember to re-open the project file, only re-running all checks will not force a refresh of the project settings.

0
Brian A. Henning On

As of cppcheck-gui 1.88, the option to add excluded paths is found on the "Warning Options" tab:

screen grab of warning options tab

0
liu bluse On

Excluding a file or folder from checking To exclude a file or folder, there are two options. The first option is to only provide the paths and files you want to check.

cppcheck src/a src/b

All files under src/a and src/b are then checked. The second option is to use -i, with it you specify files/paths to ignore. With this command no files in src/c are checked:

cppcheck -isrc/c src

ref : http://cppcheck.sourceforge.net/manual.pdf