-
Notifications
You must be signed in to change notification settings - Fork 15.4k
KAFKA-10787: Add import ordering checkstyle rule and configure an automatic formatter #16097
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
Changes from 22 commits
227a957
7596c2d
7e56b6a
00ad230
2d6b289
77f46e1
e9db586
f2ef540
37cc473
40aabc0
2960a41
7cde3f8
8e171fb
82de188
5623a3b
3cb353d
1ee4e62
076b467
c3abfc2
462625d
6f25e4d
7d99f05
d956ba3
9f316a9
bfa5077
5e08003
3702bb1
54277f3
89999a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,8 @@ plugins { | |
| // Updating the shadow plugin version to 8.1.1 causes issue with signing and publishing the shadowed | ||
| // artifacts - see https://github.com/johnrengelman/shadow/issues/901 | ||
| id 'com.github.johnrengelman.shadow' version '8.1.0' apply false | ||
| id 'com.diffplug.spotless' version '6.14.0' apply false // 6.14.1 and newer require Java 11 at compile time, so we can't upgrade until AK 4.0 | ||
| // 6.14.0 and newer are need for java 11 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I refer to spotless github: https://github.com/diffplug/spotless/tree/main/plugin-gradle#requirements |
||
| id 'com.diffplug.spotless' version "6.13.0" apply false | ||
| } | ||
|
|
||
| ext { | ||
|
|
@@ -198,6 +199,9 @@ def determineCommitId() { | |
| } | ||
| } | ||
|
|
||
| def spotlessApplyModules = [''] | ||
|
|
||
|
|
||
| apply from: file('wrapper.gradle') | ||
|
|
||
| if (repo != null) { | ||
|
|
@@ -793,6 +797,16 @@ subprojects { | |
| skipProjects = [ ":jmh-benchmarks", ":trogdor" ] | ||
| skipConfigurations = [ "zinc" ] | ||
| } | ||
|
|
||
| if (project.name in spotlessApplyModules) { | ||
| apply plugin: 'com.diffplug.spotless' | ||
| spotless { | ||
| java { | ||
| importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#') | ||
| removeUnusedImports() | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| gradle.taskGraph.whenReady { taskGraph -> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,10 @@ | |
| <property name="file" value="${config_loc}/${importControlFile}"/> | ||
| </module> | ||
|
|
||
| <!-- import order rule not config in the checkstyle.xml. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I update that @chia7712 |
||
| import order check by is checked by the spotless plugin. | ||
| More checks may be handed over to the spotless plugin in the future--> | ||
|
|
||
| <!-- whitespace --> | ||
| <module name="GenericWhitespace"/> | ||
| <module name="NoWhitespaceBefore"/> | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
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.
The import order is a part of static check. please callspotlessApplyto optimize the imports of Java codes before filing pull request.