Klasse SourceCodeFacade

java.lang.Object
io.jenkins.plugins.coverage.metrics.source.SourceCodeFacade

public class SourceCodeFacade extends Object
Facade to the source code file structure in Jenkins build folder. Access of those files should be done using an instance of this class only.
Autor:
Ullrich Hafner, Florian Orendi
  • Konstruktordetails

    • SourceCodeFacade

      public SourceCodeFacade()
  • Methodendetails

    • read

      public String read(File buildResults, String id, String path) throws IOException, InterruptedException
      Reads the contents of the source file of the given file into a String.
      Parameter:
      buildResults - Jenkins directory for build results
      id - if of the coverage results
      path - relative path to the coverage node base filename of the coverage node
      Gibt zurück:
      the file content as String
      Löst aus:
      IOException
      InterruptedException
    • canRead

      public boolean canRead(File buildResults, String id, String path)
      Returns whether the source code is available for the specified source file.
      Parameter:
      buildResults - Jenkins directory for build results
      id - if of the coverage results
      path - relative path to the source code filename name
      Gibt zurück:
      the file content as String
    • hasStoredSourceCode

      public boolean hasStoredSourceCode(File buildResults, String id)
      Checks whether any source files has been stored. Even if it is wanted, there might have been errors which cause the absence of any source files.
      Parameter:
      buildResults - Jenkins directory for build results
      id - id of the coverage results
      Gibt zurück:
      true whether source files has been stored, else false
    • calculateModifiedLinesCoverageSourceCode

      public String calculateModifiedLinesCoverageSourceCode(String content, edu.hm.hafner.coverage.FileNode fileNode)
      Filters the sourcecode coverage highlighting for analyzing the modified lines coverage only.
      Parameter:
      content - The original HTML content
      fileNode - The node which represents the coverage of the file
      Gibt zurück:
      the filtered HTML sourcecode view
    • calculateIndirectCoverageChangesSourceCode

      public String calculateIndirectCoverageChangesSourceCode(String content, edu.hm.hafner.coverage.FileNode fileNode)
      Filters the sourcecode coverage highlighting for analyzing indirect coverage changes only.
      Parameter:
      content - The original HTML content
      fileNode - The node which represents the coverage of the file
      Gibt zurück:
      the filtered HTML sourcecode view