Initial commit
This commit is contained in:
commit
b333128660
55 changed files with 1638 additions and 0 deletions
34
examples/src/main/kotlin/com/example/Example.kt
Normal file
34
examples/src/main/kotlin/com/example/Example.kt
Normal file
|
@ -0,0 +1,34 @@
|
|||
package com.example
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Example class.
|
||||
*/
|
||||
class Example {
|
||||
val message: String
|
||||
get() = "Hello World!"
|
||||
|
||||
// https://detekt.dev/docs/1.22.0/rules/performance#arrayprimitive
|
||||
fun returningFunction(): Array<Double> { return arrayOf() }
|
||||
|
||||
// https://detekt.dev/docs/1.22.0/rules/style#canbenonnullable
|
||||
fun foo(a: Int?) {
|
||||
val b = a!! + 2
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
// https://detekt.dev/docs/1.22.0/rules/naming#booleanpropertynaming
|
||||
val progressBar: Boolean = true
|
||||
// https://detekt.dev/docs/1.22.0/rules/potential-bugs#avoidreferentialequality
|
||||
val areEqual = "aString" === ""
|
||||
println(Example().message)
|
||||
if (false) {
|
||||
// https://detekt.dev/docs/1.22.0/rules/exceptions#exceptionraisedinunexpectedlocation
|
||||
throw IllegalStateException()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue