Package org.sonar.api.batch.scm
Class ScmProvider
- java.lang.Object
-
- org.sonar.api.batch.scm.ScmProvider
-
@ScannerSide @ExtensionPoint public abstract class ScmProvider extends java.lang.Object
- Since:
- 5.0
-
-
Constructor Summary
Constructors Constructor Description ScmProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BlameCommandblameCommand()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.IgnoreCommandignoreCommand()abstract java.lang.Stringkey()Unique identifier of the provider.java.nio.file.PathrelativePathFromScmRoot(java.nio.file.Path path)The relative path from SCM rootjava.lang.StringrevisionId(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.booleansupports(java.io.File baseDir)Whether this provider is able to manage files located in this directory.
-
-
-
Method Detail
-
key
public abstract java.lang.String key()
Unique identifier of the provider. Can be passed toCoreProperties.SCM_PROVIDER_KEYCan 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
-
blameCommand
public BlameCommand blameCommand()
-
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 null is returned or if a path is not included in the map, 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
-
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
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
-
-