PMD Code Inspection Trouble with Homebrew
I’m not sure if this counts as a bug, so feel free to close if you think that the homebrew maintainers ought to fix it instead.
The issue is that if you install pmd on mac via Homebrew, the command to run it is “pmd” not “run.sh”. If I set the PMD Executable parameter in IC to use this, it executes:
/usr/local/Cellar/pmd/6.25.0/bin/pmd -dir /my/code/ -language apex -R /my/rules.xml -f xml -no-cache
However, this is missing the extra “pmd” command that you would send to run.sh. It needs to execute /usr/local/Cellar/pmd/6.25.0/bin/pmd pmd -dir /my/code/...
I’m not sure if there’s a heuristic in IC that adds the extra “pmd” command when it’s running run.sh?
I’ve worked around it by creating a shell script called pmdpmd:
#!/bin/zsh
/usr/local/bin/pmd pmd "$@"
Then, I point IC to that. But, it’s not ideal.
Comments (7)
-
repo owner -
repo owner You know what...instead of what is a potentially risky change here, I'm going to hold off on this. You have a reasonable workaround in your
pmdpmd
script, and I've actually been investigating running PMD Apex in-process to make it more efficient--and potentially even allow it to be run as a real-time inspection. That would solve this problem in a better way. I'll see what traction I get on that front before doing anything here. -
reporter Oooh, I like the idea of an in-process pmd. I’d much rather have that than a bodge for this.
At the very least, if someone asks you for support with pmd and they’ve installed it via homebrew, you’ll know where to look.
-
repo owner I actually made really solid progress on a real-time/in-process PMD Apex integration today:
There are still quite a few things to work out before it'll be ready for prime-time, but hopefully I can get it into good shape for either this week's build or, if not that, next week's.
-
repo owner Real-time PMD Apex integration will be included in the next official build.
-
repo owner - changed status to resolved
Real-time PMD Apex integration has been released as of 2.1.9.3. More details are available in the release notes.
-
repo owner - removed version
Removing version: Unassigned (automated comment)
- Log in to comment
Hmmmmm...so I can certainly see what's happening. Basically right now when IC2 runs PMD, if it executes via
run.sh
it adds a firstpmd
argument; otherwise it omits that argument. Perhaps it should only omit that argument if executed viapmd.bat
, i.e., under Windows? Or perhaps I could/should be more explicit and only include that argument if run viarun.sh
orpmd
(no extension)? Or the most foolproof way to do it would be to allow the user to specify any additional args and default thepmd
arg when the selected script is eitherrun.sh
orpmd
. I'd prefer to avoid that if possible, though, as it just adds complexity. If one of the two rules listed above would take care of it, that would certainly be better.Anyway, I'm thinking aloud here. Let me investigate a bit and see what I can figure out.