diff --git a/internal/cmd/scan/scan.go b/internal/cmd/scan/scan.go index 2cef629f..eebb85fa 100644 --- a/internal/cmd/scan/scan.go +++ b/internal/cmd/scan/scan.go @@ -60,7 +60,7 @@ const ( VersionHintFlag = "version-hint" SBOMFlag = "sbom" SBOMOutputFlag = "sbom-output" - ExperimentalFlag = "experimental-value" + ExperimentalFlag = "experimental" ) var scanCmdError error @@ -140,7 +140,7 @@ $ debricked scan . --include '**/node_modules/**'`) experimentalFlagDoc := strings.Join( []string{ "This flag allows inclusion of repository matches", - "\nExample:\n$ debricked scan . --experimental-flag=false", + "\nExample:\n$ debricked scan . --experimental=false", }, "\n") cmd.Flags().BoolVar(&experimental, ExperimentalFlag, false, experimentalFlagDoc) verboseDoc := strings.Join( @@ -180,6 +180,12 @@ Leaving the field empty results in no SBOM generation.`, viper.MustBindEnv(SBOMFlag) viper.MustBindEnv(SBOMOutputFlag) + // Hide experimental flag + err := cmd.Flags().MarkHidden(ExperimentalFlag) + if err != nil { // This should not be reachable + fmt.Println("Trying to hide non-existing flag") + } + return cmd } @@ -212,7 +218,7 @@ func RunE(s *scan.IScanner) func(_ *cobra.Command, args []string) error { CallGraphUploadTimeout: viper.GetInt(CallGraphUploadTimeoutFlag), CallGraphGenerateTimeout: viper.GetInt(CallGraphGenerateTimeoutFlag), MinFingerprintContentLength: viper.GetInt(MinFingerprintContentLengthFlag), - ExperimentalFlag: viper.GetBool(ExperimentalFlag), + Experimental: viper.GetBool(ExperimentalFlag), } if s != nil { scanCmdError = (*s).Scan(options) diff --git a/internal/scan/scanner.go b/internal/scan/scanner.go index 81f5e6bd..c1b4c2b4 100644 --- a/internal/scan/scanner.go +++ b/internal/scan/scanner.go @@ -68,7 +68,7 @@ type DebrickedOptions struct { CallGraphUploadTimeout int CallGraphGenerateTimeout int MinFingerprintContentLength int - ExperimentalFlag bool + Experimental bool } func NewDebrickedScanner( @@ -270,7 +270,7 @@ func (dScanner *DebrickedScanner) scan(options DebrickedOptions, gitMetaObject g CallGraphUploadTimeout: options.CallGraphUploadTimeout, VersionHint: options.VersionHint, DebrickedConfig: dScanner.getDebrickedConfig(options.Path, options.Exclusions, options.Inclusions), - ExperimentalFlag: options.ExperimentalFlag, + Experimental: options.Experimental, } result, err := (*dScanner.uploader).Upload(uploaderOptions) if err != nil { diff --git a/internal/upload/batch.go b/internal/upload/batch.go index ccb41dd8..83bd3e5c 100644 --- a/internal/upload/batch.go +++ b/internal/upload/batch.go @@ -41,13 +41,13 @@ type uploadBatch struct { callGraphTimeout int versionHint bool debrickedConfig *DebrickedConfig // JSON Config - experimentalFlag bool + experimental bool } func newUploadBatch( client *client.IDebClient, fileGroups file.Groups, gitMetaObject *git.MetaObject, integrationName string, callGraphTimeout int, versionHint bool, debrickedConfig *DebrickedConfig, - experimentalFlag bool, + experimental bool, ) *uploadBatch { return &uploadBatch{ client: client, @@ -58,7 +58,7 @@ func newUploadBatch( callGraphTimeout: callGraphTimeout, versionHint: versionHint, debrickedConfig: debrickedConfig, - experimentalFlag: experimentalFlag, + experimental: experimental, } } @@ -186,7 +186,7 @@ func (uploadBatch *uploadBatch) initAnalysis() error { VersionHint: uploadBatch.versionHint, DebrickedConfig: uploadBatch.debrickedConfig, DebrickedIntegration: "cli", - ExperimentalFlag: uploadBatch.experimentalFlag, + Experimental: uploadBatch.experimental, }) if err != nil { @@ -331,7 +331,7 @@ type uploadFinish struct { DebrickedIntegration string `json:"debrickedIntegration"` VersionHint bool `json:"versionHint"` DebrickedConfig *DebrickedConfig `json:"debrickedConfig"` - ExperimentalFlag bool `json:"experimentalFlag"` + Experimental bool `json:"experimental"` } func getRelativeFilePath(filePath string) string { diff --git a/internal/upload/uploader.go b/internal/upload/uploader.go index a27c4a58..bb3d1131 100644 --- a/internal/upload/uploader.go +++ b/internal/upload/uploader.go @@ -17,7 +17,7 @@ type DebrickedOptions struct { CallGraphUploadTimeout int VersionHint bool DebrickedConfig *DebrickedConfig - ExperimentalFlag bool + Experimental bool } type IUploader interface { @@ -46,7 +46,7 @@ func (uploader *Uploader) Upload(o IOptions) (*UploadResult, error) { dOptions.CallGraphUploadTimeout, dOptions.VersionHint, dOptions.DebrickedConfig, - dOptions.ExperimentalFlag, + dOptions.Experimental, ) err := batch.upload()