You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/02/27 09:06:34 UTC
[maven-checkstyle-plugin] branch MCHECKSTYLE-385 updated (6270af5
-> 7360fbc)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch MCHECKSTYLE-385
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git.
from 6270af5 [MCHECKSTYLE-385] rework code to use a Violation.java class. This enables further optimizations.
new 1762639 make violation immuatble and non-public
new 7360fbc make column final
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../checkstyle/CheckstyleViolationCheckMojo.java | 9 +++---
.../apache/maven/plugins/checkstyle/Violation.java | 32 ++++++----------------
2 files changed, 14 insertions(+), 27 deletions(-)
[maven-checkstyle-plugin] 02/02: make column final
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MCHECKSTYLE-385
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git
commit 7360fbc25f6a14e766a9d0c19f3fe7661b8ae4bc
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Sat Jan 4 10:20:12 2020 -0500
make column final
---
src/main/java/org/apache/maven/plugins/checkstyle/Violation.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
index bfcd220..e426839 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
@@ -41,7 +41,7 @@ class Violation
private final String line;
- private String column = NO_COLUMN;
+ private final String column;
private final String severity;
[maven-checkstyle-plugin] 01/02: make violation immuatble and
non-public
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MCHECKSTYLE-385
in repository https://gitbox.apache.org/repos/asf/maven-checkstyle-plugin.git
commit 1762639678601b0898a5869ba8ac27a3b77dd780
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Feb 27 10:05:13 2020 +0100
make violation immuatble and non-public
---
.../checkstyle/CheckstyleViolationCheckMojo.java | 9 ++++---
.../apache/maven/plugins/checkstyle/Violation.java | 30 ++++++----------------
2 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
index 9bbd30b..4b0ea1d 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/CheckstyleViolationCheckMojo.java
@@ -653,6 +653,10 @@ public class CheckstyleViolationCheckMojo
String line = xpp.getAttributeValue( "", "line" );
/* Nullable */
String column = xpp.getAttributeValue( "", "column" );
+ if ( column == null )
+ {
+ column = Violation.NO_COLUMN;
+ }
String message = xpp.getAttributeValue( "", "message" );
String rule = RuleUtil.getName( source );
String category = RuleUtil.getCategory( source );
@@ -661,15 +665,12 @@ public class CheckstyleViolationCheckMojo
source,
file,
line,
+ column,
severity,
message,
rule,
category
);
- if ( column != null )
- {
- violation.setColumn( column );
- }
violations.add( violation );
}
diff --git a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
index 803e948..bfcd220 100644
--- a/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
+++ b/src/main/java/org/apache/maven/plugins/checkstyle/Violation.java
@@ -72,16 +72,18 @@ class Violation
* the category of the checkstyle violation
*/
Violation( String source,
- String file,
- String line,
- String severity,
- String message,
- String ruleName,
- String category )
+ String file,
+ String line,
+ String column,
+ String severity,
+ String message,
+ String ruleName,
+ String category )
{
this.source = Objects.requireNonNull( source );
this.file = file;
this.line = line;
+ this.column = column;
this.severity = Objects.requireNonNull( severity );
this.message = Objects.requireNonNull( message );
this.ruleName = Objects.requireNonNull( ruleName );
@@ -129,22 +131,6 @@ class Violation
}
/**
- * Sets the column value for this violation to the given string value.
- * @param column the column value to set. May be {@code null}, which will set it to the {@link #NO_COLUMN} value.
- */
- protected void setColumn( /* Nullable */ String column )
- {
- if ( column == null || column.length() < 1 )
- {
- this.column = NO_COLUMN;
- }
- else
- {
- this.column = column;
- }
- }
-
- /**
* Returns the severity of the current violation.
*
* @return the severity of the current violation