@@ -3,6 +3,12 @@ package cmd
33import (
44 "context"
55 "fmt"
6+ "os"
7+ "os/signal"
8+ "path/filepath"
9+ "strings"
10+ "syscall"
11+
612 "github.com/boostsecurityio/poutine/analyze"
713 "github.com/boostsecurityio/poutine/formatters/json"
814 "github.com/boostsecurityio/poutine/formatters/pretty"
@@ -11,15 +17,10 @@ import (
1117 "github.com/boostsecurityio/poutine/opa"
1218 "github.com/boostsecurityio/poutine/providers/gitops"
1319 "github.com/boostsecurityio/poutine/providers/scm"
14- "github.com/boostsecurityio/poutine/providers/scm/domain"
20+ scm_domain "github.com/boostsecurityio/poutine/providers/scm/domain"
1521 "github.com/rs/zerolog"
1622 "github.com/rs/zerolog/log"
1723 "github.com/spf13/viper"
18- "os"
19- "os/signal"
20- "path/filepath"
21- "strings"
22- "syscall"
2324
2425 "github.com/spf13/cobra"
2526)
3637var token string
3738var cfgFile string
3839var config * models.Config = models .DefaultConfig ()
40+ var skipRules []string
3941
4042var legacyFlags = []string {"-token" , "-format" , "-verbose" , "-scm" , "-scm-base-uri" , "-threads" }
4143
@@ -112,6 +114,7 @@ func init() {
112114 rootCmd .PersistentFlags ().StringVarP (& ScmProvider , "scm" , "s" , "github" , "SCM platform (github, gitlab)" )
113115 rootCmd .PersistentFlags ().VarP (& ScmBaseURL , "scm-base-url" , "b" , "Base URI of the self-hosted SCM instance (optional)" )
114116 rootCmd .PersistentFlags ().BoolVarP (& config .Quiet , "quiet" , "q" , false , "Disable progress output" )
117+ rootCmd .PersistentFlags ().StringSliceVar (& skipRules , "skip" , []string {}, "Adds rules to the configured skip list for the current run (optional)" )
115118
116119 viper .BindPFlag ("quiet" , rootCmd .PersistentFlags ().Lookup ("quiet" ))
117120}
@@ -186,6 +189,9 @@ func GetAnalyzer(ctx context.Context, command string) (*analyze.Analyzer, error)
186189}
187190
188191func newOpa (ctx context.Context ) (* opa.Opa , error ) {
192+ if len (skipRules ) > 0 {
193+ config .Skip = append (config .Skip , models.ConfigSkip {Rule : skipRules })
194+ }
189195 opaClient , err := opa .NewOpa (ctx , config )
190196 if err != nil {
191197 log .Error ().Err (err ).Msg ("Failed to create OPA client" )
0 commit comments