Skip to content

Commit d3fff03

Browse files
refactor: integrate plugin system for tool configuration management
- Replace hardcoded tool list with dynamic retrieval of supported tools from the plugin system - Enhance error handling for tool retrieval process - Maintain versioning for tools based on defaultVersions mapping
1 parent fec7a17 commit d3fff03

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

cmd/init.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,18 @@ func configFileTemplate(tools []tools.Tool) string {
255255
} else {
256256
// If no tools were specified (local mode), include all tools in sorted order
257257
var sortedTools []string
258-
for _, name := range []string{
259-
"dartanalyzer",
260-
"eslint",
261-
"lizard",
262-
"pmd",
263-
"pylint",
264-
"semgrep",
265-
"trivy",
266-
} {
267-
if version, ok := defaultVersions[name]; ok {
268-
sortedTools = append(sortedTools, fmt.Sprintf("%s@%s", name, version))
258+
259+
// Get supported tools from plugin system
260+
supportedTools, err := plugins.GetSupportedTools()
261+
if err != nil {
262+
log.Printf("Warning: failed to get supported tools: %v", err)
263+
return sb.String()
264+
}
265+
266+
// Convert map keys to slice and sort them
267+
for toolName := range supportedTools {
268+
if version, ok := defaultVersions[toolName]; ok {
269+
sortedTools = append(sortedTools, fmt.Sprintf("%s@%s", toolName, version))
269270
}
270271
}
271272
sort.Strings(sortedTools)

0 commit comments

Comments
 (0)