Skip to content

Commit 5e3a2d0

Browse files
committed
fix indentation
1 parent 21e6e35 commit 5e3a2d0

File tree

5 files changed

+87
-87
lines changed

5 files changed

+87
-87
lines changed

cmd/configsetup/codacy_yaml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func getToolVersion(tool domain.Tool, defaultVersions map[string]string) string
6666

6767
// addRequiredRuntime adds the runtime requirement for a tool.
6868
func addRequiredRuntime(toolUUID string, neededRuntimes map[string]bool, runtimeDependencies map[string]string) {
69-
if meta, ok := domain.SupportedToolsMetadata[toolUUID]; ok {
69+
if meta, ok := domain.SupportedToolsMetadata[toolUUID]; ok {
7070
if runtime, ok := runtimeDependencies[meta.Name]; ok {
7171
if meta.Name == "dartanalyzer" {
7272
// For dartanalyzer, default to dart runtime

cmd/configsetup/config_creators.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func CreateConfigurationFiles(tools []domain.Tool, cliLocalMode bool, flags doma
6565

6666
// buildCliConfigContent creates the CLI configuration content.
6767
func buildCliConfigContent(cliLocalMode bool, initFlags domain.InitFlags) string {
68-
if cliLocalMode {
69-
return fmt.Sprintf("mode: local")
70-
}
71-
return fmt.Sprintf("mode: remote\nprovider: %s\norganization: %s\nrepository: %s", initFlags.Provider, initFlags.Organization, initFlags.Repository)
68+
if cliLocalMode {
69+
return fmt.Sprintf("mode: local")
70+
}
71+
return fmt.Sprintf("mode: remote\nprovider: %s\norganization: %s\nrepository: %s", initFlags.Provider, initFlags.Organization, initFlags.Repository)
7272
}

cmd/configsetup/default_config.go

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,72 @@
33
package configsetup
44

55
import (
6-
"fmt"
7-
"log"
8-
"strings"
9-
10-
codacyclient "codacy/cli-v2/codacy-client"
11-
"codacy/cli-v2/config"
12-
"codacy/cli-v2/domain"
13-
"codacy/cli-v2/plugins"
14-
"codacy/cli-v2/tools"
6+
"fmt"
7+
"log"
8+
"strings"
9+
10+
codacyclient "codacy/cli-v2/codacy-client"
11+
"codacy/cli-v2/config"
12+
"codacy/cli-v2/domain"
13+
"codacy/cli-v2/plugins"
14+
"codacy/cli-v2/tools"
1515
)
1616

1717
// KeepToolsWithLatestVersion filters the tools to keep only the latest
1818
// version of each tool family.
1919
func KeepToolsWithLatestVersion(tools []domain.Tool) (
20-
toolsWithLatestVersion []domain.Tool,
21-
uuidToName map[string]string,
22-
familyToVersions map[string][]string,
20+
toolsWithLatestVersion []domain.Tool,
21+
uuidToName map[string]string,
22+
familyToVersions map[string][]string,
2323
) {
24-
latestTools := map[string]domain.Tool{}
25-
uuidToName = map[string]string{}
26-
seen := map[string][]domain.Tool{}
24+
latestTools := map[string]domain.Tool{}
25+
uuidToName = map[string]string{}
26+
seen := map[string][]domain.Tool{}
2727

28-
for _, tool := range tools {
29-
processToolForLatest(tool, latestTools, uuidToName, seen)
30-
}
28+
for _, tool := range tools {
29+
processToolForLatest(tool, latestTools, uuidToName, seen)
30+
}
3131

32-
familyToVersions = buildFamilyVersionMap(seen)
32+
familyToVersions = buildFamilyVersionMap(seen)
3333

34-
for _, tool := range latestTools {
35-
toolsWithLatestVersion = append(toolsWithLatestVersion, tool)
36-
}
34+
for _, tool := range latestTools {
35+
toolsWithLatestVersion = append(toolsWithLatestVersion, tool)
36+
}
3737

38-
return
38+
return
3939
}
4040

4141
// processToolForLatest updates the latest tool per family and tracking maps.
4242
func processToolForLatest(tool domain.Tool, latestTools map[string]domain.Tool, uuidToName map[string]string, seen map[string][]domain.Tool) {
43-
meta, ok := domain.SupportedToolsMetadata[tool.Uuid]
44-
if !ok {
45-
return
46-
}
47-
48-
seen[meta.Name] = append(seen[meta.Name], tool)
49-
50-
current, exists := latestTools[meta.Name]
51-
if !exists || domain.SupportedToolsMetadata[current.Uuid].Priority > meta.Priority {
52-
latestTools[meta.Name] = tool
53-
uuidToName[tool.Uuid] = meta.Name
54-
}
43+
meta, ok := domain.SupportedToolsMetadata[tool.Uuid]
44+
if !ok {
45+
return
46+
}
47+
48+
seen[meta.Name] = append(seen[meta.Name], tool)
49+
50+
current, exists := latestTools[meta.Name]
51+
if !exists || domain.SupportedToolsMetadata[current.Uuid].Priority > meta.Priority {
52+
latestTools[meta.Name] = tool
53+
uuidToName[tool.Uuid] = meta.Name
54+
}
5555
}
5656

5757
// buildFamilyVersionMap builds a map of tool family to discovered versions.
5858
func buildFamilyVersionMap(seen map[string][]domain.Tool) map[string][]string {
59-
familyToVersions := make(map[string][]string)
60-
for family, tools := range seen {
61-
var versions []string
62-
for _, t := range tools {
63-
v := t.Version
64-
if v == "" {
65-
v = "(unknown)"
66-
}
67-
versions = append(versions, v)
68-
}
69-
familyToVersions[family] = versions
70-
}
71-
return familyToVersions
59+
familyToVersions := make(map[string][]string)
60+
for family, tools := range seen {
61+
var versions []string
62+
for _, t := range tools {
63+
v := t.Version
64+
if v == "" {
65+
v = "(unknown)"
66+
}
67+
versions = append(versions, v)
68+
}
69+
familyToVersions[family] = versions
70+
}
71+
return familyToVersions
7272
}
7373

7474
// BuildDefaultConfigurationFiles creates default configuration files for all tools.
@@ -103,12 +103,12 @@ func CreateConfigurationFilesForDiscoveredTools(discoveredToolNames map[string]s
103103
currentCliMode = "local" // Default to local
104104
}
105105

106-
if currentCliMode == "remote" && initFlags.ApiToken != "" {
107-
// Remote mode - create configurations based on cloud repository settings
108-
return createRemoteToolConfigurationsForDiscovered(discoveredToolNames, initFlags)
109-
}
110-
// Local mode - create default configurations for discovered tools
111-
return createDefaultConfigurationsForSpecificTools(discoveredToolNames, toolsConfigDir, initFlags)
106+
if currentCliMode == "remote" && initFlags.ApiToken != "" {
107+
// Remote mode - create configurations based on cloud repository settings
108+
return createRemoteToolConfigurationsForDiscovered(discoveredToolNames, initFlags)
109+
}
110+
// Local mode - create default configurations for discovered tools
111+
return createDefaultConfigurationsForSpecificTools(discoveredToolNames, toolsConfigDir, initFlags)
112112
}
113113

114114
// createRemoteToolConfigurationsForDiscovered creates tool configurations for remote mode based on cloud settings.
@@ -147,29 +147,29 @@ func createRemoteToolConfigurationsForDiscovered(discoveredToolNames map[string]
147147

148148
// selectCorrectToolUUID selects the correct UUID for a tool based on its version.
149149
func selectCorrectToolUUID(toolName string, defaultVersions map[string]string) string {
150-
version := defaultVersions[toolName]
151-
152-
switch toolName {
153-
case "pmd":
154-
if strings.HasPrefix(version, "7.") {
155-
return domain.PMD7
156-
}
157-
return domain.PMD
158-
case "eslint":
159-
if strings.HasPrefix(version, "9.") {
160-
return domain.ESLint9
161-
}
162-
return domain.ESLint
163-
}
164-
165-
// For other tools, find the first matching UUID
166-
for uuid, meta := range domain.SupportedToolsMetadata {
167-
if meta.Name == toolName {
168-
return uuid
169-
}
170-
}
171-
172-
return ""
150+
version := defaultVersions[toolName]
151+
152+
switch toolName {
153+
case "pmd":
154+
if strings.HasPrefix(version, "7.") {
155+
return domain.PMD7
156+
}
157+
return domain.PMD
158+
case "eslint":
159+
if strings.HasPrefix(version, "9.") {
160+
return domain.ESLint9
161+
}
162+
return domain.ESLint
163+
}
164+
165+
// For other tools, find the first matching UUID
166+
for uuid, meta := range domain.SupportedToolsMetadata {
167+
if meta.Name == toolName {
168+
return uuid
169+
}
170+
}
171+
172+
return ""
173173
}
174174

175175
// createDefaultConfigurationsForSpecificTools creates default configurations for specific tools only.

cmd/configsetup/repository_config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,18 @@ func createToolConfigurationFiles(tools []domain.Tool, flags domain.InitFlags) e
9494
// CreateToolConfigurationFile generates a configuration file for a single tool.
9595
func CreateToolConfigurationFile(toolName string, flags domain.InitFlags) error {
9696
// Find the tool UUID by tool name
97-
toolUUID := getToolUUIDByName(toolName)
98-
if toolUUID == "" {
97+
toolUUID := getToolUUIDByName(toolName)
98+
if toolUUID == "" {
9999
return fmt.Errorf("tool '%s' not found in supported tools", toolName)
100100
}
101101

102-
patternsConfig, err := codacyclient.GetDefaultToolPatternsConfig(flags, toolUUID, true)
102+
patternsConfig, err := codacyclient.GetDefaultToolPatternsConfig(flags, toolUUID, true)
103103
if err != nil {
104104
return fmt.Errorf("failed to get default patterns: %w", err)
105105
}
106106

107107
// Get the tool object to pass to createToolFileConfiguration
108-
tool := domain.Tool{Uuid: toolUUID}
108+
tool := domain.Tool{Uuid: toolUUID}
109109
return createToolFileConfiguration(tool, patternsConfig)
110110
}
111111

tools/lizard/lizardConfigCreator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func CreateLizardConfig(toolsConfigDir string, patterns []domain.PatternConfigur
2525
continue
2626
}
2727

28-
// if pattern.Parameters is empty, use pattermDefinition.Parameters
28+
// if pattern.Parameters is empty, use patternDefinition.Parameters
2929
parameters := pattern.Parameters
3030
if len(parameters) == 0 {
3131
parameters = patternDefinition.Parameters

0 commit comments

Comments
 (0)