Skip to content

severnway/sevenrules

Repository files navigation

sevenrules

Validates a git commit message against The seven rules:

  1. Separate subject from body with a blank line
  2. Limit the subject line to 72 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

The bolded rules 1-4 and 6 are checked. The remaining 2 are not detectable programmatically. The title of rule 2 says 50 characters but the body clarifies 72 is the hard limit.

Provides a husky hook for easy use.

Inspired by the quality Bash implementation by Silent Correspondent.

Usage

Install husky and the validator:

npm install husky --save-dev
npm install sevenrules --save-dev

Hook the validator to commitmsg in your package.json:

{
  "scripts": {
    "commitmsg": "sevenruleshusky"
  }
}

Enjoy your clean commit log!

Conduct

Respect agency. Follow the Code of Conduct.

License

Anybody caught using this work without our permission, will be mighty good friends of ourn, cause we don't give a dern. Study it. Hack it. Publish it, even without naming the source. We made it, that's all we wanted to do.

Released under the Severn license, an MIT derivative without the notice requirement. Contributor signatures available in the contributors repository.

NO rights reserved.