Skip to content

Commit 13f913a

Browse files
authored
runner: clean Terraform source path for comparison (#999)
1 parent 81679ed commit 13f913a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

rules/terraformrules/terraform_standard_module_structure.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ func (r *TerraformStandardModuleStructureRule) checkFiles(runner *tflint.Runner)
6464
return
6565
}
6666

67-
files := runner.Files()
68-
for name, file := range files {
67+
f := runner.Files()
68+
files := make(map[string]*hcl.File, len(f))
69+
for name, file := range f {
6970
files[filepath.Base(name)] = file
7071
}
7172

73+
log.Printf("[DEBUG] %d files found: %v", len(files), files)
74+
7275
if files[filenameMain] == nil {
7376
runner.EmitIssue(
7477
r,

tflint/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ func (r *Runner) File(path string) *hcl.File {
245245
func (r *Runner) Files() map[string]*hcl.File {
246246
result := make(map[string]*hcl.File)
247247
for name, file := range r.files {
248-
if filepath.Dir(name) == r.TFConfig.Module.SourceDir {
248+
if filepath.Dir(name) == filepath.Clean(r.TFConfig.Module.SourceDir) {
249249
result[name] = file
250250
}
251251
}

0 commit comments

Comments
 (0)