Menu

Download Java Classes to local repository

sp56868
2018-07-12
2018-08-07
  • sp56868

    sp56868 - 2018-07-12

    Hi ,

    Good morning,

    We are working on the Apex PMD configuration to generate the PMD report for our Salesforce Apex code, Below is the information required, Request to kindly help on providing the same,

    1.) As per one of the performance ruleset, we observe the below snippet
    <rule name="AvoidDmlStatementsInLoops" since="5.5.0" message="Avoid DML statements inside loops" class="net.sourceforge.pmd.lang.apex.rule.performance.AvoidDmlStatementsInLoopsRule" externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_performance.html#avoidsoqlinloops">

    Can we download the Java Files (located at net.sourceforge.pmd.lang.apex.rule.performance.AvoidDmlStatementsInLoopsRule) to our local system and execute the PMD report.

    2.) If Yes. request to kindly help us the way forward.

    3.) Please let us where is this URL defined in PMD ( externalInfoUrl="${pmd.website.baseurl} )
    4.) How to create a new rule and configure.

    Thanks,

     
  • sp56868

    sp56868 - 2018-07-15

    Hi Andreas, Thank you very much for your response,

    As we are working on few custom rules for Salesforce Apex classes, Request to let us know if there is any existing Rule related to comments (report PMD violation if comments are not there in a Apex Class).
    If there is no such existing, Kindly help us on creating a custom java rule class for scanning the apex class and identify the presence of comments.( I am able to configure a new rule in the ruleset and able to generate the .csv report with my new custom rule.)

    Thanks in advance,

     
  • Andreas Dangel

    Andreas Dangel - 2018-07-15

    Hi,

    unfortunately analyzing the comments is not possible with apex: See https://github.com/pmd/pmd/issues/1136

    Regards,
    Andreas

     
  • sp56868

    sp56868 - 2018-08-06

    Hi Andreas, Thanks for your share on comments,

    Can you also please share some details/documentation on writing custom rules with respect to below usecases, which would be really helpful,

    1.) Classes that handle Trigger events should always have the suffix “TriggerHandler”.
    2.) The class name should be suffixed by Batch
    3.)CamelCase Convention
    4.)Single Letter Variable within Loops
    5.)Avoid @future inside Loops

    Thanks in advance,

     

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.