Skip to content

[java] Update rule JumbledIncrementer#3546

Merged
oowekyala merged 3 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-update-JumbledIncrementer
Oct 25, 2021
Merged

[java] Update rule JumbledIncrementer#3546
oowekyala merged 3 commits into
pmd:pmd/7.0.xfrom
adangel:pmd7-update-JumbledIncrementer

Conversation

@adangel

@adangel adangel commented Oct 8, 2021

Copy link
Copy Markdown
Member

Part of #2701

@adangel adangel added this to the 7.0.0 milestone Oct 8, 2021
@ghost

ghost commented Oct 8, 2021

Copy link
Copy Markdown
2 Messages
📖 Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 27 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
📖 Compared to master:
This changeset changes 31211 violations,
introduces 21309 new violations, 1 new errors and 0 new configuration errors,
removes 135799 violations, 8 errors and 3 configuration errors.
Full report
Compared to pmd/7.0.x:
This changeset changes 0 violations,
introduces 379 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
Compared to master:
This changeset changes 31211 violations,
introduces 21308 new violations, 1 new errors and 0 new configuration errors,
removes 136050 violations, 8 errors and 3 configuration errors.
Full report

Generated by 🚫 Danger

@adangel

adangel commented Oct 15, 2021

Copy link
Copy Markdown
Member Author

False negatives:


https://github.com/spring-projects/spring-framework/blob/v5.0.6.RELEASE/spring-core/src/main/java/org/springframework/util/AntPathMatcher.java#L482

		for (int segment = 0; segment < patternParts.length; segment++) {
			String patternPart = patternParts[segment];
			if (patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) {
				for (; segment < pathParts.length; segment++) {
					if (pathStarted || (segment == 0 && !pattern.startsWith(this.pathSeparator))) {
						builder.append(this.pathSeparator);
					}
					builder.append(pathParts[segment]);
					pathStarted = true;
				}
			}
		}

Message: "Avoid modifying an outer loop incrementer in an inner loop for update expression"

--> segment is indeed incremented in the inner loop and in the outer loop.


https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/text/SimpleDateFormat.java#L835

        for (int i = 0; i < length; i++) { // line 752for (; i < j; i++) {

Message: "Avoid modifying an outer loop incrementer in an inner loop for update expression"


@oowekyala oowekyala self-assigned this Oct 25, 2021
@oowekyala oowekyala merged commit a94616e into pmd:pmd/7.0.x Oct 25, 2021
@adangel adangel deleted the pmd7-update-JumbledIncrementer branch October 28, 2021 13:22
@adangel adangel mentioned this pull request Jan 23, 2023
55 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants