Skip to content

Commit

Permalink
[JENKINS-18029] Selected line with static analysis violation is hidde…
Browse files Browse the repository at this point in the history
…n because breadcrumb covers it

- The page with source code now scrolls 10 lines above the highlighted one to be able to see the context.
- @SuppressWarnings("unused") removed to solve compiler warnings.
  • Loading branch information
mixalturek committed Mar 8, 2014
1 parent 229cd1b commit 70008f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Expand Up @@ -229,7 +229,6 @@ public final String highlightSource(final InputStream file) throws IOException {
*
* @return the source code content as a String object
*/
@SuppressWarnings("unused")
public String getSourceCode() {
return sourceCode;
}
Expand All @@ -239,7 +238,6 @@ public String getSourceCode() {
*
* @return the workspace file
*/
@SuppressWarnings("unused")
public CppcheckWorkspaceFile getCppcheckWorkspaceFile() {
return cppcheckWorkspaceFile;
}
Expand Down
Expand Up @@ -60,6 +60,15 @@ public int getLineNumber() {
return lineNumber;
}

/**
* Returns the line number that should be shown on top of the source code view.
*
* @return the line number
*/
public int getLinkLineNumber() {
return Math.max(1, lineNumber - 10);
}

public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
Expand Down Expand Up @@ -92,7 +101,6 @@ public void setSeverity(String severity) {
}

@Exported
@SuppressWarnings("unused")
public Integer getKey() {
return key;
}
Expand Down
Expand Up @@ -39,7 +39,7 @@
${cppcheckfile.lineNumber}
</j:if>
<j:if test="${not elt.isSourceIgnored()}">
<a href="source.${cppcheckfile.key}#${cppcheckfile.lineNumber}">${cppcheckfile.lineNumber}</a>
<a href="source.${cppcheckfile.key}#${cppcheckfile.linkLineNumber}">${cppcheckfile.lineNumber}</a>
</j:if>
</td>
<td class="pane">${cppcheckfile.severity}</td>
Expand Down

0 comments on commit 70008f0

Please sign in to comment.