Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/misspell/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var (
debug *log.Logger

version = "dev"

gitignoreS, _ = misspell.ReadTextFile(".gitignore")
gitignoreL = strings.Split(gitignoreS, "\n")
)

const (
Expand Down Expand Up @@ -302,6 +305,21 @@ func main() {
for _, filename := range args {
filepath.Walk(filename, func(path string, info os.FileInfo, err error) error {
if err == nil && !info.IsDir() {
for _, item := range gitignoreL {
if len(item) == 0 {
continue
}
if item[0] == '/' {
// use prefix for absolute paths
if strings.HasPrefix("/"+path, item) {
return nil
}
} else {
if strings.Contains("/"+path, item) {
return nil
}
}
}
c <- path
}
return nil
Expand Down