-
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 13 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,7 @@ 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 | ||
| id 'com.diffplug.spotless' version "${spotlessVersion}" apply false | ||
| } | ||
|
|
||
| ext { | ||
|
|
@@ -196,6 +196,19 @@ def determineCommitId() { | |
| } | ||
| } | ||
|
|
||
| def spotlessApplyModules = [''] | ||
|
|
||
| def configureSpotless = { project -> | ||
| project.apply plugin: 'com.diffplug.spotless' | ||
|
|
||
| project.spotless { | ||
| java { | ||
| importOrder('kafka', 'org.apache.kafka', 'com', 'net', 'org', 'java', 'javax', '', '\\#') | ||
| removeUnusedImports() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| apply from: file('wrapper.gradle') | ||
|
|
||
| if (repo != null) { | ||
|
|
@@ -787,6 +800,12 @@ subprojects { | |
| skipProjects = [ ":jmh-benchmarks", ":trogdor" ] | ||
| skipConfigurations = [ "zinc" ] | ||
| } | ||
|
|
||
| afterEvaluate { | ||
|
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. Maybe we can set spotless directly. For example:
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 change the PR,please review it @chia7712 |
||
| if (project.name in spotlessApplyModules) { | ||
| configureSpotless(project) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| gradle.taskGraph.whenReady { taskGraph -> | ||
|
|
@@ -1007,7 +1026,7 @@ project(':core') { | |
| testImplementation libs.junitJupiter | ||
| testImplementation libs.slf4jlog4j | ||
| testImplementation libs.caffeine | ||
|
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. please revert this change |
||
|
|
||
| generator project(':generator') | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -361,4 +361,7 @@ | |
| <suppress checks="(ClassDataAbstractionCoupling|ClassFanOutComplexity)" | ||
| files="(ReplicaFetcherThreadBenchmark).java"/> | ||
|
|
||
| <!--import order --> | ||
| <suppress checks="ImportOrder" files="^*$"/> | ||
|
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. why we need this change?
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 think checkstyle should consistent with auto format . If you open the A module auto format, we should open the module check rule.
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. Making the consistency is extra effort. Also, those changes will complicate checkstyle files. Hence, I prefer to remove them if we do NOT use it actually. |
||
|
|
||
| </suppressions> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ scalaVersion=2.13.14 | |
| # Adding swaggerVersion in gradle.properties to have a single version in place for swagger | ||
| # New version of Swagger 2.2.14 requires minimum JDK 11. | ||
| swaggerVersion=2.2.8 | ||
| # 6.14.0 and newer are need for java 11 | ||
| spotlessVersion=6.13.0 | ||
|
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.
|
||
| task=build | ||
| org.gradle.jvmargs=-Xmx2g -Xss4m -XX:+UseParallelGC | ||
| org.gradle.parallel=true | ||
Uh oh!
There was an error while loading. Please reload this page.