Skip to content

TEZ-4642: Introduce spotless plugin and enforce basic import styles - #423

Merged
abstractdog merged 2 commits into
apache:masterfrom
abstractdog:TEZ-4642
Aug 18, 2025
Merged

TEZ-4642: Introduce spotless plugin and enforce basic import styles#423
abstractdog merged 2 commits into
apache:masterfrom
abstractdog:TEZ-4642

Conversation

@abstractdog

@abstractdogabstractdog commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

Huge patch that reorganize imports. Easy to implement and port:

  1. insert the spotless plugin to root pom.xml
  2. run "mvn spotless:apply"

Import Ordering Enforcement
Configured to match a reasonable standard: java,javax,org.apache,com,net,io
Automatically removes unused imports
Separates import groups with blank lines

Build Integration
Fails builds when import violations are found (during validate phase)
Works with all Maven goals: install, package, compile, etc.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@abstractdog

abstractdog commented Jul 30, 2025

Copy link
Copy Markdown
ContributorAuthor

LOL, yetus thinks that the patch is not applicable, I'm afraid we need to merge and test afterwards with a dummy precommit
no functional/behavioral change is expected

@maheshrajus

Copy link
Copy Markdown
Contributor

@abstractdog we can merge it and test after raising dummy PR to master branch. Samething we followed for spotbugs related PRs aswell :)

@ayushtknayushtkn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor suggestion.

This gonna make backports a big pain, if this iteself isn't backported

Comment threadpom.xml Outdated
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you define a variable for the version and use it here, like other dependencies. Moreover why not use the latest version:
https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin/2.46.1

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@tez-yetus

This comment was marked as outdated.

@tez-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 0sDocker mode activated.
-1 ❌patch0m 5s#423 does not apply to master. Rebase required? Wrong Branch? See https://yetus.apache.org/documentation/in-progress/precommit-patchnames for help.
SubsystemReport/Notes
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/4/console
versionsgit=2.34.1
Powered byApache Yetus 0.15.1 https://yetus.apache.org

This message was automatically generated.

@ayushtkn

Copy link
Copy Markdown
Member

Ohh, I remember this Yetus issue. The size of the PR is too big that is why it is failing to apply. If you do locally on your mac

curl --fail -H 'Accept: application/vnd.github.v3.patch' --output /private/tmp/yetus-10894.25287/input.patch --location https://api.github.com/repos/apache/tez/pulls/423

This will fail locally as well

ayushsaxena@ayushsaxena tez % curl --fail -H 'Accept: application/vnd.github.v3.patch' --output /private/tmp/yetus-10894.25287/input.patch --location https://api.github.com/repos/apache/tez/pulls/423 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 392 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (56) The requested URL returned error: 406

More details here:
https://issues.apache.org/jira/browse/YETUS-719?focusedCommentId=17874835&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17874835

Maybe we can hack it here as well, get the result and then revert that hacky commit then merge this PR

Can you apply this diff and trigger the build please

diff --git a/Jenkinsfile b/Jenkinsfile
index 79c2a3e3c..e9d6c4368 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,7 @@ pipeline {
DOCKERFILE = "${SOURCEDIR}/build-tools/docker/Dockerfile"
YETUS='yetus'
// Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
- YETUS_VERSION='rel/0.15.1'
+ YETUS_VERSION='a7d29a6a72750a0c5c39512f33945e773e69303e'
}
@@ -52,7 +52,7 @@ pipeline {
checkout([
$class: 'GitSCM',
branches: [[name: "${env.YETUS_VERSION}"]],
- userRemoteConfigs: [[ url: 'https://github.com/apache/yetus']]]
+ userRemoteConfigs: [[ url: 'https://github.com/ayushtkn/yetus']]]
)
}
}

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

Ohh, I remember this Yetus issue. The size of the PR is too big that is why it is failing to apply. If you do locally on your mac

curl --fail -H 'Accept: application/vnd.github.v3.patch' --output /private/tmp/yetus-10894.25287/input.patch --location https://api.github.com/repos/apache/tez/pulls/423

This will fail locally as well

ayushsaxena@ayushsaxena tez % curl --fail -H 'Accept: application/vnd.github.v3.patch' --output /private/tmp/yetus-10894.25287/input.patch --location https://api.github.com/repos/apache/tez/pulls/423 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 392 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (56) The requested URL returned error: 406

More details here: https://issues.apache.org/jira/browse/YETUS-719?focusedCommentId=17874835&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17874835

Maybe we can hack it here as well, get the result and then revert that hacky commit then merge this PR

Can you apply this diff and trigger the build please

diff --git a/Jenkinsfile b/Jenkinsfile
index 79c2a3e3c..e9d6c4368 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,7 @@ pipeline {
DOCKERFILE = "${SOURCEDIR}/build-tools/docker/Dockerfile"
YETUS='yetus'
// Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
- YETUS_VERSION='rel/0.15.1'
+ YETUS_VERSION='a7d29a6a72750a0c5c39512f33945e773e69303e'
}
@@ -52,7 +52,7 @@ pipeline {
checkout([
$class: 'GitSCM',
branches: [[name: "${env.YETUS_VERSION}"]],
- userRemoteConfigs: [[ url: 'https://github.com/apache/yetus']]]
+ userRemoteConfigs: [[ url: 'https://github.com/ayushtkn/yetus']]]
)
}
}

nice! let me try

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

seems to be working, in progress:
https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/5/console

@tez-yetus

This comment was marked as outdated.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec12m 36sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 5sNo case conflicting files found.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+0 🆗shelldocs0m 0sShelldocs was not available.
+0 🆗xmllint0m 0sxmllint was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 248 new or modified test files.
_ master Compile Tests _
+0 🆗mvndep2m 28sMaven dependency ordering for branch
+1 💚mvninstall7m 34smaster passed
+1 💚compile8m 0smaster passed
+1 💚checkstyle7m 3smaster passed
+1 💚javadoc6m 12smaster passed
+0 🆗spotbugs1m 11shadoop-shim in master has 3 extant spotbugs warnings.
+0 🆗spotbugs0m 47stez-api in master has 610 extant spotbugs warnings.
+0 🆗spotbugs0m 25stez-common in master has 13 extant spotbugs warnings.
+0 🆗spotbugs0m 32stez-runtime-internals in master has 114 extant spotbugs warnings.
+0 🆗spotbugs0m 44stez-runtime-library in master has 241 extant spotbugs warnings.
+0 🆗spotbugs0m 32stez-mapreduce in master has 129 extant spotbugs warnings.
+0 🆗spotbugs0m 29stez-examples in master has 2 extant spotbugs warnings.
+0 🆗spotbugs0m 56stez-dag in master has 785 extant spotbugs warnings.
+0 🆗spotbugs0m 34stez-tests in master has 6 extant spotbugs warnings.
+0 🆗spotbugs0m 32stez-ext-service-tests in master has 73 extant spotbugs warnings.
+0 🆗spotbugs0m 30stez-plugins/tez-protobuf-history-plugin in master has 31 extant spotbugs warnings.
+0 🆗spotbugs0m 28stez-plugins/tez-yarn-timeline-history in master has 2 extant spotbugs warnings.
+0 🆗spotbugs0m 26stez-plugins/tez-yarn-timeline-history-with-acls in master has 2 extant spotbugs warnings.
+0 🆗spotbugs0m 27stez-plugins/tez-yarn-timeline-cache-plugin in master has 1 extant spotbugs warnings.
+0 🆗spotbugs0m 29stez-plugins/tez-yarn-timeline-history-with-fs in master has 5 extant spotbugs warnings.
+0 🆗spotbugs0m 33stez-plugins/tez-history-parser in master has 21 extant spotbugs warnings.
+0 🆗spotbugs0m 32stez-plugins/tez-aux-services in master has 5 extant spotbugs warnings.
+0 🆗spotbugs4m 0sroot in master has 2066 extant spotbugs warnings.
+0 🆗spotbugs0m 31stez-tools/analyzers/job-analyzer in master has 20 extant spotbugs warnings.
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall7m 49sthe patch passed
+1 💚codespell0m 27sNo new issues.
+1 💚compile8m 12sthe patch passed
+1 💚javac8m 12sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 15sThe patch passed checkstyle in hadoop-shim
+1 💚checkstyle0m 19stez-api: The patch generated 0 new + 708 unchanged - 15 fixed = 708 total (was 723)
+1 💚checkstyle0m 17stez-common: The patch generated 0 new + 112 unchanged - 4 fixed = 112 total (was 116)
+1 💚checkstyle0m 18stez-runtime-internals: The patch generated 0 new + 237 unchanged - 1 fixed = 237 total (was 238)
+1 💚checkstyle0m 26stez-runtime-library: The patch generated 0 new + 1717 unchanged - 9 fixed = 1717 total (was 1726)
+1 💚checkstyle0m 20stez-mapreduce: The patch generated 0 new + 768 unchanged - 2 fixed = 768 total (was 770)
+1 💚checkstyle0m 17stez-examples: The patch generated 0 new + 60 unchanged - 3 fixed = 60 total (was 63)
+1 💚checkstyle0m 32stez-dag: The patch generated 0 new + 2974 unchanged - 37 fixed = 2974 total (was 3011)
+1 💚checkstyle0m 19stez-tests: The patch generated 0 new + 481 unchanged - 9 fixed = 481 total (was 490)
+1 💚checkstyle0m 17stez-ext-service-tests: The patch generated 0 new + 111 unchanged - 6 fixed = 111 total (was 117)
+1 💚checkstyle0m 17sThe patch passed checkstyle in tez-protobuf-history-plugin
+1 💚checkstyle0m 17stez-plugins/tez-yarn-timeline-history: The patch generated 0 new + 175 unchanged - 3 fixed = 175 total (was 178)
+1 💚checkstyle0m 15sThe patch passed checkstyle in tez-yarn-timeline-history-with-acls
+1 💚checkstyle0m 15sThe patch passed checkstyle in tez-yarn-timeline-cache-plugin
+1 💚checkstyle0m 17stez-plugins/tez-yarn-timeline-history-with-fs: The patch generated 0 new + 83 unchanged - 1 fixed = 83 total (was 84)
+1 💚checkstyle0m 18sThe patch passed checkstyle in tez-history-parser
+1 💚checkstyle0m 17sThe patch passed checkstyle in tez-aux-services
+1 💚checkstyle0m 16sThe patch passed checkstyle in job-analyzer
+1 💚checkstyle0m 15sThe patch passed checkstyle in hadoop-shim-2.8
+1 💚checkstyle0m 59sroot: The patch generated 0 new + 7877 unchanged - 90 fixed = 7877 total (was 7967)
+1 💚shellcheck0m 0sNo new issues.
+1 💚javadoc6m 27sthe patch passed
+1 💚spotbugs17m 45sthe patch passed
_ Other Tests _
+1 💚unit0m 26shadoop-shim in the patch passed.
+1 💚unit1m 56stez-api in the patch passed.
+1 💚unit0m 30stez-common in the patch passed.
+1 💚unit0m 46stez-runtime-internals in the patch passed.
+1 💚unit4m 41stez-runtime-library in the patch passed.
+1 💚unit1m 6stez-mapreduce in the patch passed.
+1 💚unit0m 22stez-examples in the patch passed.
+1 💚unit4m 11stez-dag in the patch passed.
+1 💚unit33m 51stez-tests in the patch passed.
+1 💚unit3m 46stez-ext-service-tests in the patch passed.
+1 💚unit0m 27stez-protobuf-history-plugin in the patch passed.
+1 💚unit1m 26stez-yarn-timeline-history in the patch passed.
+1 💚unit1m 34stez-yarn-timeline-history-with-acls in the patch passed.
+1 💚unit0m 18stez-yarn-timeline-cache-plugin in the patch passed.
+1 💚unit1m 23stez-yarn-timeline-history-with-fs in the patch passed.
+1 💚unit2m 3stez-history-parser in the patch passed.
+1 💚unit2m 31stez-aux-services in the patch passed.
+1 💚unit2m 14sjob-analyzer in the patch passed.
+1 💚unit0m 21shadoop-shim-2.8 in the patch passed.
+1 💚unit59m 27sroot in the patch passed.
+1 💚asflicense5m 50sThe patch does not generate ASF License warnings.
245m 29s
SubsystemReport/Notes
DockerClientAPI=1.51 ServerAPI=1.51 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/6/artifact/out/Dockerfile
GITHUB PR#423
Optional Testsdupname asflicense javac javadoc unit spotbugs checkstyle codespell detsecrets compile shellcheck shelldocs xmllint
unameLinux 3bbec5c12f12 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personality/home/jenkins/jenkins-home/workspace/tez-multibranch_PR-423/src/.yetus/personality.sh
git revisionmaster / 3a7c01d
Default JavaUbuntu-21.0.8+9-Ubuntu-0ubuntu124.04.1
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/6/testReport/
Max. process+thread count1540 (vs. ulimit of 5500)
modulesC: hadoop-shim tez-api tez-common tez-runtime-internals tez-runtime-library tez-mapreduce tez-examples tez-dag tez-tests tez-ext-service-tests tez-plugins/tez-protobuf-history-plugin tez-plugins/tez-yarn-timeline-history tez-plugins/tez-yarn-timeline-history-with-acls tez-plugins/tez-yarn-timeline-cache-plugin tez-plugins/tez-yarn-timeline-history-with-fs tez-plugins/tez-history-parser tez-plugins/tez-aux-services tez-tools/analyzers/job-analyzer hadoop-shim-impls/hadoop-shim-2.8 . U: .
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/6/console
versionsgit=2.43.0 maven=3.8.7 spotbugs=4.9.3 codespell=2.0.0 shellcheck=0.7.1
Powered byApache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@abstractdog

Copy link
Copy Markdown
ContributorAuthor

looks clear, thanks @ayushtkn! reverted the workaround commit

@tez-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 0sDocker mode activated.
-1 ❌patch0m 6s#423 does not apply to master. Rebase required? Wrong Branch? See https://yetus.apache.org/documentation/in-progress/precommit-patchnames for help.
SubsystemReport/Notes
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-423/7/console
versionsgit=2.34.1
Powered byApache Yetus 0.15.1 https://yetus.apache.org

This message was automatically generated.

@abstractdog

abstractdog commented Aug 18, 2025

Copy link
Copy Markdown
ContributorAuthor

@ayushtkn: let me know if we can merge this

@ayushtknayushtkn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abstractdog
abstractdog merged commit c981a94 into apache:masterAug 18, 2025
8 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@abstractdog@tez-yetus@maheshrajus@ayushtkn