
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
commitplease
Advanced tools
This node.js module validates git commit messages while you commit, according to the rules specified in the jQuery Commit Guidelines. These are pretty generic, so this module should be useful for most projects that care about commit message formats.
npm install commitplease
A git version of 1.8.5 or newer is recommended. If you use git commit --verbose
, it is required.
Just commit as usual. This modules installs a git commit-msg hook, automatically validating all commit messages as you enter them. Invalid messages will be rejected, with details on what's wrong and a copy of the input.
By default, the commit message needs to match the jQuery Commit Guidlines. See there for details, and below on how to change the default behaviour.
In addition, a subject (the first line) starting with "fixup!" and "squash!" is considered valid. These are generated by git commit --fixup
and --squash
. A component in square brackets like "[Tmp]" or "[fix]" is also considered valid, to be manually squashed later.
The API is a work-in-progress
var validate = require('commitplease/lib/validate');
var errors = validate(commit.message);
if (errors.length) {
postComment('This commit has ' + errors.length + ' problems!');
}
validate(message[, options])
, returns Array
message
(String
): The commit message to validate. Must use LF (\n
) as line breaks.options
(Object
, optional): Use this to override the default settings, see properties and defaults belowArray
: Empty for valid messages, one or more items as String
for each problem foundOptions and their defaults:
component: true,
components: [],
limits: {
subject: 72,
other: 80
}
component
: The default true
requires a component, set to false
to skip the check.components
: A list of valid components. When a component is found, it's compared to the ones specified in this array.limits
: Line length limits, for subject and other lines.The validation options can be overriden by configuring the commitplease
property on your own project's package.json
. This allows you to customize the validation rules.
Here's an example for specifiying what components are valid:
{
"name": "Example",
"description": "An example project with custom commit hook options",
"devDependencies": {
"commitplease": "1.10.x"
},
"commitplease": {
"components": [ "Build", "Test", "Core", "Legacy" ]
}
}
Copyright 2014 Jörn Zaefferer. Released under the terms of the MIT license.
Support this project by donating on Gratipay.
FAQs
Validates strings as commit messages
The npm package commitplease receives a total of 12,846 weekly downloads. As such, commitplease popularity was classified as popular.
We found that commitplease demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.