-
Notifications
You must be signed in to change notification settings - Fork 7.6k
1.x: Add PMD code checking tool to the build process #4068
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
Conversation
Current coverage is 80.62%@@ 1.x #4068 diff @@
==========================================
Files 254 254
Lines 16538 16538
Methods 0 0
Messages 0 0
Branches 2510 2510
==========================================
+ Hits 13322 13334 +12
+ Misses 2332 2323 -9
+ Partials 884 881 -3
|
@artem-zinnatullin @zsxwing your thoughts on this? |
} | ||
} | ||
|
||
build.dependsOn 'pmd' |
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 don't think you need this since in the bottom you have build.dependsOn 'pmdPrint'
which includes pmd
as far as I understand
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'd leave it this way in case the pmdPrint gets replaced with a better feedback mechanisms and the dependency chain won't get broken easily.
👍 |
ruleSetFiles = files('pmd.xml') | ||
} | ||
|
||
task('pmd', type: Pmd, dependsOn: 'assemble') { |
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.
This task is not necessary. Do you want a task to run manually? If so, just run ./gradlew pmdMain
.
Just some minor issues. Otherwise, 👍 |
Updated. |
} | ||
} | ||
|
||
build.dependsOn pmdMain |
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.
minor: this line is not necessary because of the task dependency chain: build -> check -> pmdMain
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.
Okay, would you like to post a PR?
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.
Sure. See #4086
<description>RxJava PMD ruleset</description> | ||
<rule ref="rulesets/java/design.xml/AbstractClassWithoutAbstractMethod"/> | ||
<rule ref="rulesets/java/design.xml/AbstractClassWithoutAnyMethod"/> | ||
<rule ref="rulesets/java/design.xml/AccessorClassGeneration"/> |
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.
👍 👍 👍
Now why don't they have an AccessorMethodGeneration
check 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.
No idea, it's not in their design.xml
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.
Should PMD also be added to the 2.x branch? The earlier it's added the earlier warnings could be fixed. |
Sure. |
This PR adds a PMD plugin to the build process to check a set of coding rules.
At this point, I don't think rule violations should fail the build.
Unfortunately, I don't know about a service, like codecov-io, that could post the check results as comments under a PR, therefore, the current build just prints the first ~100 violations into the build log:
https://travis-ci.org/ReactiveX/RxJava/builds/139539158#L240
https://travis-ci.org/ReactiveX/RxJava/builds/139539158#L5508