Skip to content

fix(cz): enforce blank line between subject and body#75

Closed
vabatta wants to merge 1 commit intomainfrom
fix/cz-body-blank-line
Closed

fix(cz): enforce blank line between subject and body#75
vabatta wants to merge 1 commit intomainfrom
fix/cz-body-blank-line

Conversation

@vabatta
Copy link
Contributor

@vabatta vabatta commented Mar 8, 2026

Summary

  • Enforce the Conventional Commits spec rule: "body MUST begin one blank line after the description"
  • Single-line messages (no body) are unaffected — docs: correct spelling of CHANGELOG still passes
  • PR title validation in CI is unaffected (single-line)

Changes

cmd_lint.sh: After parsing the first line, check if the message has a second line. If it does and it's not blank, reject with the spec-quoted error message.

The check uses pure bash string manipulation — strips the first line via ${message#*$'\n'} and checks if what remains starts with a non-empty line.

Test plan

  • accepts single-line message (no body)docs: correct spelling of CHANGELOG
  • accepts message with blank line before body — spec example with body
  • rejects body without blank line separator — spec example without blank line
  • rejects footer without blank line separatorBREAKING CHANGE: footer without blank line
  • accepts message with only a trailing newline — edge case
  • All 152 tests pass, lint clean

The Conventional Commits spec requires: "body MUST begin one blank
line after the description." Single-line messages (no body) are
unaffected.
@vabatta vabatta force-pushed the fix/cz-body-blank-line branch from 5cc20b1 to ade7e83 Compare March 8, 2026 23:25
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

📊 Coverage Report

Script Coverage Change
cz 99.75% → 99.76% +.01% ⬆️

vabatta added a commit that referenced this pull request Mar 9, 2026
The Conventional Commits spec requires: "body MUST begin one blank
line after the description." Single-line messages (no body) are
unaffected. Closes #75.
@vabatta
Copy link
Contributor Author

vabatta commented Mar 9, 2026

Folded into #76 (spec alignment PR) — the blank line enforcement is now included there with error code [body-leading-blank].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant