Class StaticAnalysisLabelProvider
- java.lang.Object
-
- io.jenkins.plugins.analysis.core.model.StaticAnalysisLabelProvider
-
- All Implemented Interfaces:
DescriptionProvider
- Direct Known Subclasses:
IconLabelProvider
,SvgIconLabelProvider
public class StaticAnalysisLabelProvider extends Object implements DescriptionProvider
A generic label provider for static analysis results. Creates pre-defined labels that are parameterized with a string placeholder, that will be replaced with the actual name of the static analysis tool. Moreover, such a default label provider decorates the links and summary boxes with the default icon of the warnings plug-in.- Author:
- Ullrich Hafner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
StaticAnalysisLabelProvider.AgeBuilder
Functional interface that maps the age of a build from an integer value to a String value.static class
StaticAnalysisLabelProvider.DefaultAgeBuilder
Computes the age of a build as a hyper link.
-
Field Summary
Fields Modifier and Type Field Description protected static DescriptionProvider
EMPTY_DESCRIPTION
Provides an empty description.
-
Constructor Summary
Constructors Constructor Description StaticAnalysisLabelProvider(String id, String name)
Creates a newStaticAnalysisLabelProvider
with the specified ID.StaticAnalysisLabelProvider(String id, String name, DescriptionProvider descriptionProvider)
Creates a newStaticAnalysisLabelProvider
with the specified ID.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected StaticAnalysisLabelProvider.DefaultAgeBuilder
getAgeBuilder(Run<?,?> owner, String url)
Creates aStaticAnalysisLabelProvider.DefaultAgeBuilder
for the specified run and url.String
getDescription(edu.hm.hafner.analysis.Issue issue)
Returns a detailed description of the specified issue.protected FileNameRenderer
getFileNameRenderer(Run<?,?> owner)
Creates aFileNameRenderer
for the specified run.j2html.tags.ContainerTag
getFixedIssuesLabel(int fixedSize)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
String
getId()
Returns the ID of the tool.DetailsTableModel
getIssuesModel(Run<?,?> build, String url, edu.hm.hafner.analysis.Report report)
Returns the model for the issues details table.String
getLargeIconUrl()
Returns the absolute URL to the large icon for the tool.String
getLinkName()
Returns the name of the link to the results.String
getName()
Returns the human-readable name of the tool.j2html.tags.ContainerTag
getNewIssuesLabel(int newSize)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
j2html.tags.DomContent
getNoIssuesSinceLabel(int currentBuild, int noIssuesSinceBuild)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
j2html.tags.DomContent
getQualityGateResult(QualityGateStatus qualityGateStatus)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
j2html.tags.DomContent
getQualityGateResult(QualityGateStatus qualityGateStatus, boolean hasResetLink)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
String
getRawLinkName()
Deprecated.usegetLinkName()
j2html.tags.DomContent
getReferenceBuild(Run<?,?> referenceBuild)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
String
getSmallIconUrl()
Returns the absolute URL to the small icon for the tool.String
getSourceCodeDescription(Run<?,?> build, edu.hm.hafner.analysis.Issue issue)
Returns an additional description of the specified issue that will be shown with the source code.j2html.tags.ContainerTag
getTitle(AnalysisResult result, boolean hasErrors)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
String
getToolTip(int numberOfItems)
Returns a short description describing the total number of issues.String
getTrendName()
Returns the legend for the trend chart in the project overview.StaticAnalysisLabelProvider
setName(String name)
Sets the human-readable name of the tool.String
toString()
-
-
-
Field Detail
-
EMPTY_DESCRIPTION
protected static final DescriptionProvider EMPTY_DESCRIPTION
Provides an empty description.
-
-
Constructor Detail
-
StaticAnalysisLabelProvider
public StaticAnalysisLabelProvider(String id, @CheckForNull String name)
Creates a newStaticAnalysisLabelProvider
with the specified ID.- Parameters:
id
- the IDname
- the name of the static analysis tool
-
StaticAnalysisLabelProvider
public StaticAnalysisLabelProvider(String id, @CheckForNull String name, DescriptionProvider descriptionProvider)
Creates a newStaticAnalysisLabelProvider
with the specified ID.- Parameters:
id
- the IDname
- the name of the static analysis tooldescriptionProvider
- provides additional descriptions for an issue
-
-
Method Detail
-
getIssuesModel
public DetailsTableModel getIssuesModel(Run<?,?> build, String url, edu.hm.hafner.analysis.Report report)
Returns the model for the issues details table.- Parameters:
build
- the build of the resultsurl
- the URL of the resultsreport
- the report to show- Returns:
- the table model
-
getAgeBuilder
protected StaticAnalysisLabelProvider.DefaultAgeBuilder getAgeBuilder(Run<?,?> owner, String url)
Creates aStaticAnalysisLabelProvider.DefaultAgeBuilder
for the specified run and url.- Parameters:
owner
- the run to get the age fromurl
- the url to the results- Returns:
- the age builder
-
getFileNameRenderer
protected FileNameRenderer getFileNameRenderer(Run<?,?> owner)
Creates aFileNameRenderer
for the specified run.- Parameters:
owner
- the run to get the file names for- Returns:
- the age builder
-
getId
public String getId()
Returns the ID of the tool.- Returns:
- the ID
-
getName
public String getName()
Returns the human-readable name of the tool. If the name has not been set, then the default name is returned.- Returns:
- the name
-
setName
public StaticAnalysisLabelProvider setName(@CheckForNull String name)
Sets the human-readable name of the tool.- Parameters:
name
- the name of the tool- Returns:
- the name
-
getLinkName
public String getLinkName()
Returns the name of the link to the results.- Returns:
- the name of the side panel link
-
getRawLinkName
@Deprecated public String getRawLinkName()
Deprecated.usegetLinkName()
Returns the name of the link to the results.- Returns:
- the name of the side panel link
-
getTrendName
public String getTrendName()
Returns the legend for the trend chart in the project overview.- Returns:
- the legend of the trend chart
-
getSmallIconUrl
public String getSmallIconUrl()
Returns the absolute URL to the small icon for the tool.- Returns:
- absolute URL
-
getLargeIconUrl
public String getLargeIconUrl()
Returns the absolute URL to the large icon for the tool.- Returns:
- absolute URL
-
getTitle
@Deprecated public j2html.tags.ContainerTag getTitle(AnalysisResult result, boolean hasErrors)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the title for the small information box in the corresponding build page.- Parameters:
result
- the resulthasErrors
- indicates if an error has been reported- Returns:
- the title div
-
getNewIssuesLabel
@Deprecated public j2html.tags.ContainerTag getNewIssuesLabel(int newSize)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML label for the link to the new issues of the build.- Parameters:
newSize
- the number of new issues- Returns:
- the legend of the trend chart
-
getFixedIssuesLabel
@Deprecated public j2html.tags.ContainerTag getFixedIssuesLabel(int fixedSize)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML label for the link to the fixed issues of the build.- Parameters:
fixedSize
- the number of fixed issues- Returns:
- the legend of the trend chart
-
getNoIssuesSinceLabel
@Deprecated public j2html.tags.DomContent getNoIssuesSinceLabel(int currentBuild, int noIssuesSinceBuild)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML text showing the number of builds since the project has no issues.- Parameters:
currentBuild
- the current build numbernoIssuesSinceBuild
- the build since there are no issues- Returns:
- the legend of the trend chart
-
getQualityGateResult
@Deprecated public j2html.tags.DomContent getQualityGateResult(QualityGateStatus qualityGateStatus)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML text showing the result of the quality gate.- Parameters:
qualityGateStatus
- the status of the quality gate- Returns:
- the legend of the trend chart
-
getQualityGateResult
@Deprecated public j2html.tags.DomContent getQualityGateResult(QualityGateStatus qualityGateStatus, boolean hasResetLink)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML text showing the result of the quality gate.- Parameters:
qualityGateStatus
- the status of the quality gatehasResetLink
- determines whether the reset reference link is shown- Returns:
- the legend of the trend chart
-
getReferenceBuild
@Deprecated public j2html.tags.DomContent getReferenceBuild(Run<?,?> referenceBuild)
Deprecated.rendering of the summary is now done on the client side with the new modelSummaryModel
Returns the HTML text showing a link to the reference build.- Parameters:
referenceBuild
- the reference build- Returns:
- the legend of the trend chart
-
getToolTip
public String getToolTip(int numberOfItems)
Returns a short description describing the total number of issues.- Parameters:
numberOfItems
- the number of issues to report- Returns:
- the description
-
getDescription
public String getDescription(edu.hm.hafner.analysis.Issue issue)
Description copied from interface:DescriptionProvider
Returns a detailed description of the specified issue.- Specified by:
getDescription
in interfaceDescriptionProvider
- Parameters:
issue
- the issue to get the description for- Returns:
- the description
-
getSourceCodeDescription
public String getSourceCodeDescription(Run<?,?> build, edu.hm.hafner.analysis.Issue issue)
Returns an additional description of the specified issue that will be shown with the source code.- Parameters:
build
- the current buildissue
- the issue- Returns:
- the additional description
-
-