-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement -ignore #11
Conversation
if len(*ignore) == 0 { | ||
return false | ||
} | ||
match, err := regexp.MatchString(*ignore, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should really use regexp.MustCompile here or manually panic on error. This currently behaves badly on malformed regexes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this can be misleading: fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to fix this?
EDIT: ah, you're manually panicking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you should probably implement the flag.Value
interface for a regexp while you're here.
} | ||
match, err := regexp.MatchString(*ignore, path) | ||
if err != nil { | ||
log.Fatal(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like exitError
is used elsewhere
nevermind, that was an old rev
LGTM. @fzipp any chance of merging this? |
You can also use something like:
|
Why this still isn't merged ? |
Hi! I'm working on the alternative for this project https://github.com/bkielbasa/cyclop |
Fixed by 4a36b7d |
This PR implements the possibility to ignore files that match the given regular expression.
Fixes #9, #4 (generic approach).
Example: