|
5 | 5 | "codacy/cli-v2/domain" |
6 | 6 | "codacy/cli-v2/plugins" |
7 | 7 | "codacy/cli-v2/tools" |
| 8 | + gosecTool "codacy/cli-v2/tools/gosec" |
8 | 9 | "codacy/cli-v2/tools/lizard" |
9 | 10 | "encoding/json" |
10 | 11 | "fmt" |
@@ -412,6 +413,16 @@ func runEnigmaAnalysis(workDirectory string, pathsToCheck []string, outputFile s |
412 | 413 | return tools.RunEnigma(workDirectory, enigma.InstallDir, enigma.Binaries["codacy-enigma-cli"], pathsToCheck, outputFile, outputFormat) |
413 | 414 | } |
414 | 415 |
|
| 416 | +func runGosecAnalysis(workDirectory string, pathsToCheck []string, outputFile string, outputFormat string) error { |
| 417 | + gosec := config.Config.Tools()["gosec"] |
| 418 | + if gosec == nil { |
| 419 | + log.Fatal("Gosec tool configuration not found") |
| 420 | + } |
| 421 | + gosecBinary := gosec.Binaries["gosec"] |
| 422 | + |
| 423 | + return gosecTool.RunGosec(workDirectory, gosecBinary, pathsToCheck, outputFile, outputFormat) |
| 424 | +} |
| 425 | + |
415 | 426 | var analyzeCmd = &cobra.Command{ |
416 | 427 | Use: "analyze", |
417 | 428 | Short: "Runs all configured linters.", |
@@ -522,6 +533,8 @@ func runTool(workDirectory string, toolName string, args []string, outputFile st |
522 | 533 | return runLizardAnalysis(workDirectory, args, outputFile, outputFormat) |
523 | 534 | case "codacy-enigma-cli": |
524 | 535 | return runEnigmaAnalysis(workDirectory, args, outputFile, outputFormat) |
| 536 | + case "gosec": |
| 537 | + return runGosecAnalysis(workDirectory, args, outputFile, outputFormat) |
525 | 538 | default: |
526 | 539 | return fmt.Errorf("unsupported tool: %s", toolName) |
527 | 540 | } |
|
0 commit comments