diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2024-10-04 09:39:54 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-23 17:35:23 +0100 |
commit | dab2dcae89d349366edc3cfa09c312fab8cf14b8 (patch) | |
tree | 934f0badbfb21c52b465a5f801374115f340393e /meta/lib/patchtest/tests/test_mbox.py | |
parent | a20bbe112331c1cb99a78a7263d3f76a083ad13b (diff) | |
download | poky-dab2dcae89d349366edc3cfa09c312fab8cf14b8.tar.gz |
patchtest: add test_commit_message_user_tags
This test makes patchtest check to ensure that there aren't any
GitHub-style user account names being tagged in the commit message, e.g.
it should catch lines like:
"fix added by @threexc"
This is desired so that if (for example) we add upstream changelogs in
recipe upgrade commit messages verbatim, we don't end up subscribing any
associated maintainers to our repo mirrors' updates by accident.
There is a small possibility of a false positive with this test, where
if someone is mentioning Python decorators in their commit message (or
similar syntax from other languages), it will fail when it should pass.
However, having this test in place to guard against username inclusion
is more important that the occasional false positive for that reason.
With this addition, a failure will look like:
|FAIL: test commit message user tags: Mbox includes one or more GitHub-style username tags. Ensure that any "@" symbols are stripped out of usernames (test_mbox.TestMbox.test_commit_message_user_tags)
(From OE-Core rev: 8278d82d8203212bb159eb3805d4a5617c5370df)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest/tests/test_mbox.py')
-rw-r--r-- | meta/lib/patchtest/tests/test_mbox.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index c0f9970686..dab733ea77 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py | |||
@@ -142,6 +142,15 @@ class TestMbox(base.Base): | |||
142 | if not commit.commit_message.strip(): | 142 | if not commit.commit_message.strip(): |
143 | self.fail('Please include a commit message on your patch explaining the change', commit=commit) | 143 | self.fail('Please include a commit message on your patch explaining the change', commit=commit) |
144 | 144 | ||
145 | # This may incorrectly report a failure if something such as a | ||
146 | # Python decorator is included in the commit message, but this | ||
147 | # scenario is much less common than the username case it is written | ||
148 | # to protect against | ||
149 | def test_commit_message_user_tags(self): | ||
150 | for commit in self.commits: | ||
151 | if patchtest_patterns.mbox_github_username.search_string(commit.commit_message): | ||
152 | self.fail('Mbox includes one or more GitHub-style username tags. Ensure that any "@" symbols are stripped out of usernames', commit=commit) | ||
153 | |||
145 | def test_bugzilla_entry_format(self): | 154 | def test_bugzilla_entry_format(self): |
146 | for commit in self.commits: | 155 | for commit in self.commits: |
147 | if not patchtest_patterns.mbox_bugzilla.search_string(commit.commit_message): | 156 | if not patchtest_patterns.mbox_bugzilla.search_string(commit.commit_message): |