10

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.

Wolf
  • 9,679
  • 7
  • 62
  • 108
T M
  • 3,195
  • 2
  • 31
  • 52
  • It's even possible to [do so in the project file](https://stackoverflow.com/a/46033602/2932052) – Wolf Sep 04 '17 at 08:58

3 Answers3

6

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

Clay
  • 4,700
  • 3
  • 33
  • 49
liu bluse
  • 169
  • 1
  • 4
5

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.

Wolf
  • 9,679
  • 7
  • 62
  • 108
  • There is some documentation in a [textfile in the source repository](https://trac.cppcheck.net/browser/gui/projectfile.txt?rev=4b67780baecce274e83efe8d7bd49cf2b2b1d5e9). – ingomueller.net Aug 08 '19 at 09:41
2

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

Brian A. Henning
  • 1,374
  • 9
  • 24