Skip to content

Commit

Permalink
Relax commit title to 65 chars
Browse files Browse the repository at this point in the history
50 chars is really a bit annoying. This let you use 15 more chars. This
commit also cleans up some if [[ ]], if (( )), if [ ] stuff for bash.
  • Loading branch information
rumpelsepp committed Dec 9, 2019
1 parent a56a1c4 commit cf8dca3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/lint-commit-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ EndOfMessage
}

lint_commit_message() {
if [[ "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" -ne 1 ]]; then
if (( "$(echo "$1" | awk 'NR == 2 {print $1;}' | wc -c)" != 1 )); then
display_commit_message_error "$1" 'Separate subject from body with a blank line'
fi

if [[ "$(echo "$1" | head -n1 | wc -m)" -gt 50 ]]; then
display_commit_message_error "$1" 'Limit the subject line to 50 characters'
if (( "$(echo "$1" | head -n1 | wc -m)" > 65 )); then
display_commit_message_error "$1" 'Limit the subject line to 65 characters'
fi

if [[ ! $1 =~ ^[A-Z] ]]; then
Expand All @@ -36,13 +36,13 @@ lint_commit_message() {
display_commit_message_error "$1" 'Do not end the subject line with a period'
fi

if [[ "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" -gt 72 ]]; then
if (( "$(echo "$1" | awk '{print length}' | sort -nr | head -1)" > 72 )); then
display_commit_message_error "$1" 'Wrap the body at 72 characters'
fi
}

if [ "$#" -eq 1 ]; then
if [ ! -f "$1" ]; then
if (( "$#" < 1 )); then
if [[ ! -f "$1" ]]; then
echo "$0 was passed one argument, but was not a valid file"
exit 1
fi
Expand Down

0 comments on commit cf8dca3

Please sign in to comment.