@@ -19,6 +19,7 @@ var outputFile string
1919var toolToAnalyze string
2020var autoFix bool
2121var doNewPr bool
22+ var outputFormat string
2223var sarifPath string
2324var commitUuid string
2425var projectToken string
@@ -95,6 +96,7 @@ type Pattern struct {
9596func init () {
9697 analyzeCmd .Flags ().StringVarP (& outputFile , "output" , "o" , "" , "output file for the results" )
9798 analyzeCmd .Flags ().StringVarP (& toolToAnalyze , "tool" , "t" , "" , "Which tool to run analysis with" )
99+ analyzeCmd .Flags ().StringVar (& outputFormat , "format" , "" , "Output format (use 'sarif' for SARIF format to terminal)" )
98100 analyzeCmd .Flags ().BoolVarP (& autoFix , "fix" , "f" , false , "Apply auto fix to your issues when available" )
99101 analyzeCmd .Flags ().BoolVar (& doNewPr , "new-pr" , false , "Create a new PR on GitHub containing the fixed issues" )
100102 rootCmd .AddCommand (analyzeCmd )
@@ -221,9 +223,11 @@ var analyzeCmd = &cobra.Command{
221223 log .Printf ("Running %s...\n " , toolToAnalyze )
222224 if outputFile != "" {
223225 log .Println ("Output will be available at" , outputFile )
226+ } else if outputFormat == "sarif" {
227+ log .Println ("Output will be in SARIF format" )
224228 }
225229
226- tools .RunEslint (workDirectory , eslintInstallationDirectory , nodeBinary , args , autoFix , outputFile )
230+ tools .RunEslint (workDirectory , eslintInstallationDirectory , nodeBinary , args , autoFix , outputFile , outputFormat )
227231
228232 if doNewPr {
229233 utils .CreatePr (false )
@@ -238,4 +242,4 @@ func failIfThereArePendingChanges() {
238242 if string (out ) != "" {
239243 log .Fatal ("There are pending changes, cannot proceed. Commit your pending changes." )
240244 }
241- }
245+ }
0 commit comments