[core] Better error reporting for the ruleset parser#3922
Conversation
Generated by 🚫 Danger |
adangel
left a comment
There was a problem hiding this comment.
Many Thanks! 🎉 This will provide much more useful error messages than ever!
I'll update your library to 3.1 and merge this.
|
|
||
| <profiles> | ||
| <profile> | ||
| <!-- Adds an SLF4J implementation, useful when developing within an IDE --> |
There was a problem hiding this comment.
Maybe we can add this as test dependency in general?
Hm... for core, we have this already.
In java, it is missing.
Or do you need it, when you run CLI from within an IDE?
I'll keep it in, but would be interested in how you use it...
There was a problem hiding this comment.
I think it was to run tests like CliTest (in module pmd-java). Intellij would run them but print a warning that there is no logger implementation, and hid the messages. I'm not sure a profile is the best way, maybe just having the test dependency as you suggest would be better...
There was a problem hiding this comment.
@adangel I remember now where I needed this. I have a bunch of run configurations for Intellij which run the main class PMD with different arguments. Most of them use the classpath of pmd-java, so that you can launch them quicker (Intellij only needs to build pmd-java and its dependencies, not all modules). But Intellij doesn't use test dependencies when a run configuration depends on a module, so without the profile there would be no slf4j impl in this setup.
[core] Better error reporting for the ruleset parser #3922
|
Thanks for merging! |
They were merged on separate branches
Describe the PR
Use the library I wrote to display nice error messages when parsing the ruleset XML. This also uniformizes the error handling, which previously was a mix of IllegalArgumentExceptions and logger calls.
Sample output:
Note that as per #3816 we will stop using a
Loggerto report these errors, so that the[main] ERROR net.sourceforge.pmd.PMDheaders will disappearPreviously (notice the second error is not reported):
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)