Skip to content

Commit

Permalink
fix(policy): remove commit header length from conventional commit pol…
Browse files Browse the repository at this point in the history
…icy (#102)

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
  • Loading branch information
andrewrynhard authored Jan 13, 2019
1 parent 2be1e1e commit 116a3bf
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions internal/policy/conventionalcommit/conventionalcommit.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ type Conventional struct {
Scopes []string `mapstructure:"scopes"`
}

// MaxNumberOfCommitCharacters is the maximium number of characters allowed in
// a commit header.
const MaxNumberOfCommitCharacters = 72

// HeaderRegex is the regular expression used for Conventional Commits
// 1.0.0-beta.1.
var HeaderRegex = regexp.MustCompile(`^(\w*)(\(([^)]+)\))?:\s{1}(.*)($|\n{2})`)
Expand Down Expand Up @@ -62,21 +58,13 @@ func (c *Conventional) Compliance(options *policy.Options) (report policy.Report
return
}

ValidateHeaderLength(&report, groups)
ValidateType(&report, groups, c.Types)
ValidateScope(&report, groups, c.Scopes)
ValidateDescription(&report, groups)

return report
}

// ValidateHeaderLength checks the header length.
func ValidateHeaderLength(report *policy.Report, groups []string) {
if len(groups[0]) > MaxNumberOfCommitCharacters {
report.Errors = append(report.Errors, errors.Errorf("Commit header is %d characters", len(groups[0])))
}
}

// ValidateType returns the commit type.
func ValidateType(report *policy.Report, groups []string, types []string) {
types = append(types, TypeFeat, TypeFix)
Expand Down

0 comments on commit 116a3bf

Please sign in to comment.