Skip to content

Commit

Permalink
(#39) Rename --subject-len -> --subject-maxlen (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
llorllale committed Mar 5, 2019
1 parent 16d34c2 commit 8ee76f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ $ ./gitlint --help
usage: gitlint [<flags>]
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--path="." Path to the git repo (default: ".").
--subject-regex=".*" Commit subject line must conform to this regular expression (default: ".*").
--subject-len=2147483646 Commit subject line cannot exceed this length (default: math.MaxInt32 - 1).
--body-regex=".*" Commit message body must conform to this regular expression (default: ".*").
--since="1970-01-01" A date in "yyyy-MM-dd" format starting from which commits will be analyzed (default: "1970-01-01").
--msg-file="" Only analyze the commit message found in this file (default: "").
--max-parents=1 Max number of parents a commit can have in order to be analyzed (default: 1). Useful for excluding merge commits.
--help Show context-sensitive help (also try --help-long and --help-man).
--path="." Path to the git repo (default: ".").
--subject-regex=".*" Commit subject line must conform to this regular expression (default: ".*").
--subject-maxlen=2147483646 Max length for commit subject line (default: math.MaxInt32 - 1).
--body-regex=".*" Commit message body must conform to this regular expression (default: ".*").
--since="1970-01-01" A date in "yyyy-MM-dd" format starting from which commits will be analyzed (default: "1970-01-01").
--msg-file="" Only analyze the commit message found in this file (default: "").
--max-parents=1 Max number of parents a commit can have in order to be analyzed (default: 1). Useful for excluding merge commits.
```
Additionally, it will look for configurations in a file `.gitlint` in the current directory if it exists. This file's format is just the same command line flags but each on a separate line. *Flags passed through the command line take precedence.*

Expand Down
16 changes: 8 additions & 8 deletions cmd/go-gitlint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import (
// Figure out a way to remove these global variables. Whatever command line
// parser we choose should be able to auto-generate usage.
var (
path = kingpin.Flag("path", `Path to the git repo (default: ".").`).Default(".").String() //nolint[gochecknoglobals]
subjectRegex = kingpin.Flag("subject-regex", `Commit subject line must conform to this regular expression (default: ".*").`).Default(".*").String() //nolint[gochecknoglobals]
subjectLength = kingpin.Flag("subject-len", "Commit subject line cannot exceed this length (default: math.MaxInt32 - 1).").Default(strconv.Itoa(math.MaxInt32 - 1)).Int() //nolint[gochecknoglobals]
bodyRegex = kingpin.Flag("body-regex", `Commit message body must conform to this regular expression (default: ".*").`).Default(".*").String() //nolint[gochecknoglobals]
since = kingpin.Flag("since", `A date in "yyyy-MM-dd" format starting from which commits will be analyzed (default: "1970-01-01").`).Default("1970-01-01").String() //nolint[gochecknoglobals]
msgFile = kingpin.Flag("msg-file", `Only analyze the commit message found in this file (default: "").`).Default("").String() //nolint[gochecknoglobals]
maxParents = kingpin.Flag("max-parents", `Max number of parents a commit can have in order to be analyzed (default: 1). Useful for excluding merge commits.`).Default("1").Int() //nolint[gochecknoglobals]
path = kingpin.Flag("path", `Path to the git repo (default: ".").`).Default(".").String() //nolint[gochecknoglobals]
subjectRegex = kingpin.Flag("subject-regex", `Commit subject line must conform to this regular expression (default: ".*").`).Default(".*").String() //nolint[gochecknoglobals]
subjectMaxLength = kingpin.Flag("subject-maxlen", "Max length for commit subject line (default: math.MaxInt32 - 1).").Default(strconv.Itoa(math.MaxInt32 - 1)).Int() //nolint[gochecknoglobals]
bodyRegex = kingpin.Flag("body-regex", `Commit message body must conform to this regular expression (default: ".*").`).Default(".*").String() //nolint[gochecknoglobals]
since = kingpin.Flag("since", `A date in "yyyy-MM-dd" format starting from which commits will be analyzed (default: "1970-01-01").`).Default("1970-01-01").String() //nolint[gochecknoglobals]
msgFile = kingpin.Flag("msg-file", `Only analyze the commit message found in this file (default: "").`).Default("").String() //nolint[gochecknoglobals]
maxParents = kingpin.Flag("max-parents", `Max number of parents a commit can have in order to be analyzed (default: 1). Useful for excluding merge commits.`).Default("1").Int() //nolint[gochecknoglobals]
)

func main() {
Expand All @@ -49,7 +49,7 @@ func main() {
[]issues.Filter{
issues.OfSubjectRegex(*subjectRegex),
issues.OfBodyRegex(*bodyRegex),
issues.OfSubjectLength(*subjectLength),
issues.OfSubjectLength(*subjectMaxLength),
},
try(
len(*msgFile) > 0,
Expand Down

0 comments on commit 8ee76f1

Please sign in to comment.