Import project: Ignoring paths better
This commit is contained in:
parent
4e222afa2c
commit
8855978f8a
|
@ -39,12 +39,17 @@ void ImportProject::ignorePaths(const std::vector<std::string> &ipaths)
|
||||||
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
for (std::list<FileSettings>::iterator it = fileSettings.begin(); it != fileSettings.end();) {
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
for (std::string i : ipaths) {
|
for (std::string i : ipaths) {
|
||||||
if (!Path::isAbsolute(i))
|
|
||||||
i = mPath + i;
|
|
||||||
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
if (it->filename.size() > i.size() && it->filename.compare(0,i.size(),i)==0) {
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
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)
|
if (ignore)
|
||||||
fileSettings.erase(it++);
|
fileSettings.erase(it++);
|
||||||
|
|
|
@ -179,3 +179,9 @@ def test_suppress_project():
|
||||||
assert stderr == ''
|
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