aboutsummaryrefslogtreecommitdiff
path: root/detekt/src/main/kotlin/PreprocessingPatterns.kt
blob: 695f088cfe22d86a30715e35e3f595e6ba11df68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package at.hannibal2.skyhanni.detektrules

enum class PreprocessingPattern(val text: String) {
    IF("#if"),
    ELSE("#else"),
    ELSEIF("#elseif"),
    ENDIF("#endif"),
    DOLLAR_DOLLAR("$$"),
    ;

    val asComment: String
        get() = "//$text"

    companion object {
        fun String.containsPreprocessingPattern(): Boolean {
            return entries.any { this.contains(it.text) }
        }
    }
}