Menu

Issue with standard apex ruleset

suresh
2017-08-15
2017-08-15
  • suresh

    suresh - 2017-08-15

    I am trying to use PMD command line to analyze apex code. After installing PMD 5.8.1, when i run the pmd command using one of the canned apex rulesets, the output just says problem found but does not list any issues.

    If I run the command for basic-java let us say, on a java file I can see the exceptions.

    Has anyone used the apex rulesets, can you help me figure if I'm doing something wrong?

    Here are the command I am using:

    pmd -d c:\pmd\pmd-bin-5.8.1\apextest*.zip -f html -R rulesets/apex/security.xml -r c:\pmd\output.html

    pmd -d c:\pmd\pmd-bin-5.8.1\apextest*.zip -f html -R rulesets/apex/performance.xml -r c:\pmd\output1.html

    Thanks

     
  • suresh

    suresh - 2017-08-22

    Any help?

    I tried creating a class file with sample exceptions as below...

    public class fooBar{
    public fooBar() {
    for(Integer i = 0; i < 5; i++){
    insert new Account();
    }
    }
    }

    public class foo1 {
    public void bar(Integer x, Integer y, Integer z) {
    if (x>y) {
    if (y>z) {
    if (z==x) {
    if (z<x) { }
    // !! too deep
    }
    }
    }
    }
    }

    When i run the PMD command as below, I get a message below, but the oputput file doesnt show me any exception..

    c:\pmd\pmd-bin-5.8.1\bin>pmd -d c:\pmd\foo.cls -f html -R
    rulesets/apex/complexity.xml -r c:\pmd\op1.html
    Aug 22, 2017 4:20:21 PM apex.jorje.parser.impl.BaseApexLexer dedupe
    INFO: Deduped array ApexLexer.DFA23_transition. Found 7927114 shorts which is 15
    MB not including array overhead. Removed 7204963 shorts which is 13MB not counti
    ng array overhead. Took 10ms.

    o/p file .. (blank with just the text below).

    PMD report

    Problems found

    File Line Problem

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.