Skip to content

Commit 4b78606

Browse files
committed
C++: SloppyGlobal: Don't alert on template instantiations, only the template
1 parent 0b68c1c commit 4b78606

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cpp/ql/src/Best Practices/SloppyGlobal.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import semmle.code.cpp.ConfigurationTestFile
1414
from GlobalVariable gv
1515
where
1616
gv.getName().length() <= 3 and
17+
// We will give an alert for the TemplateVariable, so we don't
18+
// need to also give one for each instantiation
19+
not gv instanceof VariableTemplateInstantiation and
1720
not gv.isStatic() and
1821
not gv.getFile() instanceof ConfigurationTestFile // variables in files generated during configuration are likely false positives
1922
select gv,

0 commit comments

Comments
 (0)