BryanDavis has uploaded a new change for review. https://gerrit.wikimedia.org/r/304430
Change subject: Allow lines >100 chars if they are URLs ...................................................................... Allow lines >100 chars if they are URLs Bug: T142800 Change-Id: I8f400441de6d53b073f9c637a3ac73f1d37e7538 --- M commit_message_validator/__init__.py M commit_message_validator/tests/data/check_message_ok.msg A commit_message_validator/tests/data/really_long_url_ok.msg A commit_message_validator/tests/data/really_long_url_ok.out M commit_message_validator/tests/test_commit-message-validator.py 5 files changed, 17 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/integration/commit-message-validator refs/changes/30/304430/1 diff --git a/commit_message_validator/__init__.py b/commit_message_validator/__init__.py old mode 100755 new mode 100644 index 1969448..4986134 --- a/commit_message_validator/__init__.py +++ b/commit_message_validator/__init__.py @@ -34,7 +34,7 @@ Checks: - First line <=80 characters - Second line blank - - No line >100 characters + - No line >100 characters (unless it is only a URL) - "Bug:" is capitalized - "Bug:" is followed by a space - Exactly one task id on each Bug: line @@ -56,9 +56,11 @@ if line: yield "Second line should be empty" - # No line >100 + # No line >100 unless it is all a URL elif len(line) > 100: - yield "Line should be <=100 characters" + m = re.match(r'^https?://\S+$', line, re.IGNORECASE) + if not m: + yield "Line should be <=100 characters" m = re.match(r'^(bug|closes|fixes|task):(\W)*(.*)', line, re.IGNORECASE) if m: diff --git a/commit_message_validator/tests/data/check_message_ok.msg b/commit_message_validator/tests/data/check_message_ok.msg index a7fb18a..4a7f483 100644 --- a/commit_message_validator/tests/data/check_message_ok.msg +++ b/commit_message_validator/tests/data/check_message_ok.msg @@ -9,7 +9,7 @@ Other checks: - First line <=80 characters - Second line blank -- No line >100 characters +- No line >100 characters unless it is an URL - "Bug:" is capitalized - "Bug:" is followed by a space - Exactly one task id on each Bug: line diff --git a/commit_message_validator/tests/data/really_long_url_ok.msg b/commit_message_validator/tests/data/really_long_url_ok.msg new file mode 100644 index 0000000..8f705c0 --- /dev/null +++ b/commit_message_validator/tests/data/really_long_url_ok.msg @@ -0,0 +1,7 @@ +A commit with a really long URL is valid + +This commit message includes a URL that is >100 characters but that's ok as +long as it is on a line by itself. +http://www.abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijk.com/is_actually_a_valid_and_live_domain.html + +Change-Id: I395fd614bfa8bcfc46a35f955fb77ec6f03f7a0b diff --git a/commit_message_validator/tests/data/really_long_url_ok.out b/commit_message_validator/tests/data/really_long_url_ok.out new file mode 100644 index 0000000..76dfe33 --- /dev/null +++ b/commit_message_validator/tests/data/really_long_url_ok.out @@ -0,0 +1,2 @@ +commit-message-validator v%version% +Commit message is formatted properly! Keep up the good work! diff --git a/commit_message_validator/tests/test_commit-message-validator.py b/commit_message_validator/tests/test_commit-message-validator.py index ae8101d..866b3fe 100644 --- a/commit_message_validator/tests/test_commit-message-validator.py +++ b/commit_message_validator/tests/test_commit-message-validator.py @@ -22,6 +22,8 @@ file pairs where there is a `.msg` and `.out` file. If both exist it'll create a test for this pair where the `.msg` is the commit message and the `.out` is the expected output. + + Filenames for tests that will pass validation must end with 'ok'. """ def __new__(cls, name, bases, dct): @@ -54,9 +56,7 @@ class TestCommitMessageValidator(with_metaclass(MetaValidator, unittest.TestCase)): - """Validate the commit messages using test files.""" - pass -- To view, visit https://gerrit.wikimedia.org/r/304430 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8f400441de6d53b073f9c637a3ac73f1d37e7538 Gerrit-PatchSet: 1 Gerrit-Project: integration/commit-message-validator Gerrit-Branch: master Gerrit-Owner: BryanDavis <bda...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits