Skip to content

[autofix.ci] apply automated fixes

Sign in for the full log view
GitHub Actions / golangci failed Feb 21, 2025 in 1s

reviewdog [golangci] report

reported by reviewdog 🐶

Findings (52)

pkg/config/import_test.go|16 col 9| G306: Expect WriteFile permissions to be 0600 or less (gosec)
pkg/config/import_test.go|38 col 8| G306: Expect WriteFile permissions to be 0600 or less (gosec)
pkg/config/import_test.go|42 col 8| G306: Expect WriteFile permissions to be 0600 or less (gosec)
pkg/config/import_test.go|47 col 8| G306: Expect WriteFile permissions to be 0600 or less (gosec)
pkg/config/import_test.go|54 col 8| G306: Expect WriteFile permissions to be 0600 or less (gosec)
pkg/config/imports.go|128 col 65| add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
pkg/config/load.go|242 col 68| add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
pkg/config/imports.go|148 col 50| add-constant: string literal "import" appears, at least, 4 times, create a named constant for it (revive)
pkg/config/load.go|250 col 43| add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
pkg/config/imports.go|173 col 52| add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
pkg/config/load.go|26 col 1| cyclomatic: function LoadConfig has cyclomatic complexity 13 (> max enabled 10) (revive)
pkg/config/utils.go|800| file-length-limit: file length is 667 lines, which exceeds the limit of 500 (revive)
pkg/config/imports.go|68 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("base_Path required to process imports")" (err113)
pkg/config/imports.go|71 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("tempDir required to process imports")" (err113)
pkg/config/imports.go|74 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("maximum import depth of %d exceeded", maxDepth)" (err113)
pkg/config/imports.go|78 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("failed to resolve base path: %v", err)" (err113)
pkg/config/imports.go|117 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("unsupported URL '%s': %v", importPath, err)" (err113)
pkg/config/imports.go|129 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("failed to read remote config")" (err113)
pkg/config/imports.go|149 col 16| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("failed to process nested imports")" (err113)
pkg/config/imports.go|160 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("import_path required to process imports")" (err113)
pkg/config/imports.go|174 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("failed to resolve local import path")" (err113)
pkg/config/imports.go|283 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("no valid absolute paths found")" (err113)
pkg/config/imports.go|373 col 15| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("no files matching patterns found")" (err113)
pkg/config/load.go|226 col 10| do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf("atmos config directory not found path %s", dirPath)" (err113)
pkg/config/imports.go|250 col 24| filepathJoin: "/*.yaml" contains a path separator (gocritic)
pkg/config/imports.go|251 col 24| filepathJoin: "
/.yml" contains a path separator (gocritic)
pkg/config/imports.go|36 col 27| hugeParam: source is heavy (5776 bytes); consider passing it by pointer (gocritic)
pkg/config/load.go|230 col 58| filepathJoin: "atmos.d/**/
" contains a path separator (gocritic)
pkg/config/load.go|239 col 57| filepathJoin: ".atmos.d/**/*" contains a path separator (gocritic)
pkg/config/import_test.go|115 col 3| ifElseChain: rewrite if-else to switch statement (gocritic)
pkg/config/imports.go|27 col 1| Comment should end in a period (godot)
pkg/config/imports.go|108 col 1| Comment should end in a period (godot)
pkg/config/imports.go|113 col 1| Comment should end in a period (godot)
pkg/config/imports.go|157 col 1| Comment should end in a period (godot)
pkg/config/imports.go|213 col 1| Sentence should start with a capital letter (godot)
pkg/config/imports.go|241 col 1| Comment should end in a period (godot)
pkg/config/imports.go|270 col 1| Comment should end in a period (godot)
pkg/config/imports.go|289 col 1| Sentence should start with a capital letter (godot)
pkg/config/imports.go|360 col 1| Comment should end in a period (godot)
pkg/config/load.go|20 col 1| Comment should end in a period (godot)
pkg/config/load.go|100 col 1| Comment should end in a period (godot)
pkg/config/load.go|124 col 1| Comment should end in a period (godot)
pkg/config/load.go|144 col 1| Comment should end in a period (godot)
pkg/config/load.go|198 col 1| Comment should end in a period (godot)
pkg/config/import_test.go|20 col 1| Comment should end in a period (godot)
pkg/config/imports.go|145 col 5| S1009: should omit nil check; len() for nil slices is defined as zero (gosimple)
pkg/config/imports.go|13 col 2| import "github.com/charmbracelet/log" imported without alias but must be with alias "log" according to config (importas)
pkg/config/load.go|11 col 2| import "github.com/charmbracelet/log" imported without alias but must be with alias "log" according to config (importas)
pkg/config/imports.go|37 col 1| if len(source.Import) > 0 has complex nested blocks (complexity: 4) (nestif)
pkg/config/imports.go|242 col 47| generatePatterns - result 1 (error) is always nil (unparam)
pkg/config/load.go|199 col 47| mergeConfig - fileName always receives CliConfigFileName ("atmos") (unparam)
pkg/config/load.go|255 col 2| unnecessary trailing newline (whitespace)

