ci: add depguard (#6963)

Signed-off-by: knqyf263 <knqyf263@gmail.com>
This commit is contained in:
Teppei Fukuda
2024-06-20 06:48:08 +04:00
committed by GitHub
parent dfe757e37a
commit 983ac15f22
73 changed files with 154 additions and 119 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/samber/lo"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"
"github.com/aquasecurity/trivy/internal/testutil"
)
@@ -43,7 +42,10 @@ module "this" {
source = "../modules/s3"
}`,
},
expected: []string{"code", "code/example"},
expected: []string{
"code",
"code/example",
},
},
{
name: "without module block",
@@ -51,7 +53,10 @@ module "this" {
"code/infra1/main.tf": `resource "test" "this" {}`,
"code/infra2/main.tf": `resource "test" "this" {}`,
},
expected: []string{"code/infra1", "code/infra2"},
expected: []string{
"code/infra1",
"code/infra2",
},
},
}
@@ -60,7 +65,7 @@ module "this" {
fsys := testutil.CreateFS(t, tt.files)
parser := New(fsys, "", OptionStopOnHCLError(true))
modules := lo.Map(maps.Keys(tt.files), func(p string, _ int) string {
modules := lo.Map(lo.Keys(tt.files), func(p string, _ int) string {
return path.Dir(p)
})