saveourtool/diktat

`FILE_UNORDERED_IMPORTS` false positive when the list of imports contains an alias import

Open

#1.494 geöffnet am 9. Aug. 2022

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (1 zugewiesene Person)Kotlin (40 Forks)github user discovery
buggood first issue

Repository-Metriken

Stars
 (571 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Traditionally, IDEA places all alias imports into a separate group which can't be removed:

import-layout

On the contrary, diKTat doesn't distinguish between regular and alias imports and requires that all imports are sorted alphabetically.

As a workaround, the user has to suppress FILE_UNORDERED_IMPORTS whenever alias imports are used:

@file:Suppress("FILE_UNORDERED_IMPORTS")

package com.example

import java.lang.String

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.TestMethodOrder
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource

import java.lang.Object as JvmObject

Environment information

  • diktat version: 1.2.3

Contributor Guide