You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Renamed `toolToAnalyze` to `toolsToAnalyzeParam` for clarity.
- Updated the logic to allow specifying a single tool for analysis or running all configured tools if none is specified.
- Improved error handling for cases with no configured tools.
Copy file name to clipboardExpand all lines: cmd/analyze.go
+15-12Lines changed: 15 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package cmd
2
2
3
3
import (
4
4
"codacy/cli-v2/config"
5
+
"codacy/cli-v2/plugins"
5
6
"codacy/cli-v2/tools"
6
7
"encoding/json"
7
8
"fmt"
@@ -17,7 +18,7 @@ import (
17
18
)
18
19
19
20
varoutputFilestring
20
-
vartoolToAnalyzestring
21
+
vartoolsToAnalyzeParamstring
21
22
varautoFixbool
22
23
varoutputFormatstring
23
24
varsarifPathstring
@@ -95,7 +96,7 @@ type Pattern struct {
95
96
96
97
funcinit() {
97
98
analyzeCmd.Flags().StringVarP(&outputFile, "output", "o", "", "Output file for analysis results")
98
-
analyzeCmd.Flags().StringVarP(&toolToAnalyze, "tool", "t", "", "Optional: Specific tool to run analysis with. If not specified, all configured tools will be run")
99
+
analyzeCmd.Flags().StringVarP(&toolsToAnalyzeParam, "tool", "t", "", "Which tool to run analysis with. If not specified, all configured tools will be run")
99
100
analyzeCmd.Flags().StringVar(&outputFormat, "format", "", "Output format (use 'sarif' for SARIF format)")
100
101
analyzeCmd.Flags().BoolVar(&autoFix, "fix", false, "Apply auto fix to your issues when available")
101
102
rootCmd.AddCommand(analyzeCmd)
@@ -234,17 +235,19 @@ var analyzeCmd = &cobra.Command{
234
235
iferr!=nil {
235
236
log.Fatal(err)
236
237
}
238
+
vartoolsToRunmap[string]*plugins.ToolInfo
237
239
238
-
// If a specific tool is specified, only run that tool
0 commit comments