Skip to content

Commit

Permalink
Update scan.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sig-seg-v13 authored May 22, 2024
1 parent d0b7c56 commit b006c6e
Showing 1 changed file with 35 additions and 20 deletions.
55 changes: 35 additions & 20 deletions scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,42 @@ package main
import (
"io/fs"
"path/filepath"
"slices"
"strings"
)

var excludedFolders = []string{
"node_modules",
"vendor",
// ".git", // already excluded
".svn",
".hg",
".bzr",
"_vendor",
"godeps",
"thirdparty",
"bin",
"obj",
"testdata",
"examples",
"tmp",
"build",
// ...
// excludedFolders is a map of folder names (case-insensitive) to be excluded during the scan.
var excludedFolders = map[string]bool{
"node_modules": true,
"vendor": true,
".svn": true,
".hg": true,
".bzr": true,
"_vendor": true,
"godeps": true,
"bin": true,
"obj": true,
"tmp": true,
"build": true,
".vscode": true,
"dist": true,
"__pycache__": true,
".cache": true,
"coverage": true,
"target": true,
"out": true,
".idea": true,
".gradle": true,
".terraform": true,
"env": true,
".ds_store": true,
".next": true,
".nuxt": true,
".expo": true,
".circleci": true,
".github": true,
".gitlab": true,
".vagrant": true,
".serverless": true,
}

func scanGitFolders(root string) ([]string, error) {
Expand All @@ -39,8 +54,8 @@ func scanGitFolders(root string) ([]string, error) {
return filepath.SkipDir // Skip further traversal within this directory
}

// Skip dependency directories // not needed + will slow down the tool
if d.IsDir() && slices.Contains(excludedFolders, strings.ToLower(d.Name())) {
// Skip dependency directories
if d.IsDir() && excludedFolders[strings.ToLower(d.Name())] {
return filepath.SkipDir
}

Expand Down

0 comments on commit b006c6e

Please sign in to comment.