Klasse CodeDeltaCalculator
java.lang.Object
io.jenkins.plugins.coverage.model.CodeDeltaCalculator
Calculates the code delta between a Jenkins build and a reference build.
- Autor:
- Florian Orendi
-
Konstruktorübersicht
KonstruktorBeschreibungCodeDeltaCalculator
(Run<?, ?> build, FilePath workspace, TaskListener listener, String scm) Creates a code delta calculator for a specific build. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungOptional
<io.jenkins.plugins.forensics.delta.Delta> calculateCodeDeltaToReference
(Run<?, ?> referenceBuild, edu.hm.hafner.util.FilteredLog log) Calculates the code delta between thebuild
and the passed reference build.createOldPathMapping
(CoverageNode root, CoverageNode referenceRoot, Map<String, io.jenkins.plugins.forensics.delta.FileChanges> changes, edu.hm.hafner.util.FilteredLog log) Creates a mapping between the currently used coverage report paths and the corresponding paths that has been used for the same coverage nodes before the modifications.Set
<io.jenkins.plugins.forensics.delta.FileChanges> getCoverageRelevantChanges
(io.jenkins.plugins.forensics.delta.Delta delta) Gets all code changes which are relevant for the coverage (added, renamed and modified files).mapScmChangesToReportPaths
(Set<io.jenkins.plugins.forensics.delta.FileChanges> changes, CoverageNode root, edu.hm.hafner.util.FilteredLog log) Maps the passedcode changes
to the corresponding fully qualified names as they are used by the coverage reporting tools - usually the fully qualified name of the file.
-
Konstruktordetails
-
CodeDeltaCalculator
Creates a code delta calculator for a specific build.- Parameter:
build
- The buildworkspace
- The workspacelistener
- The listenerscm
- The selected SCM
-
-
Methodendetails
-
calculateCodeDeltaToReference
public Optional<io.jenkins.plugins.forensics.delta.Delta> calculateCodeDeltaToReference(Run<?, ?> referenceBuild, edu.hm.hafner.util.FilteredLog log) Calculates the code delta between thebuild
and the passed reference build.- Parameter:
referenceBuild
- The reference buildlog
- The log- Gibt zurück:
- the
code delta
as Optional if existent, else an empty Optional
-
getCoverageRelevantChanges
public Set<io.jenkins.plugins.forensics.delta.FileChanges> getCoverageRelevantChanges(io.jenkins.plugins.forensics.delta.Delta delta) Gets all code changes which are relevant for the coverage (added, renamed and modified files).- Parameter:
delta
- The calculated codeDelta
- Gibt zurück:
- the relevant code changes
-
mapScmChangesToReportPaths
public Map<String,io.jenkins.plugins.forensics.delta.FileChanges> mapScmChangesToReportPaths(Set<io.jenkins.plugins.forensics.delta.FileChanges> changes, CoverageNode root, edu.hm.hafner.util.FilteredLog log) throws CodeDeltaException Maps the passedcode changes
to the corresponding fully qualified names as they are used by the coverage reporting tools - usually the fully qualified name of the file.- Parameter:
changes
- The code changesroot
- The root of the coverage treelog
- The log- Gibt zurück:
- the create code changes mapping
- Löst aus:
CodeDeltaException
- when creating the mapping failed due to ambiguous paths
-
createOldPathMapping
public Map<String,String> createOldPathMapping(CoverageNode root, CoverageNode referenceRoot, Map<String, io.jenkins.plugins.forensics.delta.FileChanges> changes, edu.hm.hafner.util.FilteredLog log) throws CodeDeltaExceptionCreates a mapping between the currently used coverage report paths and the corresponding paths that has been used for the same coverage nodes before the modifications. This affects only renamed and untouched / modified files without a renaming, since added files did not exist before and deleted files do not exist anymore.- Parameter:
root
- The root of the coverage treereferenceRoot
- The root of the coverage tree from the reference buildchanges
- Thechanges
, mapped by the currently used coverage report path to which they correspond tolog
- The log- Gibt zurück:
- the created mapping whose keys are the currently used paths and whose values are the paths before the modifications
- Löst aus:
CodeDeltaException
- if the SCM path mapping is ambiguous
-