Class: Danger::DangerCommitLint
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerCommitLint
- Defined in:
- lib/commit_lint/plugin.rb,
lib/commit_lint/commit_check.rb,
lib/commit_lint/empty_line_check.rb,
lib/commit_lint/subject_cap_check.rb,
lib/commit_lint/subject_words_check.rb,
lib/commit_lint/subject_length_check.rb,
lib/commit_lint/subject_period_check.rb
Overview
Run each commit in the PR through a message linting.
Commit lint will check each commit in the PR to ensure the following is true:
- Commit subject begins with a capital letter (
subject_cap) - Commit subject is more than one word (
subject_word) - Commit subject is no longer than 50 characters (
subject_length) - Commit subject does not end in a period (
subject_period) - Commit subject and body are separated by an empty line (
empty_line)
By default, Commit Lint fails, but you can configure this behavior.
Defined Under Namespace
Classes: CommitCheck, EmptyLineCheck, SubjectCapCheck, SubjectLengthCheck, SubjectPeriodCheck, SubjectWordsCheck
Constant Summary collapse
- NOOP_MESSAGE =
'All checks were disabled, nothing to do.'.freeze
Instance Method Summary collapse
-
#check(config = {}) ⇒ void
Checks the commits with whatever config the user passes.
Instance Method Details
#check(config = {}) ⇒ void
This method returns an undefined value.
Checks the commits with whatever config the user passes.
Passing in a hash which contain the following keys:
disable- array of checks to skipfail- array of checks to fail onwarn- array of checks to warn on
The current check types are:
subject_capsubject_wordsubject_lengthsubject_periodempty_line
Note: you can pass :all instead of an array to target all checks.
56 57 58 59 60 61 62 63 64 |
# File 'lib/commit_lint/plugin.rb', line 56 def check(config = {}) @config = config if all_checks_disabled? messaging.warn NOOP_MESSAGE else end end |