Skip to content

Commit

Permalink
Add Violation.endColumn property
Browse files Browse the repository at this point in the history
Signed-off-by: Semyon Levin <levin.semen@gmail.com>
  • Loading branch information
remal committed Jun 10, 2020
1 parent 27f3841 commit e513933
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/se/bjurr/violations/lib/model/Violation.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class ViolationBuilder {

private Integer column;
private Integer endLine;
private Integer endColumn;
private String file;
private String message;
private Parser parser;
Expand Down Expand Up @@ -44,6 +45,11 @@ public ViolationBuilder setEndLine(final Integer endLine) {
return this;
}

public ViolationBuilder setEndColumn(final Integer endColumn) {
this.endColumn = endColumn;
return this;
}

public ViolationBuilder setFile(final String file) {
this.file = file;
return this;
Expand Down Expand Up @@ -118,6 +124,7 @@ public static ViolationBuilder violationBuilder() {

private Integer column;
private final Integer endLine;
private final Integer endColumn;
private final String file;
private final String message;
/** The algorithm, the format, used. */
Expand All @@ -144,6 +151,7 @@ public static ViolationBuilder violationBuilder() {
public Violation() {
startLine = null;
endLine = null;
endColumn = null;
severity = null;
message = null;
file = null;
Expand All @@ -166,6 +174,7 @@ public Violation(final ViolationBuilder vb) {
startLine = checkNotNull(vb.startLine, "startline");
endLine = firstNonNull(vb.endLine, vb.startLine);
column = vb.column;
endColumn = vb.endColumn;
severity = checkNotNull(vb.severity, "severity");
message = checkNotNull(emptyToNull(vb.message), "message");
file = checkNotNull(emptyToNull(vb.file), "file").replaceAll("\\\\", "/");
Expand All @@ -181,6 +190,7 @@ public Violation(final Violation v) {
reporter = v.reporter;
startLine = v.startLine;
endLine = v.endLine;
endColumn = v.endColumn;
column = v.column;
severity = v.severity;
message = v.message;
Expand Down Expand Up @@ -225,6 +235,13 @@ public boolean equals(final Object obj) {
} else if (!endLine.equals(other.endLine)) {
return false;
}
if (endColumn == null) {
if (other.endColumn != null) {
return false;
}
} else if (!endColumn.equals(other.endColumn)) {
return false;
}
if (file == null) {
if (other.file != null) {
return false;
Expand Down Expand Up @@ -298,6 +315,10 @@ public Integer getEndLine() {
return endLine;
}

public Integer getEndColumn() {
return endColumn;
}

public String getFile() {
return file;
}
Expand Down Expand Up @@ -358,6 +379,7 @@ public int hashCode() {
result = prime * result + (category == null ? 0 : category.hashCode());
result = prime * result + (column == null ? 0 : column.hashCode());
result = prime * result + (endLine == null ? 0 : endLine.hashCode());
result = prime * result + (endColumn == null ? 0 : endColumn.hashCode());
result = prime * result + (file == null ? 0 : file.hashCode());
result = prime * result + (group == null ? 0 : group.hashCode());
result = prime * result + (message == null ? 0 : message.hashCode());
Expand All @@ -377,6 +399,8 @@ public String toString() {
+ column
+ ", endLine="
+ endLine
+ ", endColumn="
+ endColumn
+ ", file="
+ file
+ ", message="
Expand Down

0 comments on commit e513933

Please sign in to comment.