Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@commitlint/cli
Advanced tools
The @commitlint/cli package is a command-line tool that helps enforce conventions on commit messages. It allows teams to follow a predefined set of rules for commit messages, ensuring consistency and readability across the project's history. This is particularly useful in projects that use semantic versioning or need to generate changelogs automatically.
Linting Commit Messages
This command lints the commit message found in the file that `--edit` points to (defaults to the last commit message). It checks the message against the configured commitlint rules and returns errors or warnings based on those rules.
commitlint --edit
Configuring Commitlint
This code snippet shows how to configure commitlint in a project. It uses the `config-conventional` preset, which enforces conventional commit message guidelines. This configuration is typically placed in a `commitlint.config.js` file at the root of the project.
module.exports = {extends: ['@commitlint/config-conventional']};
Integrating with Husky for Git Hooks
This JSON configuration integrates commitlint with Husky, a tool for managing Git hooks. It sets up a `commit-msg` hook that runs commitlint against commit messages, using the `HUSKY_GIT_PARAMS` environment variable to pass the commit message file path to commitlint. This ensures that all commit messages are linted before they are finalized.
{
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}
Similar to @commitlint/cli in its goal to enforce standard commit practices, standard-version is focused on versioning and CHANGELOG generation based on semantic versioning (semver) and conventional commit messages. It does not lint commit messages but automates versioning and changelog creation.
Commitizen is a tool that prompts developers to fill out any required commit fields at commit time, ensuring that commits are formatted properly. While @commitlint/cli lints commit messages for compliance with a standard, commitizen helps in creating those standardized commit messages in the first place.
pre-commit is a framework for managing and maintaining multi-language pre-commit hooks. It can be used to lint commit messages among other things, similar to how @commitlint/cli is used. However, pre-commit is more general-purpose and can be used for a wide range of pre-commit checks beyond commit message linting.
Lint commit messages
npm install --save-dev @commitlint/cli @commitlint/config-angular
echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js
Consult docs/cli for comprehensive documentation.
16.2.4 (2022-04-28)
FAQs
Lint your commit messages
The npm package @commitlint/cli receives a total of 632,709 weekly downloads. As such, @commitlint/cli popularity was classified as popular.
We found that @commitlint/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.