summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-07-27 22:37:17 +0300
committerLinus Groh <mail@linusgroh.de>2021-07-27 20:41:49 +0100
commit350fb0e3dbe085c4b7d96ac60e60e741cffda1ee (patch)
tree905adeff3e71e4361d893b38213441e170e1e5ef
parentaf3a26f4cc797e89f9c1f9041f00d2a1a4313487 (diff)
downloadserenity-350fb0e3dbe085c4b7d96ac60e60e741cffda1ee.zip
Meta: Bring lint-commit.sh up to date with the CI commit linter
This was missing 2 of the recently added checks. Also added a reminder in the CI linter to update the Meta (commit hook) version.
-rw-r--r--.github/workflows/lintcommits.yml2
-rwxr-xr-xMeta/lint-commit.sh8
2 files changed, 9 insertions, 1 deletions
diff --git a/.github/workflows/lintcommits.yml b/.github/workflows/lintcommits.yml
index 3c9a9363bf..116726344c 100644
--- a/.github/workflows/lintcommits.yml
+++ b/.github/workflows/lintcommits.yml
@@ -2,6 +2,8 @@ name: Commit linter
on: [pull_request_target]
+# Make sure to update Meta/lint-commit.sh to match this script when adding new checks!
+
jobs:
lint_commits:
runs-on: ubuntu-20.04
diff --git a/Meta/lint-commit.sh b/Meta/lint-commit.sh
index bb5073627d..083be28b8e 100755
--- a/Meta/lint-commit.sh
+++ b/Meta/lint-commit.sh
@@ -28,11 +28,17 @@ while read -r line; do
error "Missing category in commit title (if this is a fix up of a previous commit, it should be squashed)"
fi
+ title_case_pattern="^\S.*?: [A-Z0-9]"
+ if [[ $line_number -eq 1 ]] && (echo "$line" | grep -P -v -q "$title_case_pattern"); then
+ error "First word of commit after the subsystem is not capitalized"
+ fi
+
if [[ $line_number -eq 1 ]] && [[ "$line" =~ \.$ ]]; then
error "Commit title ends in a period"
fi
- if [[ $line_length -gt 72 ]]; then
+ url_pattern="([a-z]+:\/\/)?(([a-zA-Z0-9_]|-)+\.)+[a-z]{2,}(:\d+)?([a-zA-Z_0-9@:%\+.~\?&\/=]|-)+"
+ if [[ $line_length -gt 72 ]] && (echo "$line" | grep -P -v -q "$url_pattern"); then
error "Commit message lines are too long (maximum allowed is 72 characters)"
fi
done <"$commit_file"