summaryrefslogtreecommitdiffstats
path: root/qa
diff options
context:
space:
mode:
Diffstat (limited to 'qa')
-rw-r--r--qa/samples/config/ignore-release-commits3
-rw-r--r--qa/test_commits.py30
2 files changed, 33 insertions, 0 deletions
diff --git a/qa/samples/config/ignore-release-commits b/qa/samples/config/ignore-release-commits
new file mode 100644
index 0000000..898e73f
--- /dev/null
+++ b/qa/samples/config/ignore-release-commits
@@ -0,0 +1,3 @@
+[ignore-by-title]
+regex=^Release(.*)
+ignore=T5,T3 \ No newline at end of file
diff --git a/qa/test_commits.py b/qa/test_commits.py
index be0a8fd..0d306e1 100644
--- a/qa/test_commits.py
+++ b/qa/test_commits.py
@@ -73,3 +73,33 @@ class CommitsTests(BaseTestCase):
)
self.assertEqual(output, expected)
+
+ def test_ignore_commits(self):
+ """ Tests multiple commits of which some rules get igonored because of ignore-* rules """
+ # Create repo and some commits
+ tmp_git_repo = self.create_tmp_git_repo()
+ self._create_simple_commit(u"Sïmple title.\n\nSimple bödy describing the commit", git_repo=tmp_git_repo)
+ # Normally, this commit will give T3 (trailing-punctuation), T5 (WIP) and B5 (bod-too-short) violations
+ # But in this case only B5 because T3 and T5 are being ignored because of config
+ self._create_simple_commit(u"Release: WIP tïtle.\n\nShort", git_repo=tmp_git_repo)
+ # In the following 2 commits, the T3 violations are as normal
+ self._create_simple_commit(u"Sïmple title3.\n\nSimple bödy describing the commit3", git_repo=tmp_git_repo)
+ self._create_simple_commit(u"Sïmple title4.\n\nSimple bödy describing the commit4", git_repo=tmp_git_repo)
+ revlist = git("rev-list", "HEAD", _err_to_out=True, _cwd=tmp_git_repo).split()
+
+ config_path = self.get_sample_path("config/ignore-release-commits")
+ output = gitlint("--commits", "HEAD", "--config", config_path, _cwd=tmp_git_repo,
+ _tty_in=False, _err_to_out=True, _ok_code=[4])
+
+ expected = (
+ u"Commit {0}:\n".format(revlist[0][:10]) +
+ u"1: T3 Title has trailing punctuation (.): \"Sïmple title4.\"\n\n" +
+ u"Commit {0}:\n".format(revlist[1][:10]) +
+ u"1: T3 Title has trailing punctuation (.): \"Sïmple title3.\"\n\n" +
+ u"Commit {0}:\n".format(revlist[2][:10]) +
+ u"3: B5 Body message is too short (5<20): \"Short\"\n\n" +
+ u"Commit {0}:\n".format(revlist[3][:10]) +
+ u"1: T3 Title has trailing punctuation (.): \"Sïmple title.\"\n"
+ )
+
+ self.assertEqual(output, expected)