-
-
Notifications
You must be signed in to change notification settings - Fork 413
PMD integration & test #5393
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
PMD integration & test #5393
Conversation
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.
Thank you for your first contribution!
Can you also add an example project which serves as documentation as well as an integration test? Something like the example test for the checkstyle module (example/javalib/linting/2-checkstyle
).
…into pmd-integration
…into pmd-integration
Updated. |
…d CLI args according to newer PMD versions
…into pmd-integration
…into pmd-integration
@@ -42,7 +42,7 @@ PMD found 1 violation(s) | |||
// Here's an example of producing HTML report: | |||
/** Usage | |||
> ./mill pmd -f "html" |
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.
What would be the command to write that to a file?
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 it's the more likely use-case, as it can then easily be opened with a browser.
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.
Currently, the logic is: if user hasn't specified 'stdout' -> report will be saved to a file (see PmdModule, line 37).
If the user specified 'stdout' -> report won't be saved to a file.
I agree that case with reporting to a file is more likely, so it's default.
What would be the command to write that to a file?
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.
Improved docs to make it more clear #7d89e00
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.
So, I don't get why we see the HTML output here, since we didn't specify -s
.
I also think it would be good to just print a line: "Writing output to path/to/file.html"
, so users do recognize and can click (most terminals support this, if it's an URL) on it.
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.
- Added log message for output file location.
- Changed options to make it more clear and in line with official PMD command-line options (now -s option is responsible only for enabling stdout, as it should be).
CI failing as I pulled from main and scalalib is no longer present there. Refactoring in progress. |
…from final report string
…into pmd-integration
* | ||
* @note [[sources]] are processed when no [[PmdArgs.sources]] are specified. | ||
*/ | ||
def pmd(@mainargs.arg pmdArgs: PmdArgs): Command[Int] = Task.Command { |
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 just returning a Int
isn't that useful. It's unclear, if these are warning or errors. If there are errors, I would fail the task anyways. Also, I'd like to return the actual report file as PathRef
.
Maybe, we should return a named tuple instead, so each value can have a proper name and we can extend it over time.
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.
- Added exit codes handling to
pmdHandleExitCode
, in line with PMD documentation. - Changed return type to tuple with exit code and PathRef.
- Cleaned up some code in PmdModule.
…into pmd-integration
This is ready for review/merge. |
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.
Thank you for this contribution!
Resolves #5379