Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-14481] Quickly identify only the new errors
- A new column added to the report details table. It can contain "new", "solved" or "unchanged" flags to distinguish state of comparison with the previous report (if any). The column is mainly defined for an ability of sorting. - "New" issues are additionally highlighted with red background, "solved" issues are green and "unchanged" has white color as usual. - Solved issues also don't have the links to the source code, because it isn't available (issue was solved and the code is no longer present). - New CppcheckDiffState enum/flag added and stored as transient in CppcheckWorkspaceFile class. It is a dynamic parameter that should not be saved to any XML file. - The real comparison is done in CppcheckDiffState.diffCurrentAndPrevious(). - If source file is not available, no line will be displayed in the report (zero was present before).
- Loading branch information
1 parent
c7fbdb6
commit 0ee027c
Showing
7 changed files
with
221 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/org/jenkinsci/plugins/cppcheck/CppcheckDiffState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.jenkinsci.plugins.cppcheck; | ||
|
||
/** | ||
* Status of comparison of two reports. | ||
* | ||
* Implementation note: The declaration order of the constants is significant, | ||
* it's used in sorting. | ||
* | ||
* @see CppcheckResult#diffCurrentAndPrevious() | ||
* @author Michal Turek | ||
*/ | ||
public enum CppcheckDiffState { | ||
/** The issue is present only in the current report. */ | ||
NEW { | ||
@Override | ||
public String getCss() { | ||
return "new"; | ||
} | ||
|
||
@Override | ||
public String getText() { | ||
return Messages.cppcheck_DiffNew(); | ||
} | ||
}, | ||
|
||
/** The issue is present only in the previous report. */ | ||
SOLVED { | ||
@Override | ||
public String getCss() { | ||
return "solved"; | ||
} | ||
|
||
@Override | ||
public String getText() { | ||
return Messages.cppcheck_DiffSolved(); | ||
} | ||
}, | ||
|
||
/** The issue is present in both the current and the previous report. */ | ||
UNCHANGED { | ||
@Override | ||
public String getCss() { | ||
return "unchanged"; | ||
} | ||
|
||
@Override | ||
public String getText() { | ||
return Messages.cppcheck_DiffUnchanged(); | ||
} | ||
}; | ||
|
||
/** | ||
* Get CSS class. | ||
* | ||
* @return the class | ||
*/ | ||
public abstract String getCss(); | ||
|
||
/** | ||
* Get localized text. | ||
* | ||
* @return the localized text | ||
*/ | ||
public abstract String getText(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters