mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
add support for Azure DevOps platform in SCM detection and link (#1807)
* feat: add support for Azure DevOps platform in SCM detection and link generation * feat: add support for visualstudio.com in Azure DevOps platform detection * feat: consolidate Azure DevOps platform detection for dev.azure.com and visualstudio.com
This commit is contained in:
1 parent
3e8cd2d1ab
commit
af7d5bcb83
4 files changed
+44
No files matched your search
@@ -78,6 +78,18 @@ func createScmLink(scmPlatform scm.Platform, remoteUrl string, finding report.Fi
|
||||
link += fmt.Sprintf("-%d", finding.EndLine)
|
||||
}
|
||||
return link
|
||||
case scm.AzureDevOpsPlatform:
|
||||
link := fmt.Sprintf("%s/commit/%s?path=/%s", remoteUrl, finding.Commit, filePath)
|
||||
// Add line information if applicable
|
||||
if finding.StartLine != 0 {
|
||||
link += fmt.Sprintf("&line=%d", finding.StartLine)
|
||||
}
|
||||
if finding.EndLine != finding.StartLine {
|
||||
link += fmt.Sprintf("&lineEnd=%d", finding.EndLine)
|
||||
}
|
||||
// This is a bit dirty, but Azure DevOps does not highlight the line when the lineStartColumn and lineEndColumn are not provided
|
||||
link += "&lineStartColumn=1&lineEndColumn=10000000&type=2&lineStyle=plain&_a=files"
|
||||
return link
|
||||
default:
|
||||
// This should never happen.
|
||||
return ""
|
||||
|
||||
Reference in new issue
Block a user