danger-plugin-commitlint-gitlab
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

danger-plugin-commitlint-gitlab

Build Status npm version semantic-release

This plugin checks a merge request title and commit messages to make sure they are well formatted and respect the commitlint/lint

Here are the conditions :

If MR sqash flag is true & multiple commits - title must be correct

If MR sqash flag is false & multiple commits - at least one commit must be correct

if single commit - first commit line must be correct

Rules

Usage

This plugin has been created especially for GITLAB and is supposed to be integrated in a CI job. It will not work in GitHub__

Install (with yarn or npm):

npm install --save-dev  danger-plugin-commitlint-gitlab

At a glance:

If you dangerfile is located in a module-like folder, it will look like this :

// dangerfile.js
import check from 'danger-plugin-conventional-commitlint-gitlab-mr'

import configConventional from '@commitlint/config-conventional';

(async function dangerReport() {

  const commitlintConfig = {
    severity: 'warn'
  };
  await check(configConventional.rules, commitlintConfig);
})();

If you get an isssue related to the import statement, try this:

In your project root folder:

  • Create a sub folder
  • Create a dangerfile.js inside of it
const commitlint = require('danger-plugin-conventional-commitlint-gitlab-mr')
const configConventional = require('@commitlint/config-conventional')

;(async function dangerReport() {
  const commitlintConfig = {
    severity: 'fail',
  }
  await commitlint.default(configConventional.rules, commitlintConfig)
})()

-- You will need to install a few dependencies for the plugin to work :

npm i commitlint/lint@8.3.5
npm i commitlint/config-conventional@13.1.0
npm install --save-dev  danger-plugin-commitlint-gitlab

Debug

This modules supports debug module, set DEBUG environnement variable to danger-plugin:commitlint-gitlab

DEBUG=danger-plugin:commitlint-gitlab

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

Package Sidebar

Install

npm i danger-plugin-commitlint-gitlab

Weekly Downloads

6

Version

1.2.1

License

MIT

Unpacked Size

11.3 kB

Total Files

4

Last publish

Collaborators

  • anderwansam