@@ -138,13 +138,14 @@ func configFileTemplate(tools []tools.Tool) string {
138138 // Track needed runtimes
139139 needsNode := false
140140 needsPython := false
141-
141+ needsDart := false
142142 // Default versions
143143 defaultVersions := map [string ]string {
144- ESLint : "9.3.0" ,
145- Trivy : "0.59.1" ,
146- PyLint : "3.3.6" ,
147- PMD : "6.55.0" ,
144+ ESLint : "9.3.0" ,
145+ Trivy : "0.59.1" ,
146+ PyLint : "3.3.6" ,
147+ PMD : "6.55.0" ,
148+ DartAnalyzer : "3.7.2" ,
148149 }
149150
150151 // Build map of enabled tools with their versions
@@ -161,6 +162,8 @@ func configFileTemplate(tools []tools.Tool) string {
161162 needsNode = true
162163 } else if tool .Uuid == PyLint {
163164 needsPython = true
165+ } else if tool .Uuid == DartAnalyzer {
166+ needsDart = true
164167 }
165168 }
166169
@@ -176,10 +179,14 @@ func configFileTemplate(tools []tools.Tool) string {
176179 if needsPython {
177180 sb .WriteString (" - python@3.11.11\n " )
178181 }
182+ if needsDart {
183+ sb .WriteString (" - dart@3.7.2\n " )
184+ }
179185 } else {
180186 // In local mode with no tools specified, include all runtimes
181187 sb .WriteString (" - node@22.2.0\n " )
182188 sb .WriteString (" - python@3.11.11\n " )
189+ sb .WriteString (" - dart@3.7.2\n " )
183190 }
184191
185192 sb .WriteString ("tools:\n " )
@@ -188,10 +195,11 @@ func configFileTemplate(tools []tools.Tool) string {
188195 if len (tools ) > 0 {
189196 // Add only the tools that are in the API response (enabled tools)
190197 uuidToName := map [string ]string {
191- ESLint : "eslint" ,
192- Trivy : "trivy" ,
193- PyLint : "pylint" ,
194- PMD : "pmd" ,
198+ ESLint : "eslint" ,
199+ Trivy : "trivy" ,
200+ PyLint : "pylint" ,
201+ PMD : "pmd" ,
202+ DartAnalyzer : "dartanalyzer" ,
195203 }
196204
197205 for uuid , name := range uuidToName {
@@ -205,6 +213,7 @@ func configFileTemplate(tools []tools.Tool) string {
205213 sb .WriteString (fmt .Sprintf (" - trivy@%s\n " , defaultVersions [Trivy ]))
206214 sb .WriteString (fmt .Sprintf (" - pylint@%s\n " , defaultVersions [PyLint ]))
207215 sb .WriteString (fmt .Sprintf (" - pmd@%s\n " , defaultVersions [PMD ]))
216+ sb .WriteString (fmt .Sprintf (" - dartanalyzer@%s\n " , defaultVersions [DartAnalyzer ]))
208217 }
209218
210219 return sb .String ()
@@ -380,6 +389,13 @@ func createToolFileConfigurations(tool tools.Tool, patternConfiguration []domain
380389 }
381390 }
382391 fmt .Println ("Pylint configuration created based on Codacy settings" )
392+ case DartAnalyzer :
393+ if len (patternConfiguration ) > 0 {
394+ err := createDartAnalyzerConfigFile (patternConfiguration , toolsConfigDir )
395+ if err != nil {
396+ return fmt .Errorf ("failed to create Dart Analyzer config: %v" , err )
397+ }
398+ }
383399 }
384400 return nil
385401}
@@ -414,6 +430,12 @@ func createTrivyConfigFile(config []domain.PatternConfiguration, toolsConfigDir
414430 return os .WriteFile (filepath .Join (toolsConfigDir , "trivy.yaml" ), []byte (trivyConfigurationString ), utils .DefaultFilePerms )
415431}
416432
433+ func createDartAnalyzerConfigFile (config []domain.PatternConfiguration , toolsConfigDir string ) error {
434+
435+ dartAnalyzerConfigurationString := tools .CreateDartAnalyzerConfig (config )
436+ return os .WriteFile (filepath .Join (toolsConfigDir , "analysis_options.yaml" ), []byte (dartAnalyzerConfigurationString ), utils .DefaultFilePerms )
437+ }
438+
417439// createDefaultTrivyConfigFile creates a default trivy.yaml configuration file
418440func createDefaultTrivyConfigFile (toolsConfigDir string ) error {
419441 // Use empty tool configuration to get default settings
@@ -462,8 +484,9 @@ func cleanConfigDirectory(toolsConfigDir string) error {
462484}
463485
464486const (
465- ESLint string = "f8b29663-2cb2-498d-b923-a10c6a8c05cd"
466- Trivy string = "2fd7fbe0-33f9-4ab3-ab73-e9b62404e2cb"
467- PMD string = "9ed24812-b6ee-4a58-9004-0ed183c45b8f"
468- PyLint string = "31677b6d-4ae0-4f56-8041-606a8d7a8e61"
487+ ESLint string = "f8b29663-2cb2-498d-b923-a10c6a8c05cd"
488+ Trivy string = "2fd7fbe0-33f9-4ab3-ab73-e9b62404e2cb"
489+ PMD string = "9ed24812-b6ee-4a58-9004-0ed183c45b8f"
490+ PyLint string = "31677b6d-4ae0-4f56-8041-606a8d7a8e61"
491+ DartAnalyzer string = "d203d615-6cf1-41f9-be5f-e2f660f7850f"
469492)
0 commit comments