Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* cppcheck-suppress nullPointer
*/


/* Change */
/* Create an empty queue */
struct list_head *q_new()
{
Expand Down
13 changes: 8 additions & 5 deletions scripts/commit-msg.hook
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,14 @@ validate_commit_message() {
# Count non-comment, non-blank lines excluding "Change-Id:".
NON_COMMENT_COUNT=$(sed '/^[[:space:]]*#/d;/^[[:space:]]*$/d;/^[[:space:]]*Change-Id:/d' "${COMMIT_MSG_FILE}" | wc -l | xargs)

# If the subject is oversimplified for a queue function OR queue.c is modified,
# and there is only one meaningful line, issue a warning.
if { [[ "${COMMIT_SUBJECT_TO_PROCESS}" =~ ^(Implement|Finish|Complete)[[:space:]]+q_[[:alnum:]_]+\(?\)?$ ]] || \
git diff --cached --name-only | grep -Eq '(^|/)queue\.c$'; } && [ "${NON_COMMENT_COUNT}" -le 1 ]; then
add_warning 1 "Commit message oversimplified. Use the commit message body to explain what and why."
# If queue.c is modified and the commit message is oversimplified, forbid generic subjects.
if git diff --cached --name-only | grep -Eq '(^|/)queue\.c$'; then
if [ "${NON_COMMENT_COUNT}" -le 1 ]; then
add_warning 1 "Commit message oversimplified. Use the commit message body to explain what and why."
fi
if [[ "${COMMIT_SUBJECT_TO_PROCESS}" =~ ^(Complete|Finish|Done)[[:space:]]+ ]]; then
add_warning 1 "Avoid using generic subjects starting with 'Complete', 'Finish', or 'Done'"
fi
fi

# 9. Do not start the subject line with whitespace
Expand Down