feat(git): disable link generation (#1748)

Add an option to disable link creation. If there are any weird edge cases, it shouldn't block scanning
This commit is contained in:
Richard Gomez authored and GitHub committed 2025-02-10 13:15:44 -06:00
1 parent c6424a6fc3
commit ae26eff464
6 files changed
+27 -26

No files matched your search

+7 -3
View File
@@ -8,7 +8,8 @@ import (
type Platform int
const (
NoPlatform Platform = iota
UnknownPlatform Platform = iota
NoPlatform // Explicitly disable the feature
GitHubPlatform
GitLabPlatform
// TODO: Add others.
@@ -16,6 +17,7 @@ const (
func (p Platform) String() string {
return [...]string{
"unknown",
"none",
"github",
"gitlab",
@@ -24,13 +26,15 @@ func (p Platform) String() string {
func PlatformFromString(s string) (Platform, error) {
switch strings.ToLower(s) {
case "", "none":
case "", "unknown":
return UnknownPlatform, nil
case "none":
return NoPlatform, nil
case "github":
return GitHubPlatform, nil
case "gitlab":
return GitLabPlatform, nil
default:
return NoPlatform, fmt.Errorf("invalid scm platform value: %s", s)
return UnknownPlatform, fmt.Errorf("invalid scm platform value: %s", s)
}
}