Skip to content

[KtLint] Diktat resolves locations/physicalLocation/region incorrectly for UNUSED_IMPORT #1637

Open
@nulls

Description

@nulls

Describe the bug

Diktat resolves locations/physicalLocation/region for UNUSED_IMPORT always to 1:1:

       {
          "level": "error",
          "locations": [
            {
              "physicalLocation": {
                "artifactLocation": {
                  "uri": "save-demo/src/main/kotlin/com/saveourtool/save/demo/SaveDemo.kt",
                  "uriBaseId": "%SRCROOT%"
                },
                "region": {
                  "startColumn": 1,
                  "startLine": 1
                }
              }
            }
          ],
          "message": {
            "text": "[UNUSED_IMPORT] unused imports should be removed: org.springframework.http.ResponseEntity - unused import"
          },
          "ruleId": "diktat-ruleset:file-structure"
        },

Expected behavior

Sarif report is generated with invalid locations/physicalLocation/region

Observed behavior

Project has diktat's issues, the gradle plugin generates a sarif report. Github doesn't show annotations with some errors, but shows for another

Steps to Reproduce

saveourtool/save-cloud#2025

Environment information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpluginsPlugins for build systems to allow them to run diktat

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions