From 643bc3635e75121826fb878f46ca540ce210bace Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 19 Apr 2021 15:27:09 +0200 Subject: Adding upstream version 0.15.1. Signed-off-by: Daniel Baumann --- gitlint/tests/contrib/rules/test_signedoff_by.py | 12 ++++++------ gitlint/tests/expected/cli/test_cli/test_contrib_1 | 2 +- .../expected/cli/test_cli_hooks/test_hook_config_1_stdout | 2 +- .../expected/cli/test_cli_hooks/test_hook_edit_1_stdout | 6 +++--- .../cli/test_cli_hooks/test_hook_local_commit_1_stdout | 2 +- .../tests/expected/cli/test_cli_hooks/test_hook_no_1_stdout | 2 +- .../expected/cli/test_cli_hooks/test_hook_no_tty_1_stdout | 2 +- .../cli/test_cli_hooks/test_hook_stdin_violations_1_stdout | 2 +- .../tests/expected/cli/test_cli_hooks/test_hook_yes_1_stdout | 2 +- gitlint/tests/rules/test_body_rules.py | 10 ++++++++++ 10 files changed, 26 insertions(+), 16 deletions(-) (limited to 'gitlint/tests') diff --git a/gitlint/tests/contrib/rules/test_signedoff_by.py b/gitlint/tests/contrib/rules/test_signedoff_by.py index c92f1a6..0369cdc 100644 --- a/gitlint/tests/contrib/rules/test_signedoff_by.py +++ b/gitlint/tests/contrib/rules/test_signedoff_by.py @@ -17,16 +17,16 @@ class ContribSignedOffByTests(BaseTestCase): self.assertIn(SignedOffBy(), config.rules) def test_signedoff_by(self): - # No violations when 'Signed-Off-By' line is present + # No violations when 'Signed-off-by' line is present rule = SignedOffBy() - violations = rule.validate(self.gitcommit("Föobar\n\nMy Body\nSigned-Off-By: John Smith")) + violations = rule.validate(self.gitcommit("Föobar\n\nMy Body\nSigned-off-by: John Smith")) self.assertListEqual([], violations) - # Assert violation when no 'Signed-Off-By' line is present + # Assert violation when no 'Signed-off-by' line is present violations = rule.validate(self.gitcommit("Föobar\n\nMy Body")) - expected_violation = RuleViolation("CC1", "Body does not contain a 'Signed-Off-By' line", line_nr=1) + expected_violation = RuleViolation("CC1", "Body does not contain a 'Signed-off-by' line", line_nr=1) self.assertListEqual(violations, [expected_violation]) - # Assert violation when no 'Signed-Off-By' in title but not in body - violations = rule.validate(self.gitcommit("Signed-Off-By\n\nFöobar")) + # Assert violation when no 'Signed-off-by' in title but not in body + violations = rule.validate(self.gitcommit("Signed-off-by\n\nFöobar")) self.assertListEqual(violations, [expected_violation]) diff --git a/gitlint/tests/expected/cli/test_cli/test_contrib_1 b/gitlint/tests/expected/cli/test_cli/test_contrib_1 index cdfb821..ed21eca 100644 --- a/gitlint/tests/expected/cli/test_cli/test_contrib_1 +++ b/gitlint/tests/expected/cli/test_cli/test_contrib_1 @@ -1,3 +1,3 @@ -1: CC1 Body does not contain a 'Signed-Off-By' line +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, ci, build: "Test tïtle" 1: CT1 Title does not follow ConventionalCommits.org format 'type(optional-scope): description': "Test tïtle" diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_config_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_config_1_stdout index 5d3f1fc..bee014b 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_config_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_config_1_stdout @@ -1,5 +1,5 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Aborted! diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_edit_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_edit_1_stdout index fa6b3bc..b57a35a 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_edit_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_edit_1_stdout @@ -1,12 +1,12 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Commit aborted. Your commit message: ----------------------------------------------- diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_local_commit_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_local_commit_1_stdout index a95bfea..0b8e90e 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_local_commit_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_local_commit_1_stdout @@ -1,4 +1,4 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Editing only possible when --msg-filename is specified. diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_1_stdout index 9cc53c1..98a83b1 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_1_stdout @@ -1,6 +1,6 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Commit aborted. Your commit message: ----------------------------------------------- diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_tty_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_tty_1_stdout index 5d3f1fc..bee014b 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_tty_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_no_tty_1_stdout @@ -1,5 +1,5 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Aborted! diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_stdin_violations_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_stdin_violations_1_stdout index 5d3f1fc..bee014b 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_stdin_violations_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_stdin_violations_1_stdout @@ -1,5 +1,5 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] Aborted! diff --git a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_yes_1_stdout b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_yes_1_stdout index bb753b0..0414712 100644 --- a/gitlint/tests/expected/cli/test_cli_hooks/test_hook_yes_1_stdout +++ b/gitlint/tests/expected/cli/test_cli_hooks/test_hook_yes_1_stdout @@ -1,4 +1,4 @@ gitlint: checking commit message... ----------------------------------------------- -gitlint: Your commit message contains the above violations. +gitlint: Your commit message contains violations. Continue with commit anyways (this keeps the current commit message)? [y(es)/n(no)/e(dit)] \ No newline at end of file diff --git a/gitlint/tests/rules/test_body_rules.py b/gitlint/tests/rules/test_body_rules.py index 96ae998..a268585 100644 --- a/gitlint/tests/rules/test_body_rules.py +++ b/gitlint/tests/rules/test_body_rules.py @@ -126,6 +126,16 @@ class BodyRuleTests(BaseTestCase): violations = rule.validate(commit) self.assertListEqual(violations, [expected_violation]) + def test_body_missing_multiple_empty_new_lines(self): + rule = rules.BodyMissing() + + # body is too short + expected_violation = rules.RuleViolation("B6", "Body message is missing", None, 3) + + commit = self.gitcommit("Tïtle\n\n\n\n") + violations = rule.validate(commit) + self.assertListEqual(violations, [expected_violation]) + def test_body_missing_merge_commit(self): rule = rules.BodyMissing() -- cgit v1.2.3