Skip to content

Commit

Permalink
fix(python): ignore dir name in component list
Browse files Browse the repository at this point in the history
  • Loading branch information
iseki0 committed May 11, 2024
1 parent f58217d commit 60107ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions module/python/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"github.com/murphysecurity/murphysec/infra/logctx"
"github.com/murphysecurity/murphysec/infra/pathignore"
"github.com/murphysecurity/murphysec/model"
"github.com/murphysecurity/murphysec/utils"
"github.com/repeale/fp-go"
"io/fs"
"os"
"path/filepath"
Expand Down Expand Up @@ -183,6 +185,14 @@ func collectDepsInfo(ctx context.Context, dir string) ([][2]string, error) {
for k, v := range versionedComps {
result = append(result, [2]string{k, v})
}
// remove component name that match a directory
result = fp.Filter(func(it [2]string) bool {
var p = it[0]
if p == "" {
return true
}
return !utils.IsDir(filepath.Join(dir, p))
})(result)

sort.Slice(result, func(i, j int) bool {
return result[i][0] < result[j][0] // sort by name is enough
Expand Down

0 comments on commit 60107ca

Please sign in to comment.