Set Apex PMD executable separate from Inspection Profile

Issue #2078 resolved
Matthias Blom created an issue

I work on many different projects and would like to use the same Apex PMD executable everywhere, without having to add it to each project. Currently, because the executable has to be set in the Inspection Profile, I would have to use an ‘IDE Default’ profile or the executable would have to be set in ‘Project Default’ and it would be included in git. The first option means we can’t share any Project Inspection Profile and the second option means that we would have to include the executable in the project directory.

Is there a way to add a global option in the Illuminated Cloud settings to set a single PMD executable and use that by default, similar to the SFDX executable? This is not as much of an issue as the ruleset, as that makes more sense to include in the project.

Comments (4)

  1. Scott Wells repo owner

    The issue right now is that the PMD Salesforce code inspection is constructed as effectively a standalone component (in the form of a code inspection). Nothing outside of that inspection really knows that there's an integration with PMD. In fact, with just a few tweaks, it could even be extracted into a distinct real-time PMD integration plugin independent of IC2. Having a global/application-level configuration for the PMD install directory would break that tight encapsulation pretty significantly.

    What I can investigate, though, is providing a read-through from a project-level inspection profile to the IDE-level inspection profile to determine the PMD install dir if not specified in the project-level config. So instead of configuring it in IC2 like you do the SFDX executable path, you'd configure it in the IDE-level inspection profile and the project-level inspection profile would use that. I'll see what that might look like...

  2. Scott Wells repo owner

    Okay, after playing with this a bit, I landed on allowing IC2's PMD inspection to use the execution path (i.e., PATH environment variable) to find the PMD installation if it's not explicitly-specified. That way the stored project-level inspection profile just includes a blank value, and you'll see the environment-derived PMD install path in a read-only manner. That allows me to maintain proper encapsulation while removing the need for non-portable project-level config. I'll include this in the next build, likely Thursday morning.

  3. Log in to comment