saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
537 stars 39 forks source link

FP in `RUN_IN_SCRIPT` rule #1693

Open orchestr7 opened 1 year ago

orchestr7 commented 1 year ago
@Suppress("RUN_IN_SCRIPT", "AVOID_NULL_CHECKS")
    plugins {
        id("com.saveourtool.diktat.buildutils.detekt-convention-configuration")
        // FixMe: remove after 2.0.0
        if (System.getenv("DIKTAT_SNAPSHOT") != null) {
            id("com.saveourtool.diktat.buildutils.diktat-convention-configuration")
        }
    }

should not cause error:

     "results": [
        {
          "level": "error",
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "gradle/plugins/build.gradle.kts",
                  "uriBaseId": "%SRCROOT%"
                },
                "region": {
                  "startColumn": 1,
                  "startLine": 25
                }
              }
            }
          ],
          "message": {
            "text": "[RUN_IN_SCRIPT] wrap blocks of code in top-level scope functions like `run`: @Suppress(\"COMMENTED_OUT_CODE\", \"WRONG_INDENTATION\")..."
          },
          "ruleId": "diktat-ruleset:run-script"