Import project: Ignoring paths better
This commit is contained in:
parent
4e222afa2c
commit
8855978f8a
|
@ -39,13 +39,18 @@ void ImportProject::ignorePaths(const std::vector<std::string> &ipaths)
|
|||
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
||||
bool ignore = false;
|
||||
for (std::string i : ipaths) {
|
||||
if (!Path::isAbsolute(i))
|
||||
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
if (!Path::isAbsolute(i)) {
|
||||
i = mPath + i;
|
||||
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ignore)
|
||||
fileSettings.erase(it++);
|
||||
else
|
||||
|
|
|
@ -179,3 +179,9 @@ def test_suppress_project():
|
|||
assert stderr == ''
|
||||
|
||||
|
||||
def test_exclude():
|
||||
prjpath = getRelativeProjectPath()
|
||||
ret, stdout, stderr = cppcheck(['-i' + prjpath, '--platform=win64', '--project=' + os.path.join(prjpath, 'helloworld.cppcheck')])
|
||||
assert stdout == 'cppcheck: No C or C++ source files found.\n'
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue