Exclude test directories of typical build tools

This commit is contained in:
luchua-bc
2021-02-18 00:50:38 +00:00
parent 5e36eedcb6
commit e916ce8b9b

View File

@@ -42,7 +42,8 @@ class ServletMainMethod extends Method {
this.getNumberOfParameters() = 1 and
this.getParameter(0).getType() instanceof Array and
not this.getDeclaringType().getName().toLowerCase().matches("%test%") and // Simple check to exclude test classes to reduce FPs
not this.getDeclaringType().getPackage().getName().toLowerCase().matches("%test%") // Simple check to exclude classes in test packages to reduce FPs
not this.getDeclaringType().getPackage().getName().toLowerCase().matches("%test%") and // Simple check to exclude classes in test packages to reduce FPs
not exists(this.getLocation().getFile().getAbsolutePath().indexOf("/src/test/java")) // Match test directory structure of build tools like maven
}
}