saveourtool/diktat

`FILE_UNORDERED_IMPORTS` error message doesn't match the style guide

Open

#1933 aperta il 19 giu 2024

Vedi su GitHub
 (1 commento) (1 reazione) (0 assegnatari)Kotlin (40 fork)github user discovery
buggood first issue

Metriche repository

Star
 (571 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Describe the bug

When there is a violation on imports, the error message doesn't match Diktat style guide. The message says:

[FILE_UNORDERED_IMPORTS] imports should be ordered alphabetically and shouldn't be separated by newlines: import [...] (diktat-ruleset:file-structure)

while the corresponding style rule says:

From top to bottom, the order is the following:

  1. Android
  2. Imports of packages used internally in your organization
  3. Imports from other non-core dependencies
  4. Java core packages
  5. kotlin stdlib

Each category should be alphabetically arranged. Each group should be separated by a blank line.

In fact, running gradle diktatFix formats the code according to the convention above.

Expected behavior

The error message should match the style guide

Steps to Reproduce

  1. shuffle import declarations or remove blank lines between groups
  2. run gradle diktatCheck

Environment information

  • diktat version: 2.0.0
  • build tool (maven/gradle): gradle
  • how is diktat run (CLI, plugin, etc.): plugin
  • kotlin version: 1.9.24
  • operating system: MacOS

Guida contributor