mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
Code quality improvements + add dedicated DeadRefTypes test
This commit is contained in:
@@ -87,4 +87,4 @@ query predicate modifiers(ClassInstanceExpr e, Method m, string modifier) {
|
||||
m.hasModifier(modifier)
|
||||
}
|
||||
|
||||
query predicate compGenerated(Top t, int i) { compiler_generated(t, i) }
|
||||
query predicate compGenerated(Element e, int i) { compiler_generated(e, i) }
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
| test.kt:1:1:1:20 | C1 | Unused class: C1 is not referenced within this codebase. If not used as an external API it should be removed. |
|
||||
@@ -0,0 +1 @@
|
||||
Violations of Best Practice/Dead Code/DeadRefTypes.ql
|
||||
15
java/ql/test/kotlin/query-tests/DeadRefTypes/test.kt
Normal file
15
java/ql/test/kotlin/query-tests/DeadRefTypes/test.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
private class C1 { }
|
||||
|
||||
private class C2 { }
|
||||
|
||||
fun fn() {
|
||||
val c = C2()
|
||||
}
|
||||
|
||||
fun fn1() = 5
|
||||
|
||||
fun fn2(f: () -> Unit) = f()
|
||||
|
||||
fun adapted() {
|
||||
fn2(::fn1)
|
||||
}
|
||||
Reference in New Issue
Block a user