Open slovdahl opened 2 months ago
We also happen to have the import order (not the "illegal imports") duplicated already in an .editorconfig
file exported for IntelliJ using the ij_java_imports_layout
property in a [*.java]
section. It doesn't seem like OpenRewrite can use this either?
What problem are you trying to solve?
Automatically reformat Java imports according to our Checkstyle configuration.
Describe the solution you'd like
The
org.openrewrite.staticanalysis.CodeCleanup
plugin suggested by Automatically fix checkstyle violations could support determining the import style by importing theImportOrder
andIllegalImport
modules from the checkstyle config.Have you considered any alternatives or workarounds?
Duplicating the checkstyle import config in an OpenRewrite style: https://docs.openrewrite.org/concepts-explanations/styles
Additional context
I initially thought that https://docs.openrewrite.org/recipes/java/orderimports would support it, but it seems like OpenRewrite's styles are not based on the checkstyle config at all (looking at https://github.com/openrewrite/rewrite/blob/1b487f58b6a2f4839d73afd085ec2ed3f075ab40/rewrite-java/src/main/java/org/openrewrite/java/style/CheckstyleConfigLoader.java).
Are you interested in contributing this feature to OpenRewrite?
Depends on how hard it is. This is the first time I'm using OpenRewrite so at this point I'm still just learning how to use it.