diff --git a/feed.xml b/feed.xml index a81cdf0a96..1907cc9d92 100644 --- a/feed.xml +++ b/feed.xml @@ -5,8 +5,8 @@ Intended as a documentation theme based on Jekyll for technical writers documenting software and other technical products, this theme has all the elements you would need to handle multiple products with both multi-level sidebar navigation, tags, and other documentation features. https://pmd.github.io/pmd/ - Sat, 14 Sep 2019 00:11:39 +0000 - Sat, 14 Sep 2019 00:11:39 +0000 + Sat, 14 Sep 2019 15:27:19 +0000 + Sat, 14 Sep 2019 15:27:19 +0000 Jekyll v3.7.4 diff --git a/pmd_release_notes.html b/pmd_release_notes.html index 31addb5b8c..b8841fabaa 100644 --- a/pmd_release_notes.html +++ b/pmd_release_notes.html @@ -1328,11 +1328,18 @@ about the usage and features of the rule designer.

New rules

Modified Rules

@@ -1359,6 +1366,7 @@ won’t be found by default by the rule anymore.
  • apex
  • java @@ -1458,6 +1466,7 @@ subpackages, except External Contributions

    Code Style

    @@ -1461,7 +1462,7 @@ $('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3

    It contains the following rules:

    -

    ApexBadCrypto, ApexCRUDViolation, ApexCSRF, ApexDangerousMethods, ApexDoc, ApexInsecureEndpoint, ApexOpenRedirect, ApexSharingViolations, ApexSOQLInjection, ApexSuggestUsingNamedCred, ApexUnitTestClassShouldHaveAsserts, ApexUnitTestShouldNotUseSeeAllDataTrue, ApexXSSFromEscapeFalse, ApexXSSFromURLParam, AvoidDeeplyNestedIfStmts, AvoidDirectAccessTriggerMap, AvoidDmlStatementsInLoops, AvoidGlobalModifier, AvoidHardcodingId, AvoidLogicInTrigger, AvoidNonExistentAnnotations, AvoidSoqlInLoops, AvoidSoslInLoops, ClassNamingConventions, CyclomaticComplexity, EmptyCatchBlock, EmptyIfStmt, EmptyStatementBlock, EmptyTryOrFinallyBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveParameterList, ExcessivePublicCount, FieldNamingConventions, ForLoopsMustUseBraces, FormalParameterNamingConventions, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LocalVariableNamingConventions, MethodNamingConventions, MethodWithSameNameAsEnclosingClass, NcssConstructorCount, NcssMethodCount, NcssTypeCount, OneDeclarationPerLine, PropertyNamingConventions, StdCyclomaticComplexity, TooManyFields, WhileLoopsMustUseBraces

    +

    ApexBadCrypto, ApexCRUDViolation, ApexCSRF, ApexDangerousMethods, ApexDoc, ApexInsecureEndpoint, ApexOpenRedirect, ApexSharingViolations, ApexSOQLInjection, ApexSuggestUsingNamedCred, ApexUnitTestClassShouldHaveAsserts, ApexUnitTestShouldNotUseSeeAllDataTrue, ApexXSSFromEscapeFalse, ApexXSSFromURLParam, AvoidDeeplyNestedIfStmts, AvoidDirectAccessTriggerMap, AvoidDmlStatementsInLoops, AvoidGlobalModifier, AvoidHardcodingId, AvoidLogicInTrigger, AvoidNonExistentAnnotations, AvoidSoqlInLoops, AvoidSoslInLoops, ClassNamingConventions, CyclomaticComplexity, DebugsShouldUseLoggingLevel, EmptyCatchBlock, EmptyIfStmt, EmptyStatementBlock, EmptyTryOrFinallyBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveParameterList, ExcessivePublicCount, FieldNamingConventions, ForLoopsMustUseBraces, FormalParameterNamingConventions, IfElseStmtsMustUseBraces, IfStmtsMustUseBraces, LocalVariableNamingConventions, MethodNamingConventions, MethodWithSameNameAsEnclosingClass, NcssConstructorCount, NcssMethodCount, NcssTypeCount, OneDeclarationPerLine, PropertyNamingConventions, StdCyclomaticComplexity, TooManyFields, WhileLoopsMustUseBraces

  • Security (rulesets/apex/security.xml):

    diff --git a/pmd_rules_apex_bestpractices.html b/pmd_rules_apex_bestpractices.html index cd6965e5c4..86513b5624 100644 --- a/pmd_rules_apex_bestpractices.html +++ b/pmd_rules_apex_bestpractices.html @@ -5,7 +5,7 @@ - + Best Practices | PMD Source Code Analyzer @@ -1663,6 +1663,85 @@ Therefore delegate the triggers work to a regular class (often called Trigger ha
    <rule ref="category/apex/bestpractices.xml/AvoidLogicInTrigger" />
     
    +

    DebugsShouldUseLoggingLevel

    + +

    Since: PMD 6.18.0

    + +

    Priority: Medium (3)

    + +

    The first parameter of System.debug, when using the signature with two parameters, is a LoggingLevel enum.

    + +

    Having the Logging Level specified provides a cleaner log, and improves readability of it.

    + +

    This rule is defined by the following XPath expression:

    +
    //MethodCallExpression[lower-case(@FullMethodName)='system.debug'][count(*)=2
    +    or ($strictMode=true() and count(*)=3 and lower-case(VariableExpression/@Image)='debug')]
    +
    + +

    Example(s):

    + +
    @isTest
    +public class Foo {
    +    @isTest
    +    static void bar() {
    +        System.debug('Hey this code executed.'); // not good
    +        System.debug(LoggingLevel.WARN, 'Hey, something might be wrong.'); // good
    +        System.debug(LoggingLevel.DEBUG, 'Hey, something happened.'); // not good when on strict mode
    +    }
    +}
    +
    + +

    This rule has the following properties:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDefault ValueDescriptionMultivalued
    cc_categoriesStyleDeprecated Code Climate Categoriesyes. Delimiter is ‘|’.
    cc_remediation_points_multiplier1Deprecated Code Climate Remediation Points multiplierno
    cc_block_highlightingfalseDeprecated Code Climate Block Highlightingno
    strictModefalseIf true, mark statements that use the DEBUG enum of LoggingLevel.no
    + +

    Use this rule with the default properties by just referencing it:

    +
    <rule ref="category/apex/bestpractices.xml/DebugsShouldUseLoggingLevel" />
    +
    + +

    Use this rule and customize it:

    +
    <rule ref="category/apex/bestpractices.xml/DebugsShouldUseLoggingLevel">
    +    <properties>
    +        <property name="strictMode" value="false" />
    +    </properties>
    +</rule>
    +
    +
    diff --git a/search.json b/search.json index 682d575e4e..9f3e0f97c3 100644 --- a/search.json +++ b/search.json @@ -265,6 +265,15 @@ "url": "pmd_rules_apex_bestpractices.html#avoidlogicintrigger", "summary": "Rules which enforce generally accepted best practices." } +, + +{ +"title": "DebugsShouldUseLoggingLevel (Apex, Best Practices)", +"tags": "", +"keywords": "DebugsShouldUseLoggingLevel", +"url": "pmd_rules_apex_bestpractices.html#debugsshoulduselogginglevel", +"summary": "Rules which enforce generally accepted best practices." +}