-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for annotations in publish checks step. (#87)
* Support for annotations in publish checks step. * Test for annotations dropdown list view * Fix checkstyle warning
- Loading branch information
1 parent
6fda320
commit 1e1ac7e
Showing
16 changed files
with
358 additions
and
15 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
31 changes: 31 additions & 0 deletions
31
src/main/java/io/jenkins/plugins/checks/steps/StepUtils.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,31 @@ | ||
package io.jenkins.plugins.checks.steps; | ||
|
||
import hudson.util.ListBoxModel; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.Locale; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Utilities for pipeline steps. | ||
*/ | ||
public class StepUtils { | ||
/** | ||
* Converts an {@link Enum} into a {@link ListBoxModel} with all values of it. | ||
* | ||
* @param enums | ||
* all candidate values of the enum | ||
* @return the list box model with all enum values. | ||
*/ | ||
public ListBoxModel asListBoxModel(final Enum<?>... enums) { | ||
return Arrays.stream(enums) | ||
.map(Enum::name) | ||
.map(name -> new ListBoxModel.Option(asDisplayName(name), name)) | ||
.collect(Collectors.toCollection(ListBoxModel::new)); | ||
} | ||
|
||
private String asDisplayName(final String name) { | ||
return StringUtils.capitalize(name.toLowerCase(Locale.ENGLISH).replace("_", " ")); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...urces/io/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/config.jelly
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,40 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | ||
|
||
<f:entry title="Path" field="path"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Start Line" field="startLine"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="End Line" field="endLine"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Message" field="message"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Start Column" field="startColumn"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="End Column" field="endColumn"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Title" field="title"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Raw Details" field="rawDetails"> | ||
<f:textbox /> | ||
</f:entry> | ||
|
||
<f:entry title="Annotation Level" field="annotationLevel"> | ||
<f:select default="WARNING"/> | ||
</f:entry> | ||
|
||
</j:jelly> |
4 changes: 4 additions & 0 deletions
4
...ins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-annotationLevel.html
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,4 @@ | ||
<div> | ||
Severity level of the annotation, can be one of can be "NOTICE", "WARNING", or "FAILURE"; by default, "WARNING" will | ||
be used. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...o/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-endColumn.html
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,3 @@ | ||
<div> | ||
End column of code to be annotated. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
.../io/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-endLine.html
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,3 @@ | ||
<div> | ||
End line of code to be annotated. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
.../io/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-message.html
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,3 @@ | ||
<div> | ||
A digest message of the annotation. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...ces/io/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-path.html
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,3 @@ | ||
<div> | ||
Path to the file to be annotated, started from the project root directory. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
.../jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-rawDetails.html
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,3 @@ | ||
<div> | ||
Raw details of the annotation. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-startColumn.html
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,3 @@ | ||
<div> | ||
Start column of code to be annotated. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...o/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-startLine.html
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,3 @@ | ||
<div> | ||
Start line of code to be annotated. | ||
</div> |
3 changes: 3 additions & 0 deletions
3
...es/io/jenkins/plugins/checks/steps/PublishChecksStep/StepChecksAnnotation/help-title.html
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,3 @@ | ||
<div> | ||
Title of the annotation. | ||
</div> |
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
Oops, something went wrong.