-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Apply consistent import ordering with spotless #1811
Conversation
Codecov Report
@@ Coverage Diff @@
## release/3.x #1811 +/- ##
=================================================
+ Coverage 86.76% 86.76% +<.01%
- Complexity 2490 2494 +4
=================================================
Files 311 311
Lines 6542 6552 +10
Branches 821 821
=================================================
+ Hits 5676 5685 +9
Misses 670 670
- Partials 196 197 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely! Thank you.
1. `import static java.*` | ||
1. `import static javax.*` | ||
1. `import static all other imports` | ||
1. blank line | ||
1. `import java.*` | ||
2. `import javax.*` | ||
3. `import all other imports` | ||
4. blank line | ||
5. `import static java.*` | ||
6. `import static javax.*` | ||
7. `import static all other imports` | ||
1. `import javax.*` | ||
1. `import all other imports` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also leverage IntelliJ IDEA's .editorconfig
extensions for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that should help as well 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent !!!
Spotless allows us to enforce a consistent import order. Configure it such that static imports are first and non-static imports afterwards. Within imports, java imports first, then javax, then all others. This is consistent with the existing CONTRIBUTING.md guidelines, apart from the fact that static imports are first. (File has been updated). I would propose that makes more sense, but happy to discuss. In any case, spotless already found inconsistent ordering within imports themselves, so that is already providing value for consistency. I have also updated the CONTRIBUTING guidelines to explain how `./gradlew spotlessApply` will fix a lot of issues without the developer having to worry about it. That should hopefully help newcomers make changes more confidently. (The only 2 files that are interesting to you are the `build.gradle` and `.github/CONTRIBUTING.md`. All other file changes were automatically performed after running `./gradlew spotlessApply` locally.)
50e401e
to
594160e
Compare
Spotless allows us to enforce a consistent import order. Configure it
such that static imports are first and non-static imports afterwards.
Within imports, java imports first, then javax, then all others.
This is consistent with the existing CONTRIBUTING.md guidelines, apart
from the fact that static imports are first. (File has been updated). I
would propose that makes more sense, but happy to discuss.
In any case, spotless already found inconsistent ordering within imports
themselves, so that is already providing value for consistency.
I have also updated the CONTRIBUTING guidelines to explain how
./gradlew spotlessApply
will fix a lot of issues without thedeveloper having to worry about it. That should hopefully help newcomers
make changes more confidently.
(The only 2 files that are interesting to you are the
build.gradle
and.github/CONTRIBUTING.md
. All other file changes were automaticallyperformed after running
./gradlew spotlessApply
locally.)