lint-commits: disallow noreply emails

This commit is contained in:
Đoàn Trần Công Danh 2023-01-11 09:28:30 +07:00
parent 7712ef1d38
commit a4e7150995

View file

@ -32,9 +32,16 @@ do
awk -vC="$cmt" ' awk -vC="$cmt" '
# skip header # skip header
/^$/ && !msg { msg = 1; next } /^$/ && !msg { msg = 1; next }
/^author .*noreply/ && !msg {
print "::error title=Commit Lint::" C ": authored by noreply email";
ret=1;
}
!msg { next } !msg { next }
# 3: long-line-is-banned-except-footnote-like-this-for-url # 3: long-line-is-banned-except-footnote-like-this-for-url
(NF > 2) && (length > 80) { print "::error title=Commit Lint::" C ": long line: " $0; exit 1 } (NF > 2) && (length > 80) {
print "::error title=Commit Lint::" C ": long line: " $0
ret = 1
}
!subject { !subject {
if (length > 50) { print "::warning title=Commit Lint::" C ": subject is a bit long" } if (length > 50) { print "::warning title=Commit Lint::" C ": subject is a bit long" }
if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print "::error title=Commit Lint::" C ": subject does not follow CONTRIBUTING.md guildelines"; exit 1 } if (!($0 ~ ":" || $0 ~ "^Take over maintainership " || $0 ~ "^Orphan ")) { print "::error title=Commit Lint::" C ": subject does not follow CONTRIBUTING.md guildelines"; exit 1 }
@ -45,7 +52,11 @@ do
subject = 1; next subject = 1; next
} }
/^$/ { body = 1; next } /^$/ { body = 1; next }
!body { print "::error title=Commit Lint::" C ": second line must be blank"; exit 1 } !body {
print "::error title=Commit Lint::" C ": second line must be blank"
ret = 1
}
END { exit ret }
' || status=1 ' || status=1
done done
exit $status exit $status