PMD Apex always returns no suspicious files

Issue #1139 resolved
Jeff May created an issue

Even though I have hundreds of PMD issues in my project.

Using IC2 in IDEA

Comments (13)

  1. Scott Wells repo owner

    It appears to be a bug/internal error in PMD Apex:

    java.lang.ClassCastException: net.sourceforge.pmd.lang.apex.ast.ASTFormalComment cannot be cast to net.sourceforge.pmd.lang.apex.ast.ApexNode   
        at net.sourceforge.pmd.lang.apex.rule.design.ExcessiveNodeCountRule.visit(ExcessiveNodeCountRule.java:42)
        ...
    

    What version of PMD Apex are you using, and where did you get your ruleset?

  2. Scott Wells repo owner

    Okay, and does the same error occur if you run PMD from the command-line? My guess is that it will. Here's how IC executes it:

    /home/jeff/Downloads/pmd-bin-6.8.0/bin/run.sh pmd -dir /home/jeff/AAIlluminate/btek-probo-devint914/src -language apex -R /home/jeff/AAIlluminate/StartingPMDRuleSet.xml -f xml -no-cache

    Assuming it does, you'll probably need to log a case against PMD Apex itself, but let's see what happens first.

  3. Scott Wells repo owner

    Okay, if that's the case then I would file an issue here:

    https://github.com/pmd/pmd/releases/tag/pmd_releases/6.8.0

    and since you can reproduce it via the CLI, you'll likely get the best/quickest response if you lead with that rather than via the IC integration. Otherwise that will be the first thing they ask you to do.

    I'll be curious to know what you find. Feel free to at-mention me there to pull me in if you'd like. I'm SCWells72 on GitHub and have worked with that team on issues like this in the past.

  4. Jeff May reporter

    Update -- using my old ruleset (instead of the 'starter' ruleset via the link in the IDEA Inspection Settings), and using PMD 6.4 (instead of 6.8) runs successfully. I will post more followup when I hear from the PMD team.

  5. Scott Wells repo owner

    Ah, okay. So perhaps something has changed with one of the rule implementations that's incompatible with a particular ruleset. Hopefully the PMD team will know what's going on. Certainly a ClassCastException seems like a bug to me, though.

  6. Scott Wells repo owner

    Okay, thanks for the update. I'm going to resolve this issue since it's a PMD problem and not an IC problem. I'll also subscribe to the PMD issue so I can keep tabs on it. Thanks again!

  7. Log in to comment