1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Meta: Use grep -E/F, not grep -P

grep -E and -F are POSIX standard, and meets all our matching needs.
This commit is contained in:
thislooksfun 2021-10-26 13:08:39 -05:00 committed by Andreas Kling
parent 4de7b3ad24
commit c2d44209a8
6 changed files with 10 additions and 10 deletions

View file

@ -29,12 +29,12 @@ while read -r line; do
line_length=${#line}
category_pattern="^\S.*?\S: .+"
if [[ $line_number -eq 1 ]] && (echo "$line" | grep -P -v -q "$category_pattern"); then
if [[ $line_number -eq 1 ]] && (echo "$line" | grep -E -v -q "$category_pattern"); then
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
if [[ $line_number -eq 1 ]] && (echo "$line" | grep -E -v -q "$title_case_pattern"); then
error "First word of commit after the subsystem is not capitalized"
fi
@ -43,7 +43,7 @@ while read -r line; do
fi
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
if [[ $line_length -gt 72 ]] && (echo "$line" | grep -E -v -q "$url_pattern"); then
error "Commit message lines are too long (maximum allowed is 72 characters)"
fi