Class ScmProvider

    • Constructor Summary

      Constructors 
      Constructor Description
      ScmProvider()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      BlameCommand blameCommand()  
      java.util.Set<java.nio.file.Path> branchChangedFiles​(java.lang.String targetBranchName, java.nio.file.Path rootBaseDir)
      Return absolute path of the files changed in the current branch, compared to the provided target branch.
      java.util.Map<java.nio.file.Path,​java.util.Set<java.lang.Integer>> branchChangedLines​(java.lang.String targetBranchName, java.nio.file.Path rootBaseDir, java.util.Set<java.nio.file.Path> files)
      Return a map between paths given as argument and the corresponding line numbers which are new compared to the provided target branch.
      java.time.Instant forkDate​(java.lang.String referenceBranchName, java.nio.file.Path rootBaseDir)
      Find the date of the merge base between the current branch and the given reference branch.
      IgnoreCommand ignoreCommand()  
      abstract java.lang.String key()
      Unique identifier of the provider.
      java.nio.file.Path relativePathFromScmRoot​(java.nio.file.Path path)
      The relative path from SCM root
      java.lang.String revisionId​(java.nio.file.Path path)
      The current revision id of the analyzed code, for example the SHA1 of the current HEAD in a Git branch.
      boolean supports​(java.io.File baseDir)
      Whether this provider is able to manage files located in this directory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScmProvider

        public ScmProvider()
    • Method Detail

      • key

        public abstract java.lang.String key()
        Unique identifier of the provider. Can be passed to CoreProperties.SCM_PROVIDER_KEY Can be used in SCM URL to define the provider to use.
      • supports

        public boolean supports​(java.io.File baseDir)
        Whether this provider is able to manage files located in this directory. Used by autodetection. Not considered if user has forced the provider key.
        Returns:
        false by default
      • branchChangedFiles

        @CheckForNull
        public java.util.Set<java.nio.file.Path> branchChangedFiles​(java.lang.String targetBranchName,
                                                                    java.nio.file.Path rootBaseDir)
        Return absolute path of the files changed in the current branch, compared to the provided target branch.
        Returns:
        null if the SCM provider was not able to compute the list of files.
        Since:
        7.0
      • branchChangedLines

        @CheckForNull
        public java.util.Map<java.nio.file.Path,​java.util.Set<java.lang.Integer>> branchChangedLines​(java.lang.String targetBranchName,
                                                                                                           java.nio.file.Path rootBaseDir,
                                                                                                           java.util.Set<java.nio.file.Path> files)
        Return a map between paths given as argument and the corresponding line numbers which are new compared to the provided target branch. If nothing is returned for a file, the scanner will consider that the provider was unable to determine changes for that file and it will assume that nothing was changed in it. If null is returned, an imprecise fallback mechanism will be used to detect which lines are new (based on SCM dates).
        Parameters:
        files - Absolute path of files of interest
        Returns:
        null if the SCM provider was not able to compute the new lines
        Since:
        7.4
      • forkDate

        @CheckForNull
        public java.time.Instant forkDate​(java.lang.String referenceBranchName,
                                          java.nio.file.Path rootBaseDir)
        Find the date of the merge base between the current branch and the given reference branch.
        Returns:
        null if the SCM provider was not able to compute the date
        Since:
        8.4
      • relativePathFromScmRoot

        public java.nio.file.Path relativePathFromScmRoot​(java.nio.file.Path path)
        The relative path from SCM root
        Since:
        7.0
      • ignoreCommand

        public IgnoreCommand ignoreCommand()
        Since:
        7.7
      • revisionId

        @CheckForNull
        public java.lang.String revisionId​(java.nio.file.Path path)
        The current revision id of the analyzed code, for example the SHA1 of the current HEAD in a Git branch.
        Since:
        7.0