C++: SloppyGlobal: Don't alert on template instantiations, only the template

This commit is contained in:
Ian Lynagh
2025-08-15 11:23:48 +01:00
parent 0b68c1c974
commit 4b786061d6

View File

@@ -14,6 +14,9 @@ import semmle.code.cpp.ConfigurationTestFile
from GlobalVariable gv
where
gv.getName().length() <= 3 and
// We will give an alert for the TemplateVariable, so we don't
// need to also give one for each instantiation
not gv instanceof VariableTemplateInstantiation and
not gv.isStatic() and
not gv.getFile() instanceof ConfigurationTestFile // variables in files generated during configuration are likely false positives
select gv,