QL4QL: Remove MissingOverride query

This commit is contained in:
Tom Hvitved
2024-03-15 11:06:15 +01:00
parent 2fd2b4c874
commit 80649786c3
4 changed files with 0 additions and 60 deletions

View File

@@ -1,20 +0,0 @@
/**
* @name Missing override annotation
* @description Predicates that override another predicate should have an `override` annotation.
* @kind problem
* @problem.severity warning
* @precision very-high
* @id ql/missing-override
* @tags maintainability
*/
import ql
string getQualifiedName(ClassPredicate p) {
result = p.getDeclaringType().getName() + "." + p.getName()
}
from ClassPredicate pred, ClassPredicate sup
where pred.overrides(sup) and not pred.isOverride()
select pred, getQualifiedName(pred) + " overrides $@ but does not have an override annotation.",
sup, getQualifiedName(sup)

View File

@@ -1,2 +0,0 @@
| Test.qll:12:13:12:16 | ClassPredicate test | Wrong.test overrides $@ but does not have an override annotation. | Test.qll:4:13:4:16 | ClassPredicate test | Super.test |
| Test.qll:18:13:18:16 | ClassPredicate test | Wrong2.test overrides $@ but does not have an override annotation. | Test.qll:4:13:4:16 | ClassPredicate test | Super.test |

View File

@@ -1 +0,0 @@
queries/style/MissingOverride.ql

View File

@@ -1,37 +0,0 @@
import ql
class Super extends AstNode {
predicate test(int i) { i = [1 .. 5] }
}
class Correct extends Super {
override predicate test(int i) { i = 3 }
}
class Wrong extends Super {
predicate test(int i) { i = 2 }
}
class Mid extends Super { }
class Wrong2 extends Mid {
predicate test(int i) { i = 2 }
}
final class SuperFinal = Super;
class Correct2 extends SuperFinal {
predicate test(int i) { i = 4 }
}
class Correct3 extends AstNode instanceof SuperFinal {
predicate test(int i) { i = 4 }
}
final class Super2 extends AstNode {
predicate test(int i) { i = [1 .. 5] }
}
class Correct4 extends Super2 {
predicate test(int i) { i = 3 }
}