A RetroSearch Logo

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

Search Query:

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

false positives with static imports · Issue #4602 · pmd/pmd · GitHub

Affects PMD Version:
7.0.0-rc3
Rule:
UnnecessaryImport
Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_codestyle.html#unnecessaryimport

Description:
I'm trying to analyze a project with UI tests and check the imports used. But the result of the check is incorrect.

Suppressing these exceptions is too time-consuming for me, because these imports are in the entire project. There was no such problem in PMD 6.37, but when upgrading to 7.0.0 it showed up.

In CM 7.0.0-rc2, you wrote that this problem was detected and fixed (if I'm not confusing anything), but it didn't give a result (
Code Sample demonstrating the issue:

import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class CallRateLayer extends ExtendsPage {
    @Override
    public void checkPage() {
        $(ROOT_ELEMENT).shouldBe(visible.because("msg")); // its import use
    }
}

Expected outcome:
Expected no violations

PMD reports a violation, but that's wrong. That's a false positive.
Example:
/myPath/test.java:8: UnnecessaryImport: Unused static import 'com.codeborne.selenide.Condition.visible'
/myPath/test.java:9: UnnecessaryImport: Unused static import 'com.codeborne.selenide.Selenide.$'

Running PMD through: Maven


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