Skip to content

Commit

Permalink
Add an --errors-only command line option
Browse files Browse the repository at this point in the history
When set, only errors (and not warnings) will be reported.
  • Loading branch information
jparise committed Jun 4, 2021
1 parent aa77094 commit e592a29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ usage: thriftcheck [options] [file ...]
include path (can be specified multiple times)
-c, --config string
configuration file path (default "thriftcheck.toml")
--errors-only
only report errors (not warnings)
-h, --help
show command help
-l, --list
Expand Down
4 changes: 4 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var (
revision = "dev"
includes Includes
configFile = flag.String("c", "thriftcheck.toml", "configuration file path")
errorsOnly = flag.Bool("errors-only", false, "only report errors (not warnings)")
helpFlag = flag.Bool("h", false, "show command help")
listFlag = flag.Bool("l", false, "list all available checks and exit")
stdinFilename = flag.String("stdin-filename", "stdin", "filename used when piping from stdin")
Expand Down Expand Up @@ -185,6 +186,9 @@ func main() {
// Print any messages reported by the linter
status := 0
for _, m := range messages {
if *errorsOnly && m.Severity != thriftcheck.Error {
continue
}
fmt.Println(m)
status |= 1 << uint(m.Severity)
}
Expand Down

0 comments on commit e592a29

Please sign in to comment.