mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
Merge pull request #5515 from criemen/fix-query-metadata
C++: Fix query metadata warnings.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
* @kind treemap
|
||||
* @treemap.warnOn highValues
|
||||
* @metricType externalDependency
|
||||
* @precision medium
|
||||
* @id cpp/external-dependencies
|
||||
* @tags modularity
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
* @treemap.warnOn highValues
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
* @precision very-high
|
||||
* @id cpp/lines-of-code-in-files
|
||||
* @tags maintainability
|
||||
* complexity
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* @treemap.warnOn highValues
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
* @precision high
|
||||
* @id cpp/lines-of-commented-out-code-in-files
|
||||
* @tags documentation
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
* @treemap.warnOn lowValues
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
* @precision very-high
|
||||
* @id cpp/lines-of-comments-in-files
|
||||
* @tags maintainability
|
||||
* documentation
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* @treemap.warnOn highValues
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
* @precision high
|
||||
* @id cpp/duplicated-lines-in-files
|
||||
* @tags testability
|
||||
* modularity
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
* @treemap.warnOn lowValues
|
||||
* @metricType file
|
||||
* @metricAggregate avg sum max
|
||||
* @precision medium
|
||||
* @id cpp/tests-in-files
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
12
cpp/ql/src/external/tests/DefectFilter.ql
vendored
12
cpp/ql/src/external/tests/DefectFilter.ql
vendored
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* @name Defect filter
|
||||
* @description Only include results in large files (200) lines of code, and change the message.
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import external.DefectFilter
|
||||
|
||||
from DefectResult res
|
||||
where res.getFile().getMetrics().getNumberOfLinesOfCode() > 200
|
||||
select res, "Large files: " + res.getMessage()
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* @name Defect from external data
|
||||
* @description Insert description here...
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @tags external-data
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import external.ExternalArtifact
|
||||
|
||||
from ExternalData d, File u
|
||||
where
|
||||
d.getQueryPath() = "external-data.ql" and
|
||||
u.getShortName() = d.getField(0)
|
||||
select u,
|
||||
d.getField(5) + ", " + d.getFieldAsDate(1) + ", " + d.getField(2) + ", " + d.getFieldAsFloat(3) +
|
||||
", " + d.getFieldAsInt(4) + ": " + d.getNumFields()
|
||||
12
cpp/ql/src/external/tests/MetricFilter.ql
vendored
12
cpp/ql/src/external/tests/MetricFilter.ql
vendored
@@ -1,12 +0,0 @@
|
||||
/**
|
||||
* @name Metric filter
|
||||
* @description Only include results in large files (200) lines of code.
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import external.MetricFilter
|
||||
|
||||
from MetricResult res
|
||||
where res.getFile().getMetrics().getNumberOfLinesOfCode() > 200
|
||||
select res, res.getValue()
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* @name Filter: exclude results from files that are autogenerated
|
||||
* @description Use this filter to return results only if they are
|
||||
* located in files that are maintained manually.
|
||||
* @kind problem
|
||||
* @id cpp/autogenerated-filter
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import semmle.code.cpp.AutogeneratedFile
|
||||
import external.DefectFilter
|
||||
|
||||
from DefectResult res
|
||||
where not res.getFile() instanceof AutogeneratedFile
|
||||
select res, res.getMessage()
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* @name Metric filter: exclude results from files that are autogenerated
|
||||
* @description Use this filter to return results only if they are
|
||||
* located in files that are maintained manually.
|
||||
* @kind treemap
|
||||
* @id cpp/autogenerated-for-metric-filter
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import semmle.code.cpp.AutogeneratedFile
|
||||
import external.MetricFilter
|
||||
|
||||
from MetricResult res
|
||||
where not res.getFile() instanceof AutogeneratedFile
|
||||
select res, res.getValue()
|
||||
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* @name Filter: exclude results from files for which we do not have
|
||||
* source code
|
||||
* @description Use this filter to return results only if they are
|
||||
* located in files for which we have source code.
|
||||
* @kind problem
|
||||
* @id cpp/from-source-filter
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import external.DefectFilter
|
||||
|
||||
from DefectResult res
|
||||
where res.getFile().fromSource()
|
||||
select res, res.getMessage()
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* @name Filter: exclude results on lines covered by a macro expansion
|
||||
* @description Use this filter to return results only when there is no
|
||||
* macro expansion whose location spans all the lines of
|
||||
* the result's location.
|
||||
* @kind problem
|
||||
* @id cpp/macros-filter
|
||||
* @tags filter
|
||||
*/
|
||||
|
||||
import cpp
|
||||
import external.DefectFilter
|
||||
|
||||
predicate macroLocation(File f, int startLine, int endLine) {
|
||||
exists(MacroInvocation mi, Location l |
|
||||
l = mi.getLocation() and
|
||||
l.getFile() = f and
|
||||
l.getStartLine() = startLine and
|
||||
l.getEndLine() = endLine
|
||||
)
|
||||
}
|
||||
|
||||
predicate macroCovering(DefectResult r) {
|
||||
exists(File f, int macroStart, int macroEnd, int defectStart, int defectEnd |
|
||||
f = r.getFile() and
|
||||
defectStart = r.getStartLine() and
|
||||
defectEnd = r.getEndLine() and
|
||||
macroLocation(f, macroStart, macroEnd) and
|
||||
macroStart <= defectStart and
|
||||
macroEnd >= defectEnd
|
||||
)
|
||||
}
|
||||
|
||||
from DefectResult res
|
||||
where not macroCovering(res)
|
||||
select res, res.getMessage()
|
||||
Reference in New Issue
Block a user