Repository is archived
No commit activity in last 3 years
No release in over 3 years
A Danger Plugin that ensures nice and tidy commit messages.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
~> 3.4
~> 0.41
~> 0.8

Runtime

~> 5.0
 Project Readme

AngularJS Format Commit Lint for Danger

Build Status

This is a Danger Plugin that ensures nice and tidy commit messages. It is based off [https://github.com/jnallured/danger-commit_lint]. The checks performed on each commit message are inspired by Angular Commit Format in use by standard-version.

Installation

$ gem install danger-angular_commit_lint

Usage

Simply add this to your Dangerfile:

angular_commit_lint.check

That will check each commit in the PR to ensure the following is true:

  • Commit subject follows the angular pattern of <type>(<scope>): <subject>
  • Commit begins with a capital letter (subject_cap)
  • Commit is more than one word (subject_word)
  • Commit is no longer than 50 characters (subject_length)
  • Commit does not end in a period (subject_period)
  • Commit and body are separated by an empty line (empty_line)

By default, Commit Lint fails, but you can configure this behavior.

Configuration

Configuring Commit Lint is done by passing a hash. The three keys that can be passed are:

  • disable
  • fail
  • warn

To each of these keys you can pass either the symbol :all or an array of checks. Here are some ways you could configure Commit Lint:

# configure how you want your commits to be formatted
angular_commit_lint.check {
  commit_types => ['fix', 'feat'], # an array of types that are accepted, all others give an error
  use_scope => true, # whether you use `(<scope>)` or not
  require_scope => false, # if use_scope is true then this makes the scope optional if true
  min_scope => 1 # minimum length of the `<scope>`
}
# warn on all checks (instead of failing)
angular_commit_lint.check warn: :all

# disable the `subject_period` check
angular_commit_lint.check disable: [:subject_period]

Remember, by default all checks are run and they will fail. Think of this as the default:

angular_commit_lint.check fail: :all

Also note that there is one more way that Commit Lint can behave:

angular_commit_lint.check disable: :all

This will actually throw a warning that Commit Lint isn't doing anything.