A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5151 below:

Should not need to guard parameterized log messages where the replacement arg is a constant from another class · Issue #5151 · pmd/pmd · GitHub

Affects PMD Version:
7.0.0

Rule:
GuardLogStatement

Description:
I do not believe an argument, which is a constant from another class, should result in a violation of this rule.

Code Sample demonstrating the issue:

        // This IS flagged as a violation
        LOG.info(
                "Some message here : foo={}",
                SomeOtherClass.MY_CONSTANT
        );

        // This is not flagged as a violation
        LOG.info(
                "Some message here : foo={}",
                MY_CONSTANT
        );

Expected outcome:

PMD reports "... Rule:GuardLogStatement Priority:2 Logger calls should be surrounded by log level guards..".
I think that's a false positive.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Run via maven-pmd-plugin (3.24.0)


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