Skip to content
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
32 changes: 26 additions & 6 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os/exec"
"path"
"regexp"
"strings"

"github.com/pkg/errors"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -45,10 +46,11 @@ const defaultBodySeparator = "---"

// Project contains the project level configuration
type Project struct {
Title *TitleConfig
Keywords []string
BodySeparator string
Remote string
Title *TitleConfig
Keywords []string
BodySeparator string
Remote string
IgnoredExtensions []string
}

func unreportedTodoRegexp(keyword string) string {
Expand Down Expand Up @@ -217,6 +219,19 @@ func (project Project) WalkTodosOfDir(dirpath string, visit func(Todo) error) er
continue
}

isIgnored := false

for _, extension := range project.IgnoredExtensions {
if strings.HasSuffix(filepath, extension) {
isIgnored = true
break
}
}

if isIgnored {
continue
}

err = project.WalkTodosOfFile(filepath, visit)
if err != nil {
return err
Expand Down Expand Up @@ -244,8 +259,9 @@ func NewProject(filePath string) (*Project, error) {
Title: &TitleConfig{
Transforms: []*TransformRule{},
},
Keywords: []string{},
BodySeparator: defaultBodySeparator,
Keywords: []string{},
BodySeparator: defaultBodySeparator,
IgnoredExtensions: []string{},
}

if configPath, ok := yamlConfigPath(filePath); ok {
Expand All @@ -266,5 +282,9 @@ func NewProject(filePath string) (*Project, error) {
project.Keywords = []string{"TODO"}
}

if len(project.IgnoredExtensions) == 0 {
project.IgnoredExtensions = []string{".exe", ".dll", ".so"}
}

return project, nil
}