Code quality improvements + add dedicated DeadRefTypes test

This commit is contained in:
Tamas Vajk
2022-04-08 09:48:26 +02:00
committed by Ian Lynagh
parent cdc7ed0e14
commit 47799ae040
7 changed files with 25 additions and 5 deletions

View File

@@ -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) }

View File

@@ -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. |

View File

@@ -0,0 +1 @@
Violations of Best Practice/Dead Code/DeadRefTypes.ql

View 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)
}