Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
simar7 committed Sep 26, 2024
1 parent b8ec16b commit 46db9bf
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions pkg/fanal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (
"path/filepath"
"strings"

"github.com/aquasecurity/trivy/pkg/log"
xio "github.com/aquasecurity/trivy/pkg/x/io"
"github.com/bmatcuk/doublestar/v4"
"github.com/samber/lo"

"github.com/aquasecurity/trivy/pkg/log"
xio "github.com/aquasecurity/trivy/pkg/x/io"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/walker/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"path/filepath"
"strings"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"golang.org/x/xerrors"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"github.com/aquasecurity/trivy/pkg/log"
xio "github.com/aquasecurity/trivy/pkg/x/io"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/fanal/walker/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"slices"
"strings"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"github.com/masahiro331/go-disk"
diskFs "github.com/masahiro331/go-disk/fs"
"github.com/masahiro331/go-disk/gpt"
Expand All @@ -18,6 +17,7 @@ import (
"github.com/masahiro331/go-xfs-filesystem/xfs"
"golang.org/x/xerrors"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"github.com/aquasecurity/trivy/pkg/fanal/vm/filesystem"
"github.com/aquasecurity/trivy/pkg/log"
xio "github.com/aquasecurity/trivy/pkg/x/io"
Expand Down
6 changes: 3 additions & 3 deletions pkg/fanal/walker/walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/aquasecurity/trivy/pkg/fanal/walker"
"github.com/aquasecurity/trivy/pkg/fanal/utils"
)

func TestSkipFile(t *testing.T) {
Expand Down Expand Up @@ -64,7 +64,7 @@ func TestSkipFile(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
for file, want := range tt.wants {
file = filepath.ToSlash(filepath.Clean(file))
got := utils.SkipPath(file, walker.CleanSkipPaths(tt.skipFiles))
got := utils.SkipPath(file, utils.CleanSkipPaths(tt.skipFiles))
assert.Equal(t, want, got, fmt.Sprintf("skipFiles: %s, file: %s", tt.skipFiles, file))
}
})
Expand Down Expand Up @@ -138,7 +138,7 @@ func TestSkipDir(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
for dir, want := range tt.wants {
dir = filepath.ToSlash(filepath.Clean(dir))
got := utils.SkipPath(dir, walker.CleanSkipPaths(tt.skipDirs))
got := utils.SkipPath(dir, utils.CleanSkipPaths(tt.skipDirs))
assert.Equal(t, want, got, fmt.Sprintf("defaultSkipDirs: %s, dir: %s", tt.skipDirs, dir))
}
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/iac/scanners/terraform/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"sort"
"strings"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hclparse"
"github.com/zclconf/go-cty/cty"

"github.com/aquasecurity/trivy/pkg/fanal/utils"
"github.com/aquasecurity/trivy/pkg/iac/ignore"
"github.com/aquasecurity/trivy/pkg/iac/terraform"
tfcontext "github.com/aquasecurity/trivy/pkg/iac/terraform/context"
Expand Down
4 changes: 2 additions & 2 deletions pkg/iac/scanners/terraform/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ resource "aws_iam_policy" "bad_configuration" {
results, err := scanner.ScanFS(context.TODO(), fs, "deployments")
require.NoError(t, err)

assert.Len(t, results, 0)
assert.Empty(t, results)
})

t.Run("use skip-files option", func(t *testing.T) {
Expand All @@ -1189,7 +1189,7 @@ resource "aws_iam_policy" "bad_configuration" {
results, err := scanner.ScanFS(context.TODO(), fs, "deployments")
require.NoError(t, err)

assert.Len(t, results, 0)
assert.Empty(t, results)
})

}

0 comments on commit 46db9bf

Please sign in to comment.