@@ -20,6 +20,7 @@ var outputFormat string
2020var sarifPath string
2121var commitUuid string
2222var projectToken string
23+ var files []string
2324
2425type Sarif struct {
2526 Runs []struct {
@@ -91,7 +92,8 @@ type Pattern struct {
9192}
9293
9394func init () {
94- analyzeCmd .Flags ().StringVarP (& outputFile , "output" , "o" , "" , "output file for the results" )
95+ analyzeCmd .Flags ().StringVarP (& outputFile , "output" , "o" , "" , "Output file for analysis results" )
96+ analyzeCmd .Flags ().StringSliceVarP (& files , "files" , "f" , []string {}, "Files to analyze" )
9597 analyzeCmd .Flags ().StringVarP (& toolToAnalyze , "tool" , "t" , "" , "Which tool to run analysis with" )
9698 analyzeCmd .Flags ().StringVar (& outputFormat , "format" , "" , "Output format (use 'sarif' for SARIF format)" )
9799 analyzeCmd .Flags ().BoolVar (& autoFix , "fix" , false , "Apply auto fix to your issues when available" )
@@ -203,6 +205,15 @@ func runTrivyAnalysis(workDirectory string, pathsToCheck []string, outputFile st
203205 }
204206}
205207
208+ func runPylintAnalysis (workDirectory string , pathsToCheck []string , outputFile string , outputFormat string ) {
209+ pylint := config .Config .Tools ()["pylint" ]
210+
211+ err := tools .RunPylint (workDirectory , pylint , pathsToCheck , outputFile , outputFormat )
212+ if err != nil {
213+ log .Fatalf ("Error running Pylint: %v" , err )
214+ }
215+ }
216+
206217var analyzeCmd = & cobra.Command {
207218 Use : "analyze" ,
208219 Short : "Runs all linters." ,
@@ -223,9 +234,11 @@ var analyzeCmd = &cobra.Command{
223234
224235 switch toolToAnalyze {
225236 case "eslint" :
226- runEslintAnalysis (workDirectory , args , autoFix , outputFile , outputFormat )
237+ runEslintAnalysis (workDirectory , files , autoFix , outputFile , outputFormat )
227238 case "trivy" :
228- runTrivyAnalysis (workDirectory , args , outputFile , outputFormat )
239+ runTrivyAnalysis (workDirectory , files , outputFile , outputFormat )
240+ case "pylint" :
241+ runPylintAnalysis (workDirectory , files , outputFile , outputFormat )
229242 case "" :
230243 log .Fatal ("You need to specify a tool to run analysis with, e.g., '--tool eslint'" )
231244 default :
0 commit comments