Class AnalysisResult
java.lang.Object
io.jenkins.plugins.analysis.core.model.AnalysisResult
- All Implemented Interfaces:
AnalysisBuildResult,StaticAnalysisRun,Serializable
Stores the results of a static analysis run. Provides support for persisting the results of the build and loading and
saving of issues (all, new, and fixed) and delta computation.
- Author:
- Ullrich Hafner
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionAnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics totals, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin) Creates a new instance ofAnalysisResult.protectedAnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics repositoryStatistics, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin, boolean canSerialize) Creates a new instance ofAnalysisResult.AnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics totals, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin, AnalysisResult previousResult) Creates a new instance ofAnalysisResult. -
Method Summary
Modifier and TypeMethodDescriptionio.jenkins.plugins.forensics.blame.BlamesReturns the blames for the report.edu.hm.hafner.echarts.BuildgetBuild()intorg.eclipse.collections.api.list.ImmutableList<String>Returns the error messages of the analysis run.edu.hm.hafner.analysis.ReportReturns all fixed issues of the associated static analysis run.intReturns the number of fixed issues in this analysis run.io.jenkins.plugins.forensics.miner.RepositoryStatisticsReturns the repository statistics for the report.getId()Returns the ID of the static analysis result.org.eclipse.collections.api.list.ImmutableList<String>Returns the info messages of the analysis run.edu.hm.hafner.analysis.ReportReturns all issues of the associated static analysis run.intReturns the number of new errors in this analysis run.intReturns the number of new high-severity issues in this analysis run.edu.hm.hafner.analysis.ReportReturns all new issues of the associated static analysis run.intReturns the number of new low-severity issues in this analysis run.intReturns the number of new normal-severity issues in this analysis run.intReturns the number of new issues in this analysis run.intgetNewSizeOf(edu.hm.hafner.analysis.Severity severity) Returns the new number of issues in this analysis run that have the specifiedSeverity.Returns the new number of issues in this analysis run, mapped bySeverity.intReturns the build number since the associated job has no issues.edu.hm.hafner.analysis.ReportReturns all outstanding issues of the associated static analysis run.Run<?,?> getOwner()Returns the run that created this static analysis result.io.jenkins.plugins.util.QualityGateResultReturns theQualityGateResultof the quality gates evaluation of the static analysis run.io.jenkins.plugins.util.QualityGateStatusReturns theQualityGateStatusof the quality gates evaluation of the static analysis run.Returns the reference static analysis run that has been used to compute the new issues.Returns the number of issues in this analysis run, mapped by their origin.Returns the number of issues in this analysis run, mapped bySeverity.intReturns the build number since the associated job has a successful static analysis result.intReturns the total number of errors in this analysis run.intReturns the total number of high-severity issues in this analysis run.intReturns the total number of low-severity issues in this analysis run.intReturns the total number of normal severity issues in this analysis run.Returns the total number of issues (by severity, new, total, fixed and delta) in a build.intReturns the total number of issues in this analysis run.intgetTotalSizeOf(edu.hm.hafner.analysis.Severity severity) Returns the total number of issues in this analysis run that have the specifiedSeverity.booleanCheck ifAnalysisResultissues does not have any new warnings.booleanisEmpty()Check ifAnalysisResultissues are empty (including new, outstanding and fixed).booleanReturns whether the static analysis result is successful with respect to the definedQualityGateEvaluator.protected ObjectCalled after deserialization to retain backward compatibility.voidSets the run for this result after Jenkins read its data from disk.toString()
-
Constructor Details
-
AnalysisResult
public AnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics totals, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin, AnalysisResult previousResult) Creates a new instance ofAnalysisResult.- Parameters:
owner- the current build as the owner of this actionid- ID of the resultsreport- the issues of this resultblames- author and commit information for all issuestotals- repository statistics for all issuesqualityGateResult- the quality gate statussizePerOrigin- the number of issues per originpreviousResult- the analysis result of the previous run
-
AnalysisResult
public AnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics totals, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin) Creates a new instance ofAnalysisResult.- Parameters:
owner- the current build as the owner of this actionid- ID of the resultsreport- the issues of this resultblames- author and commit information for all issuestotals- repository statistics for all issuesqualityGateResult- the quality gate statussizePerOrigin- the number of issues per origin
-
AnalysisResult
protected AnalysisResult(Run<?, ?> owner, String id, DeltaReport report, io.jenkins.plugins.forensics.blame.Blames blames, io.jenkins.plugins.forensics.miner.RepositoryStatistics repositoryStatistics, io.jenkins.plugins.util.QualityGateResult qualityGateResult, Map<String, Integer> sizePerOrigin, boolean canSerialize) Creates a new instance ofAnalysisResult.- Parameters:
owner- the current run as the owner of this actionid- ID of the resultsreport- the issues of this resultblames- author and commit information for all issuesrepositoryStatistics- source code repository statistics for all issuesqualityGateResult- the quality gate statussizePerOrigin- the number of issues per origincanSerialize- determines whether the result should be persisted in the build folder
-
-
Method Details
-
readResolve
Called after deserialization to retain backward compatibility.- Returns:
- this
-
getBlames
public io.jenkins.plugins.forensics.blame.Blames getBlames()Returns the blames for the report.- Returns:
- the blames
-
getForensics
public io.jenkins.plugins.forensics.miner.RepositoryStatistics getForensics()Returns the repository statistics for the report.- Returns:
- the statistics
-
getId
Description copied from interface:StaticAnalysisRunReturns the ID of the static analysis result.- Specified by:
getIdin interfaceStaticAnalysisRun- Returns:
- the ID
-
getOwner
Description copied from interface:StaticAnalysisRunReturns the run that created this static analysis result.- Specified by:
getOwnerin interfaceStaticAnalysisRun- Returns:
- the run
-
setOwner
Sets the run for this result after Jenkins read its data from disk.- Parameters:
owner- the initialized run
-
getErrorMessages
Description copied from interface:StaticAnalysisRunReturns the error messages of the analysis run.- Specified by:
getErrorMessagesin interfaceStaticAnalysisRun- Returns:
- the error messages
-
getInfoMessages
Description copied from interface:StaticAnalysisRunReturns the info messages of the analysis run.- Specified by:
getInfoMessagesin interfaceStaticAnalysisRun- Returns:
- the info messages
-
getIssues
public edu.hm.hafner.analysis.Report getIssues()Returns all issues of the associated static analysis run. These include outstanding issues as well as new issues.- Returns:
- all issues
-
isEmpty
public boolean isEmpty()Check ifAnalysisResultissues are empty (including new, outstanding and fixed).- Returns:
- true if
AnalysisResultissues are empty, else false.
-
hasNoNewWarnings
public boolean hasNoNewWarnings()Check ifAnalysisResultissues does not have any new warnings.- Returns:
- true if
AnalysisResultissues has no new warnings.
-
getOutstandingIssues
public edu.hm.hafner.analysis.Report getOutstandingIssues()Returns all outstanding issues of the associated static analysis run. I.e., all issues that are part of the current and previous report.- Returns:
- all outstanding issues
-
getNewIssues
public edu.hm.hafner.analysis.Report getNewIssues()Returns all new issues of the associated static analysis run. I.e., all issues that are part of the current report but have not been shown up in the previous report.- Returns:
- all new issues
-
getFixedIssues
public edu.hm.hafner.analysis.Report getFixedIssues()Returns all fixed issues of the associated static analysis run. I.e., all issues that are part of the previous report but are not present in the current report anymore.- Returns:
- all fixed issues
-
getNoIssuesSinceBuild
public int getNoIssuesSinceBuild()Description copied from interface:StaticAnalysisRunReturns the build number since the associated job has no issues.- Specified by:
getNoIssuesSinceBuildin interfaceStaticAnalysisRun- Returns:
- the build number since there are no issues, or -1 if issues have been reported
-
getSuccessfulSinceBuild
public int getSuccessfulSinceBuild()Description copied from interface:StaticAnalysisRunReturns the build number since the associated job has a successful static analysis result.- Specified by:
getSuccessfulSinceBuildin interfaceStaticAnalysisRun- Returns:
- the build number since the static analysis result is successful, or -1 if the result is not successful
-
isSuccessful
public boolean isSuccessful()Returns whether the static analysis result is successful with respect to the definedQualityGateEvaluator.- Returns:
trueif the static analysis result is successful,falseif the static analysis result isQualityGateStatus.WARNINGorQualityGateStatus.FAILED- See Also:
-
QualityGateEvaluator
-
getQualityGateStatus
public io.jenkins.plugins.util.QualityGateStatus getQualityGateStatus()Description copied from interface:StaticAnalysisRunReturns theQualityGateStatusof the quality gates evaluation of the static analysis run.- Specified by:
getQualityGateStatusin interfaceStaticAnalysisRun- Returns:
- the quality gate status
-
getQualityGateResult
public io.jenkins.plugins.util.QualityGateResult getQualityGateResult()Description copied from interface:StaticAnalysisRunReturns theQualityGateResultof the quality gates evaluation of the static analysis run.- Specified by:
getQualityGateResultin interfaceStaticAnalysisRun- Returns:
- the quality gate status
-
toString
-
getReferenceBuild
Description copied from interface:StaticAnalysisRunReturns the reference static analysis run that has been used to compute the new issues.- Specified by:
getReferenceBuildin interfaceStaticAnalysisRun- Returns:
- the reference build
-
getTotals
Description copied from interface:AnalysisBuildResultReturns the total number of issues (by severity, new, total, fixed and delta) in a build.- Specified by:
getTotalsin interfaceAnalysisBuildResult- Returns:
- the totals
-
getSizePerOrigin
Description copied from interface:AnalysisBuildResultReturns the number of issues in this analysis run, mapped by their origin. The origin is the tool that created the report.- Specified by:
getSizePerOriginin interfaceAnalysisBuildResult- Returns:
- number of issues per origin
-
getSizePerSeverity
Returns the number of issues in this analysis run, mapped bySeverity.- Returns:
- number of issues per severity
-
getNewSizePerSeverity
Returns the new number of issues in this analysis run, mapped bySeverity.- Returns:
- number of issues per severity
-
getTotalSize
public int getTotalSize()Description copied from interface:AnalysisBuildResultReturns the total number of issues in this analysis run.- Specified by:
getTotalSizein interfaceAnalysisBuildResult- Returns:
- total number of issues
-
getTotalSizeOf
public int getTotalSizeOf(edu.hm.hafner.analysis.Severity severity) Description copied from interface:AnalysisBuildResultReturns the total number of issues in this analysis run that have the specifiedSeverity.- Specified by:
getTotalSizeOfin interfaceAnalysisBuildResult- Parameters:
severity- the severity of the issues to match- Returns:
- total number of issues
-
getTotalErrorsSize
public int getTotalErrorsSize()Returns the total number of errors in this analysis run.- Returns:
- total number of errors
-
getTotalHighPrioritySize
public int getTotalHighPrioritySize()Returns the total number of high-severity issues in this analysis run.- Returns:
- total number of high-severity issues
-
getTotalNormalPrioritySize
public int getTotalNormalPrioritySize()Returns the total number of normal severity issues in this analysis run.- Returns:
- total number of normal severity issues
-
getTotalLowPrioritySize
public int getTotalLowPrioritySize()Returns the total number of low-severity issues in this analysis run.- Returns:
- total number of low-severity issues
-
getNewSize
public int getNewSize()Description copied from interface:AnalysisBuildResultReturns the number of new issues in this analysis run.- Specified by:
getNewSizein interfaceAnalysisBuildResult- Returns:
- number of new issues
-
getNewSizeOf
public int getNewSizeOf(edu.hm.hafner.analysis.Severity severity) Description copied from interface:AnalysisBuildResultReturns the new number of issues in this analysis run that have the specifiedSeverity.- Specified by:
getNewSizeOfin interfaceAnalysisBuildResult- Parameters:
severity- the severity of the issues to match- Returns:
- total number of issues
-
getNewErrorSize
public int getNewErrorSize()Returns the number of new errors in this analysis run.- Returns:
- number of new errors issues
-
getNewHighPrioritySize
public int getNewHighPrioritySize()Returns the number of new high-severity issues in this analysis run.- Returns:
- number of new high-severity issues
-
getNewNormalPrioritySize
public int getNewNormalPrioritySize()Returns the number of new normal-severity issues in this analysis run.- Returns:
- number of new normal-severity issues
-
getNewLowPrioritySize
public int getNewLowPrioritySize()Returns the number of new low-severity issues in this analysis run.- Returns:
- number of new low-severity issues
-
getFixedSize
public int getFixedSize()Description copied from interface:AnalysisBuildResultReturns the number of fixed issues in this analysis run.- Specified by:
getFixedSizein interfaceAnalysisBuildResult- Returns:
- number of fixed issues
-
getDeltaSize
public int getDeltaSize() -
getBuild
public edu.hm.hafner.echarts.Build getBuild()
-