Filtered Findings (0)

Annotations

Check failure on line 16 in pkg/config/import_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/import_test.go#L16

G306: Expect WriteFile permissions to be 0600 or less (gosec)
Raw output
pkg/config/import_test.go:16:9: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err := os.WriteFile(filePath, []byte(content), 0o644)
	       ^

Check failure on line 38 in pkg/config/import_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/import_test.go#L38

G306: Expect WriteFile permissions to be 0600 or less (gosec)
Raw output
pkg/config/import_test.go:38:8: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err = os.WriteFile(configFile1, []byte("key1: value1"), 0o644)
	      ^

Check failure on line 42 in pkg/config/import_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/import_test.go#L42

G306: Expect WriteFile permissions to be 0600 or less (gosec)
Raw output
pkg/config/import_test.go:42:8: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err = os.WriteFile(configFile2, []byte("key2: value2"), 0o644)
	      ^

Check failure on line 47 in pkg/config/import_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/import_test.go#L47

G306: Expect WriteFile permissions to be 0600 or less (gosec)
Raw output
pkg/config/import_test.go:47:8: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err = os.WriteFile(localFile, []byte("key3: value3"), 0o644)
	      ^

Check failure on line 54 in pkg/config/import_test.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/import_test.go#L54

G306: Expect WriteFile permissions to be 0600 or less (gosec)
Raw output
pkg/config/import_test.go:54:8: G306: Expect WriteFile permissions to be 0600 or less (gosec)
	err = os.WriteFile(configFile3, []byte("key4: value4"), 0o644)
	      ^

Check failure on line 128 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L128

add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
Raw output
pkg/config/imports.go:128:65: add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
		log.Debug("failed to read remote config", "path", importPath, "error", err)
		                                                              ^

Check failure on line 242 in pkg/config/load.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/load.go#L242

add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
Raw output
pkg/config/load.go:242:68: add-constant: string literal "error" appears, at least, 4 times, create a named constant for it (revive)
		log.Debug("Failed to find atmos config file", "path", searchDir, "error", err)
		                                                                 ^

Check failure on line 148 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L148

add-constant: string literal "import" appears, at least, 4 times, create a named constant for it (revive)
Raw output
pkg/config/imports.go:148:50: add-constant: string literal "import" appears, at least, 4 times, create a named constant for it (revive)
			log.Debug("failed to process nested imports", "import", importPath, "err", err)
			                                              ^

Check failure on line 250 in pkg/config/load.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/load.go#L250

add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
Raw output
pkg/config/load.go:250:43: add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
			log.Debug("error loading config file", "path", filePath, "error", err)
			                                       ^

Check failure on line 173 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L173

add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
Raw output
pkg/config/imports.go:173:52: add-constant: string literal "path" appears, at least, 4 times, create a named constant for it (revive)
		log.Debug("failed to resolve local import path", "path", importPath, "err", err)
		                                                 ^

Check failure on line 26 in pkg/config/load.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/load.go#L26

cyclomatic: function LoadConfig has cyclomatic complexity 13 (> max enabled 10) (revive)
Raw output
pkg/config/load.go:26:1: cyclomatic: function LoadConfig has cyclomatic complexity 13 (> max enabled 10) (revive)
func LoadConfig(configAndStacksInfo schema.ConfigAndStacksInfo) (schema.AtmosConfiguration, error) {
	v := viper.New()
	var atmosConfig schema.AtmosConfiguration
	v.SetConfigType("yaml")
	v.SetTypeByDefaultValue(true)
	setDefaultConfiguration(v)
	err := readSystemConfig(v)
	if err != nil {
		return atmosConfig, err
	}

	err = readHomeConfig(v)
	if err != nil {
		return atmosConfig, err
	}

	err = readWorkDirConfig(v)
	if err != nil {
		return atmosConfig, err
	}
	err = readEnvAmosConfigPath(v)
	if err != nil {
		return atmosConfig, err
	}
	err = readAtmosConfigCli(v, configAndStacksInfo.AtmosCliConfigPath)
	if err != nil {
		return atmosConfig, err
	}

	atmosConfig.CliConfigPath = v.ConfigFileUsed()

	if atmosConfig.CliConfigPath == "" {
		log.Debug("'atmos.yaml' CLI config was not found", "paths", "system dir, home dir, current dir, ENV vars")
		log.Debug("Refer to https://atmos.tools/cli/configuration for details on how to configure 'atmos.yaml'")
		log.Debug("Using the default CLI config")
		j, err := json.Marshal(defaultCliConfig)
		if err != nil {
			return atmosConfig, err
		}
		reader := bytes.NewReader(j)
		err = v.MergeConfig(reader)
		if err != nil {
			return atmosConfig, err
		}
	}
	// Set the CLI config path in the atmosConfig struct
	if atmosConfig.CliConfigPath != "" && !filepath.IsAbs(atmosConfig.CliConfigPath) {
		absPath, err := filepath.Abs(atmosConfig.CliConfigPath)
		if err != nil {
			return atmosConfig, err
		}
		atmosConfig.CliConfigPath = absPath
	}
	// We want the editorconfig color by default to be true
	atmosConfig.Validate.EditorConfig.Color = true
	// https://gist.github.com/chazcheadle/45bf85b793dea2b71bd05ebaa3c28644
	// https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/
	err = v.Unmarshal(&atmosConfig)
	if err != nil {
		return atmosConfig, err
	}
	return atmosConfig, nil
}

