A RetroSearch Logo

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

Search Query:

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

[java] Inconsistent line range in RuleViolation for CognitiveComplexity rule between PMD 6.54.0 and 7.0.0-rc1 · Issue #4439 · pmd/pmd · GitHub

Affects PMD Version: 6.54.0 and 7.0.0-rc1

Description:

When using the CognitiveComplexity rule for Java in PMD 6.54.0, the RuleViolation returns the line range covering the entire method, from the start to the end (e.g., 3-7 in the provided example). However, when using PMD 7.0.0-rc1, it only returns the line number of the method signature (e.g., 3-3 in the provided example).

Code Sample demonstrating the issue:

public class Example {

    public void sampleMethod() { // Line 3
        if (true) {
            System.out.println("Hello, world!");
        }
    } // Line 7
}

Steps to reproduce:

Please provide detailed steps for how we can reproduce the bug.

  1. Run PMD 6.54.0 with the CognitiveComplexity rule on the provided code sample.
  2. Observe the RuleViolation line range covering the entire method (3-7).
  3. Run PMD 7.0.0-rc1 with the CognitiveComplexity rule on the same code sample.
  4. Observe the RuleViolation line range only covering the method signature (3-3).

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