Skip to content

Commit

Permalink
Fix cnescatlab#63 Violation for the same line can be shown if message…
Browse files Browse the repository at this point in the history
… differ.

View displays informations of violations of the same file, rules, and
same line only in the case the message differs, this happens frequently
when message contains variables names. 
However, violations raised by the analysis on the same file on the same
line with the same message willn't be displayed.
  • Loading branch information
Omar Waldmann committed Sep 6, 2017
1 parent f35211a commit c587b58
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ViolationsView extends ViewPart {
/** Logger. **/
public final static Logger LOGGER = Logger.getLogger(ViolationsView.class.getName());

/** View identifier */
public static final String VIEW_ID = ViolationsView.class.getName();

public static final String RULE_TREE_VIEWER_TYPE = "RuleTreeViewer";
Expand Down Expand Up @@ -344,24 +345,18 @@ public void display(final List<CheckResult> violations) {
@Override
public int compare(final CheckResult check1,
final CheckResult check2) {
int res = check1.getName().split("\\.")[0]
.compareTo(check2.getName().split("\\.")[0]);
int res = check1.getName().compareTo(check2.getName());
if (res == 0) {
res = check1.getName().split("\\.")[1].compareTo(
check2.getName().split("\\.")[1]);
res = check1.getFile().getAbsolutePath().compareTo(
check2.getFile().getAbsolutePath());
if (res == 0) {
res = check1.getName().split("\\.")[2].compareTo(
check2.getName().split("\\.")[2]);
res = check1.getLine().compareTo(check2.getLine());
if (res == 0) {
res = check1.getFile().getAbsolutePath().compareTo(
check2.getFile().getAbsolutePath());
res = check1.getLocation()
.compareTo(check2.getLocation());
if (res == 0) {
res = check1.getLine()
.compareTo(check2.getLine());
if (res == 0) {
res = check1.getLocation().compareTo(
check2.getLocation());
}
res = check1.getMessage()
.compareTo(check2.getMessage());
}
}
}
Expand Down

0 comments on commit c587b58

Please sign in to comment.