Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 83357de

Browse files
authored
Merge pull request #777 from ludsrill/ludsrill
feat(build): #769.1 add commit lint config
2 parents 182d9a3 + 434b512 commit 83357de

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

makes.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
lintGitCommitMsg = {
9696
enable = true;
9797
branch = "main";
98+
parser = "/test/lint-commit-msg/lint-git-commit-msg-parser.js";
99+
config = "/test/lint-commit-msg/lint-git-commit-msg-config.js";
98100
};
99101
lintGitMailMap = {
100102
enable = true;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const HEADERLENGTHMAX = 60;
2+
const LINELENGTHMAX = 72;
3+
const BODYLENGTHMIN = 15;
4+
5+
module.exports = {
6+
parserPreset: './.commitlint-parser-preset',
7+
rules: {
8+
9+
// Body
10+
'body-leading-blank': [2, 'always'], // blank line between header and body
11+
'body-empty': [2, 'never'], // body cannot be empty
12+
'body-max-line-length': [2, 'always', LINELENGTHMAX], // body lines max chars LINELENGTHMAX
13+
'body-min-length' : [2, 'always', BODYLENGTHMIN], // body more than BODYLENGTHMIN chars
14+
15+
// Footer
16+
'footer-leading-blank': [2, 'always'], // blank line between body and footer
17+
'footer-max-line-length': [2, 'always', LINELENGTHMAX], // footer lines max chars LINELENGTHMAX
18+
19+
// Header
20+
'header-case': [2, 'always', 'lower-case'], // header lower case
21+
'header-max-length': [2, 'always', HEADERLENGTHMAX], // header max chars HEADERLENGTHMAX
22+
23+
// Scope
24+
'scope-empty': [2, 'never'], // scope always
25+
'scope-enum': [
26+
2,
27+
'always',
28+
[
29+
'front', // Front-End change
30+
'back', // Back-End change
31+
'infra', // Infrastructure change
32+
'conf', // Configuration files change
33+
'build', // System component change (ci, scons, webpack...)
34+
'job', // asynchronous or schedule tasks (backups, maintainance...)
35+
'cross', // Mix of two or more scopes
36+
'doc', // Documentation only changes
37+
],
38+
],
39+
40+
// Subject (commit title without type and scope)
41+
'subject-case': [2, 'always', 'lower-case'], // subject lower-case
42+
'subject-empty': [2, 'never'], // subject always
43+
44+
// Type
45+
'type-empty': [2, 'never'], //type always
46+
'type-enum': [
47+
2,
48+
'always',
49+
[
50+
'feat', // New feature
51+
'perf', // Improves performance
52+
'fix', // Bug fix
53+
'rever', // Revert to a previous commit in history
54+
'style', // Do not affect the meaning of the code (formatting, etc)
55+
'refac', // Neither fixes a bug or adds a feature
56+
'test', // Adding missing tests or correcting existing tests
57+
],
58+
],
59+
},
60+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
parserOpts: {
3+
headerPattern: /^(\w*)\((\w*)\):\s(#[0-9]\d*)(.\d+)?\s(.*)$/,
4+
headerCorrespondence: [ 'type', 'scope', 'ticket', 'part', 'subject' ],
5+
},
6+
};

0 commit comments

Comments
 (0)