Skip to content

Commit a382c28

Browse files
committed
tweaks
1 parent 5e626e7 commit a382c28

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

man/manual.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,24 +103,25 @@ need to use both approaches. Later chapters will describe this in more detail.
103103

104104
### Check files matching a given file filter
105105

106-
The option `--file-filter=<str>` is used to specify a file filter pattern. If this is specified then files/paths will be checked only if they match the provided pattern.
106+
With `--file-filter=<str>` you can configure file filter(s) and then only those files matching the filter will be checked.
107107

108-
For example:
108+
For example, this command below means that `src/test1.cpp` and `src/test/file1.cpp` could be checked, but `src/file2.cpp` will not be checked:
109109

110110
cppcheck src/ --file-filter=src/test*
111111

112-
This command means for example that `src/test1.cpp` and `src/test/file1.cpp` are checked, but `src/file2.cpp` is not checked.
113-
114112
You can use `**`, `*` and `?` in the file filter pattern.
115113
`**`: matches zero or more characters, including path separators
116114
`*`: matches zero or more characters, excluding path separators
117115
`?`: matches zero or one characters, excluding path separators
118116

119117
A common use case for `--file-filter` is to check a project, but only check certain files:
120118

121-
cppcheck --project=compile_commands.json --file-filter=src/file1.c
119+
cppcheck --project=compile_commands.json --file-filter=src/*.c
122120

123-
Typically a `compile_commands.json` contains absolute paths, but the file filter pattern can match either the relative path or absolute path.
121+
Typically a `compile_commands.json` contains absolute paths. However no matter if `compile_commands.json` contains absolute paths or relative paths, the option `--file-filter=src/*.c` would mean that:
122+
* a file with relative path `test1.c` is not checked.
123+
* a file with relative path `src/test2.c` can be checked.
124+
* a file with relative path `src/test3.cpp` is not checked.
124125

125126
### Excluding a file or folder from checking
126127

@@ -135,6 +136,14 @@ You can use `**`, `*` and `?` in the pattern to specify excluded folders/files.
135136
`*`: matches zero or more characters, excluding path separators
136137
`?`: matches zero or one characters, excluding path separators
137138

139+
A use case for `-i` is to check a project, but exclude certain files/folders:
140+
141+
cppcheck --project=compile_commands.json -itest
142+
143+
Typically a `compile_commands.json` contains absolute paths. However no matter if `compile_commands.json` contains absolute paths or relative paths, the option `-itest` would mean that:
144+
* a file with relative path `test1.cpp` can be checked.
145+
* a file with relative path `test/somefile.cpp` is not checked
146+
138147
### Clang parser (experimental)
139148

140149
By default Cppcheck uses an internal C/C++ parser. However there is an experimental option to use the Clang parser instead.

0 commit comments

Comments
 (0)