Check failure on line 800 in pkg/config/utils.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/utils.go#L800

file-length-limit: file length is 667 lines, which exceeds the limit of 500 (revive)
Raw output
pkg/config/utils.go:800: file-length-limit: file length is 667 lines, which exceeds the limit of 500 (revive)

Check failure on line 68 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L68

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"base_Path required to process imports\")" (err113)
Raw output
pkg/config/imports.go:68:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"base_Path required to process imports\")" (err113)
		return nil, fmt.Errorf("base_Path required to process imports")
		            ^

Check failure on line 71 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L71

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"tempDir required to process imports\")" (err113)
Raw output
pkg/config/imports.go:71:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"tempDir required to process imports\")" (err113)
		return nil, fmt.Errorf("tempDir required to process imports")
		            ^

Check failure on line 74 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L74

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"maximum import depth of %d exceeded\", maxDepth)" (err113)
Raw output
pkg/config/imports.go:74:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"maximum import depth of %d exceeded\", maxDepth)" (err113)
		return nil, fmt.Errorf("maximum import depth of %d exceeded", maxDepth)
		            ^

Check failure on line 78 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L78

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to resolve base path: %v\", err)" (err113)
Raw output
pkg/config/imports.go:78:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to resolve base path: %v\", err)" (err113)
		return nil, fmt.Errorf("failed to resolve base path: %v", err)
		            ^

Check failure on line 117 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L117

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"unsupported URL '%s': %v\", importPath, err)" (err113)
Raw output
pkg/config/imports.go:117:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"unsupported URL '%s': %v\", importPath, err)" (err113)
		return nil, fmt.Errorf("unsupported URL '%s': %v", importPath, err)
		            ^

Check failure on line 129 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L129

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to read remote config\")" (err113)
Raw output
pkg/config/imports.go:129:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to read remote config\")" (err113)
		return nil, fmt.Errorf("failed to read remote config")
		            ^

Check failure on line 149 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L149

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to process nested imports\")" (err113)
Raw output
pkg/config/imports.go:149:16: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to process nested imports\")" (err113)
			return nil, fmt.Errorf("failed to process nested imports")
			            ^

Check failure on line 160 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L160

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"import_path required to process imports\")" (err113)
Raw output
pkg/config/imports.go:160:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"import_path required to process imports\")" (err113)
		return nil, fmt.Errorf("import_path required to process imports")
		            ^

Check failure on line 174 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L174

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to resolve local import path\")" (err113)
Raw output
pkg/config/imports.go:174:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"failed to resolve local import path\")" (err113)
		return nil, fmt.Errorf("failed to resolve local import path")
		            ^

Check failure on line 283 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L283

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"no valid absolute paths found\")" (err113)
Raw output
pkg/config/imports.go:283:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"no valid absolute paths found\")" (err113)
		return nil, fmt.Errorf("no valid absolute paths found")
		            ^

Check failure on line 373 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L373

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"no files matching patterns found\")" (err113)
Raw output
pkg/config/imports.go:373:15: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"no files matching patterns found\")" (err113)
		return nil, fmt.Errorf("no files matching patterns found")
		            ^

Check failure on line 226 in pkg/config/load.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/load.go#L226

do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"atmos config directory not found path %s\", dirPath)" (err113)
Raw output
pkg/config/load.go:226:10: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"atmos config directory not found path %s\", dirPath)" (err113)
		return fmt.Errorf("atmos config directory not found path %s", dirPath)
		       ^

Check failure on line 250 in pkg/config/imports.go

See this annotation in the file changed.

@github-actions github-actions / golangci

[golangci] pkg/config/imports.go#L250

filepathJoin: "**/*.yaml" contains a path separator (gocritic)
Raw output
pkg/config/imports.go:250:24: filepathJoin: "**/*.yaml" contains a path separator (gocritic)
			filepath.Join(path, "**/*.yaml"),
			                    ^