You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2026/01/12 15:44:59 UTC
(maven-pmd-plugin) branch master updated: Remove redundant local variables (#687)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new e5fe58e Remove redundant local variables (#687)
e5fe58e is described below
commit e5fe58ed11f91850e1d20b6643b6dbe99d5c08cd
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Mon Jan 12 10:44:55 2026 -0500
Remove redundant local variables (#687)
---
.../org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
index ceb8e98..c6aba5b 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
@@ -112,14 +112,12 @@ public class ExcludeViolationsFromFile implements ExcludeFromFile<Violation> {
if (packageName != null && !packageName.isEmpty() && className != null && !className.isEmpty()) {
return packageName + "." + className;
} else if (packageName != null && !packageName.isEmpty()) {
- String fileName = fullPath;
- fileName = fileName.substring(fileName.lastIndexOf(File.separatorChar) + 1);
+ String fileName = fullPath.substring(fullPath.lastIndexOf(File.separatorChar) + 1);
fileName = fileName.substring(0, fileName.length() - 5);
return packageName + "." + fileName;
} else {
- final String fileName = fullPath;
- final int javaIdx = fileName.indexOf(File.separator + "java" + File.separator);
- return fileName.substring(javaIdx >= 0 ? javaIdx + 6 : 0, fileName.length() - 5)
+ final int javaIdx = fullPath.indexOf(File.separator + "java" + File.separator);
+ return fullPath.substring(javaIdx >= 0 ? javaIdx + 6 : 0, fullPath.length() - 5)
.replace(File.separatorChar, '.');
}
}