Skip to content

Commit

Permalink
Merge pull request #6684 from LandSandBoat/ci/commit-message-disallowed
Browse files Browse the repository at this point in the history
[ci] Check disallowed commit words explicitly
  • Loading branch information
claywar authored Jan 10, 2025
2 parents ed99f2c + 446e3ac commit de4aa34
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tools/ci/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ python << EOF
import re
import subprocess
disallowed_words = [
"oops",
"whoops",
"lol",
"lulz",
"kek",
"kekw"
]
def get_commit_hashes():
commit_hashes = []
Expand Down Expand Up @@ -82,7 +91,7 @@ for hash, lines in get_commit_messages().items():
print_error(hash, lines, line, "Detected automatic commit message (Example: \"Update filename.ext\").\nPlease "
"provide a more detailed summary of your changes.")
if 'oops' in line.lower() or 'lol' in line.lower():
print_error(hash, lines, line, "Detected unhelpful language in commit message.\nPlease "
"describe what you have changed with this commit.\nUnhelpful language:\nOops\nWhoops\nlol")
for invalid_word in disallowed_words:
if re.match(r'\b({0})\b'.format(invalid_word), line.lower()):
print_error(hash, lines, line, f"Detected unhelpful language in commit message.\nPlease describe what you have changed with this commit.\nUnhelpful language: {invalid_word}")
EOF

0 comments on commit de4aa34

Please sign in to comment.