since last week we have a lot of additional code smells about unnecessary imports. But actually all of them are false positive. We already use detekt & ktlint locally and on our CI. They find none of the issues. Also IntelliJ IDEA “optimize imports” doesn’t remove anything.
So it looks like the unnecessary imports rules is currently broken. One thing I noticed is that constants used from companion objects are mostly causing the issues. E.g.
import com.example.MyClass is reported even though
MyClass.MY_CONSTANT is used inside the class. Also we see this issue when using methods from companion objects.