From 57136e3936920920f4632ab0ee92e550ad7e79c9 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 19 Jun 2020 19:58:04 +0200 Subject: [PATCH 1/2] added 'ci' and 'build' to conventional commit types --- gitlint/contrib/rules/conventional_commit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlint/contrib/rules/conventional_commit.py b/gitlint/contrib/rules/conventional_commit.py index 3bbbd0f1..85303435 100644 --- a/gitlint/contrib/rules/conventional_commit.py +++ b/gitlint/contrib/rules/conventional_commit.py @@ -17,7 +17,7 @@ class ConventionalCommit(LineRule): options_spec = [ ListOption( "types", - ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert"], + ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert", "ci", "build"], "Comma separated list of allowed commit types.", ) ] From c848b68dc375672f96ea5ed46ef86549d70fd216 Mon Sep 17 00:00:00 2001 From: chgl Date: Sat, 20 Jun 2020 15:36:52 +0200 Subject: [PATCH 2/2] Updated unit tests and docs for new commit types --- docs/contrib_rules.md | 4 ++-- gitlint/tests/config/test_config.py | 2 +- gitlint/tests/contrib/test_conventional_commit.py | 4 ++-- gitlint/tests/expected/test_cli/test_contrib_1 | 2 +- qa/expected/test_contrib/test_contrib_rules_1 | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/contrib_rules.md b/docs/contrib_rules.md index a4f4f0dc..d52133dc 100644 --- a/docs/contrib_rules.md +++ b/docs/contrib_rules.md @@ -53,7 +53,7 @@ CT1 | contrib-title-conventional-commits | >= 0.12.0 | Enforces [C Name | gitlint version | Default | Description ---------------|--------------------|--------------|---------------------------------- -types | >= 0.12.0 | `fix,feat,chore,docs,style,refactor,perf,test,revert` | Comma separated list of allowed commit types. +types | >= 0.12.0 | `fix,feat,chore,docs,style,refactor,perf,test,revert,ci,build` | Comma separated list of allowed commit types. ## CC1: contrib-requires-signed-off-by ## @@ -64,4 +64,4 @@ CC1 | contrib-requires-signed-off-by | >= 0.12.0 | Commit body # Contributing Contrib rules -We'd love for you to contribute new Contrib rules to gitlint or improve existing ones! Please visit the [Contributing](contributing) page on how to get started. \ No newline at end of file +We'd love for you to contribute new Contrib rules to gitlint or improve existing ones! Please visit the [Contributing](contributing) page on how to get started. diff --git a/gitlint/tests/config/test_config.py b/gitlint/tests/config/test_config.py index d3fdc2ca..777041b8 100644 --- a/gitlint/tests/config/test_config.py +++ b/gitlint/tests/config/test_config.py @@ -124,7 +124,7 @@ def test_contrib(self): expected_rule_option = options.ListOption( "types", - ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert"], + ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert", "ci", "build"], "Comma separated list of allowed commit types.", ) diff --git a/gitlint/tests/contrib/test_conventional_commit.py b/gitlint/tests/contrib/test_conventional_commit.py index ea808fd7..001af32d 100644 --- a/gitlint/tests/contrib/test_conventional_commit.py +++ b/gitlint/tests/contrib/test_conventional_commit.py @@ -19,13 +19,13 @@ def test_conventional_commits(self): rule = ConventionalCommit() # No violations when using a correct type and format - for type in ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert"]: + for type in ["fix", "feat", "chore", "docs", "style", "refactor", "perf", "test", "revert", "ci", "build"]: violations = rule.validate(type + u": föo", None) self.assertListEqual([], violations) # assert violation on wrong type expected_violation = RuleViolation("CT1", "Title does not start with one of fix, feat, chore, docs," - " style, refactor, perf, test, revert", u"bår: foo") + " style, refactor, perf, test, revert, ci, build", u"bår: foo") violations = rule.validate(u"bår: foo", None) self.assertListEqual([expected_violation], violations) diff --git a/gitlint/tests/expected/test_cli/test_contrib_1 b/gitlint/tests/expected/test_cli/test_contrib_1 index ea5d3534..cdfb8213 100644 --- a/gitlint/tests/expected/test_cli/test_contrib_1 +++ b/gitlint/tests/expected/test_cli/test_contrib_1 @@ -1,3 +1,3 @@ 1: CC1 Body does not contain a 'Signed-Off-By' line -1: CT1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test, revert: "Test tïtle" +1: CT1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test, revert, ci, build: "Test tïtle" 1: CT1 Title does not follow ConventionalCommits.org format 'type(optional-scope): description': "Test tïtle" diff --git a/qa/expected/test_contrib/test_contrib_rules_1 b/qa/expected/test_contrib/test_contrib_rules_1 index 99b33b79..0d333bcc 100644 --- a/qa/expected/test_contrib/test_contrib_rules_1 +++ b/qa/expected/test_contrib/test_contrib_rules_1 @@ -1,4 +1,4 @@ 1: CC1 Body does not contain a 'Signed-Off-By' line -1: CT1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test, revert: "WIP Thi$ is å title" +1: CT1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test, revert, ci, build: "WIP Thi$ is å title" 1: CT1 Title does not follow ConventionalCommits.org format 'type(optional-scope): description': "WIP Thi$ is å title" 1: T5 Title contains the word 'WIP' (case-insensitive): "WIP Thi$ is å title"