mirror of
https://github.com/github/codeql.git
synced 2026-03-30 20:28:15 +02:00
Python: Update all metrics-dependant queries
The ones that no longer require points-to no longer import `LegacyPointsTo`. The ones that do use the specific `...MetricsWithPointsTo` classes that are applicable.
This commit is contained in:
@@ -18,6 +18,6 @@ from FunctionValue method
|
||||
where
|
||||
exists(ClassValue c |
|
||||
c.declaredAttribute("__del__") = method and
|
||||
method.getScope().(FunctionMetrics).getCyclomaticComplexity() > 3
|
||||
method.getScope().(FunctionMetricsWithPointsTo).getCyclomaticComplexity() > 3
|
||||
)
|
||||
select method, "Overly complex '__del__' method."
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics f
|
||||
select f, f.getNumberOfLinesOfCode() as n order by n desc
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ClassMetrics cls
|
||||
from ClassMetricsWithPointsTo cls
|
||||
select cls, cls.getAfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ClassMetrics cls
|
||||
from ClassMetricsWithPointsTo cls
|
||||
select cls, cls.getEfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics mm
|
||||
where mm.getNumberOfLines() > 0
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics func, int complexity
|
||||
from FunctionMetricsWithPointsTo func, int complexity
|
||||
where complexity = func.getCyclomaticComplexity()
|
||||
select func, complexity order by complexity desc
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics mm
|
||||
where mm.getNumberOfLines() > 0
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where n = m.getNumberOfLines()
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where n = m.getNumberOfLinesOfCode()
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where n = m.getNumberOfLinesOfComments() + m.getNumberOfLinesOfDocStrings()
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics func
|
||||
select func, func.getNumberOfCalls() as n order by n desc
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics func
|
||||
select func, func.getStatementNestingDepth() as n order by n desc
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m, int n
|
||||
where
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m
|
||||
where exists(m.getNumberOfLinesOfCode())
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
int committedFiles(Commit commit) { result = count(commit.getAnAffectedFile()) }
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
predicate inRange(Commit first, Commit second) {
|
||||
first.getAnAffectedFile() = second.getAnAffectedFile() and
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m
|
||||
where exists(m.getNumberOfLinesOfCode())
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
import python
|
||||
import external.VCS
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m
|
||||
where
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ClassMetrics cls
|
||||
select cls, cls.getLackOfCohesionCK() as n order by n desc
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ClassMetrics cls
|
||||
select cls, cls.getLackOfCohesionHM() as n order by n desc
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m
|
||||
from ModuleMetricsWithPointsTo m
|
||||
select m, m.getAfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from ModuleMetrics m
|
||||
from ModuleMetricsWithPointsTo m
|
||||
select m, m.getEfferentCoupling() as n order by n desc
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics func
|
||||
select func, func.getNumberOfParametersWithoutDefault() as n order by n desc
|
||||
|
||||
@@ -10,6 +10,5 @@
|
||||
*/
|
||||
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
select sum(ModuleMetrics m | | m.getNumberOfLinesOfCode())
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
import python
|
||||
import semmle.python.filters.GeneratedCode
|
||||
private import LegacyPointsTo
|
||||
|
||||
select sum(ModuleMetrics m |
|
||||
exists(m.getFile().getRelativePath()) and
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import python
|
||||
private import LegacyPointsTo
|
||||
|
||||
from FunctionMetrics func
|
||||
from FunctionMetricsWithPointsTo func
|
||||
select func.toString(), func.getCyclomaticComplexity()
|
||||
|
||||
Reference in New Issue
Block a user