Skip to content

Commit 2451cb4

Browse files
committed
chore: Expanding lll coverage to tflint
1 parent 1efbff9 commit 2451cb4

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ linters:
114114
# trying to get this merged in.
115115
- linters:
116116
- lll
117-
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|exec|find|help|list|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/runner/(common|graph|run/creds)/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/placeholders|writer)/)'
117+
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|exec|find|help|list|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/runner/(common|graph|run/creds)/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tflint/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/placeholders|writer)/)'
118118
paths:
119119
- docs
120120
- _ci

internal/tflint/tflint.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ const (
3737
)
3838

3939
// RunTflintWithOpts runs tflint with the given options and returns an error if there are any issues.
40-
func RunTflintWithOpts(ctx context.Context, l log.Logger, opts *TFLintOptions, cfg *runcfg.RunConfig, hook *runcfg.Hook) error {
40+
func RunTflintWithOpts(
41+
ctx context.Context,
42+
l log.Logger,
43+
opts *TFLintOptions,
44+
cfg *runcfg.RunConfig,
45+
hook *runcfg.Hook,
46+
) error {
4147
hookExecute := slices.Clone(hook.Execute)
4248
hookExecute = slices.DeleteFunc(hookExecute, func(arg string) bool {
4349
return arg == tfExternalTFLint
@@ -49,7 +55,8 @@ func RunTflintWithOpts(ctx context.Context, l log.Logger, opts *TFLintOptions, c
4955
return err
5056
}
5157

52-
l.Debugf("Using .tflint.hcl file in %s", util.RelPathForLog(opts.RootWorkingDir, configFile, opts.Writers.LogShowAbsPaths))
58+
l.Debugf("Using .tflint.hcl file in %s",
59+
util.RelPathForLog(opts.RootWorkingDir, configFile, opts.Writers.LogShowAbsPaths))
5360

5461
variables, err := InputsToTflintVar(cfg.Inputs)
5562
if err != nil {
@@ -235,8 +242,9 @@ func tfArgumentsToTflintVar(l log.Logger, hook *runcfg.Hook,
235242
return variables, nil
236243
}
237244

238-
// findTflintConfigInProject looks for a .tflint.hcl file in the current folder or it's parents.
239-
// When running from cache, we start searching from the original config directory to find config in the source directory.
245+
// findTflintConfigInProject looks for a .tflint.hcl file in the current
246+
// folder or it's parents. When running from cache, we start searching
247+
// from the original config directory to find config in the source directory.
240248
func findTflintConfigInProject(l log.Logger, opts *TFLintOptions) (string, error) {
241249
startDir := opts.WorkingDir
242250
if opts.TerragruntConfigPath != "" {
@@ -259,7 +267,9 @@ func findTflintConfigInProject(l log.Logger, opts *TFLintOptions) (string, error
259267

260268
fileToFind := filepath.Join(previousDir, ".tflint.hcl")
261269
if util.FileExists(fileToFind) {
262-
l.Debugf("Found .tflint.hcl in %s", util.RelPathForLog(opts.RootWorkingDir, fileToFind, opts.Writers.LogShowAbsPaths))
270+
l.Debugf("Found .tflint.hcl in %s",
271+
util.RelPathForLog(opts.RootWorkingDir, fileToFind, opts.Writers.LogShowAbsPaths))
272+
263273
return fileToFind, nil
264274
}
265275

0 commit comments

Comments
 (0)