A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pmd-code.org/latest/pmd_rules_ecmascript_performance.html below:

Performance | PMD Source Code Analyzer

Rules that flag suboptimal code.

Table of Contents AvoidConsoleStatements

Since: PMD 7.5.0

Priority: Medium (3)

Using the console for logging in production might negatively impact performance. In addition, logging could expose sensitive data.

This rule is defined by the following XPath expression:

//FunctionCall[PropertyGet
    [Name[1][@Identifier = 'console']]
    [Name[2][@Identifier]]
  ]
|
//FunctionCall[PropertyGet
    [PropertyGet[1]
        [Name[1][@Identifier = 'window']]
        [Name[2][@Identifier = 'console']]
    ]
    [Name[1][@Identifier]]
  ]

Example(s):

var myObj = getData();
console.log(myObj); // bad
console.debug("myObj:", myObj); // bad

Use this rule by referencing it:

<rule ref="category/ecmascript/performance.xml/AvoidConsoleStatements" />

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4