Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The spotless should take care of unified imports ordering #9306

Closed
10 tasks done
reta opened this issue Aug 14, 2023 · 1 comment · Fixed by #9399
Closed
10 tasks done

[BUG] The spotless should take care of unified imports ordering #9306

reta opened this issue Aug 14, 2023 · 1 comment · Fixed by #9399
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request

Comments

@reta
Copy link
Collaborator

reta commented Aug 14, 2023

Is your feature request related to a problem? Please describe.
Came out of #9082 (review), the spotless does not enforce any formatting on order of imports statements, as such those are very chaotic in the codebase.

Describe the solution you'd like
The spotless should take care of unified imports ordering, the suggested formatting rules are not ideal but they should minimized the amount of files being changed at the same time, bringing consistent order to import statements:

importOrder(
              'de.thetaphi',
              'com.carrotsearch',
              'com.fasterxml',
              'com.avast',
              'com.sun',
              'com.maxmind|com.github|com.networknt|groovy|nebula',
              'org.antlr',
              'software.amazon',
              'com.azure|com.microsoft|com.ibm|com.google|joptsimple|org.apache|org.bouncycastle|org.codehaus|org.opensearch|org.objectweb|org.joda|org.hamcrest|org.openjdk|org.gradle|org.junit',
              'javax',
              'java',
              '',
              '\\#java|\\#org.opensearch|\\#org.hamcrest|\\#'
          )

Describe alternatives you've considered
Keep the chaotic imports

Additional context

  • benchmarks/
  • buildSrc/
  • client/
  • distribution/
  • libs/
  • modules/
  • plugins/
  • qa/
  • server/
  • test/
@andrross
Copy link
Member

andrross commented Aug 15, 2023

@reta Did you change the behavior of spotless to enforce import ordering? I see all the PRs that are reordering imports but didn't find a change to the spotless task itself.

Edit: Just worked this out for myself but obviously you can't enable enforcement until you fix all existing violations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request
Projects
None yet
2 participants