Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
caitlinelfring committed Aug 25, 2020
1 parent c6db4a2 commit ea2dbd8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ var (
debug bool
stdin bool

// Populated by goreleaser during build
// Version is populated by goreleaser during build
// Version...
Version = "main"
Commit = "000000"
Date = "today"
// Commit ...
Commit = "000000"
// Date ...
Date = "today"
)

// rootCmd represents the base command when called without any subcommands
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Config struct {
IgnoreFiles []string `yaml:"ignore_files"`
}

// NewConfig returns a new Config
func NewConfig(filename string) (*Config, error) {
var c Config
c.AddDefaultRules()
Expand Down
1 change: 1 addition & 0 deletions pkg/ignore/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var DefaultIgnores = []string{
".git",
}

// Ignore is a gitignore-style object to ignore files/directories
type Ignore struct {
compiled *gitignore.GitIgnore
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/parser/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/caitlinelfring/woke/pkg/util"
)

const defaultGlob = "**"
const defaultPath = "."

// Parsable contains the list of files that can be parsed
type Parsable struct {
Expand All @@ -16,7 +16,7 @@ type Parsable struct {
// excluded files that should be ignored
func ParsableFiles(fileGlobs []string, ignorer *ignore.Ignore) *Parsable {
if len(fileGlobs) == 0 {
fileGlobs = []string{defaultGlob}
fileGlobs = []string{defaultPath}
}

var p Parsable
Expand Down
1 change: 1 addition & 0 deletions pkg/util/contenttype.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func isTextFile(file *os.File) bool {
return strings.HasPrefix(contentType, "text/plain")
}

// IsTextFile returns an error if the file is not of content-type 'text/plain'
func IsTextFile(file *os.File) error {
if !isTextFile(file) {
return fmt.Errorf("%s is not a text file", file.Name())
Expand Down

0 comments on commit ea2dbd8

Please sign in to comment.