A RetroSearch Logo

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

Search Query:

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

[core] PMD Properties (dev-properties) breaks markup on CodeClimateRenderer · Issue #643 · pmd/pmd · GitHub

Rule Set: java-bsic

Description: Some rules generate an XPath snippet that looks weird in the bottom of the report

Code Sample demonstrating the issue:

public class Library {
	public void foo() {
		for (int i = 0; i < 10; i++) {
			for (int k = 0; k < 20; i++) {
				System.out.println("Hello");
			}
		}
	}
}

Running PMD through: ./run.sh pmd -d . -f codeclimate -R java-basic

{
  "type": "issue",
  "check_name": "JumbledIncrementer",
  "description": "Avoid modifying an outer loop incrementer in an inner loop for update expression",
  "content": {
    "body": "## JumbledIncrementer\n\nSince: PMD 1.0\n\nPriority: Medium\n\n[Categories](https://github.com/codeclimate/spec/blob/master/SPEC.md#categories): Style\n\n[Remediation Points](https://github.com/codeclimate/spec/blob/master/SPEC.md#remediation-points): 50000\n\nAvoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.\n\n### Example:\n\n```java\n\n \npublic class JumbledIncrementerRule1 {\n\tpublic void foo() {\n\t\tfor (int i = 0; i < 10; i++) {\t\t\t// only references 'i'\n\t\t\tfor (int k = 0; k < 20; i++) {\t\t// references both 'i' and 'k'\n\t\t\t\tSystem.out.println('Hello');\n\t\t\t}\n\t\t}\n\t}\n}\n \n \n``` \n\n### [PMD properties](http://pmd.github.io/pmd-5.8.1/customizing/pmd-developer.html)\n\nName | Value | Description\n--- | --- | ---\nviolationSuppressRegex | | Suppress violations with messages matching a regular expression\nviolationSuppressXPath | | Suppress violations on nodes which match a given relative XPath expression.\nversion | 1.0 | XPath specification version\nxpath | \n \n//ForStatement\n [\n ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image\n =\n ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image\n ]\n \n | XPath expression\n"
  },
  "categories": [
    "Style"
  ],
  "location": {
    "path": "/Users/filipe/codeclimate/tmp/java/simple_java/src/main/java/Library.java",
    "lines": {
      "begin": 4,
      "end": 6
    }
  },
  "severity": "normal",
  "remediation_points": 50000
}
Markup Generated from the report above JumbledIncrementer

Since: PMD 1.0

Priority: Medium

Categories: Style

Remediation Points: 50000

Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional.

Example:
 
public class JumbledIncrementerRule1 {
\tpublic void foo() {
\t\tfor (int i = 0; i < 10; i++) {\t\t\t// only references 'i'
\t\t\tfor (int k = 0; k < 20; i++) {\t\t// references both 'i' and 'k'
\t\t\t\tSystem.out.println('Hello');
\t\t\t}
\t\t}
\t}
}
 
 
PMD properties Name Value Description violationSuppressRegex Suppress violations with messages matching a regular expression violationSuppressXPath Suppress violations on nodes which match a given relative XPath expression. version 1.0 XPath specification version xpath //ForStatement
[
ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@image

ancestor::ForStatement/ForInit//VariableDeclaratorId/@image
]

| XPath expression


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