Skip to content

bug: footer-leading-blank always triggers when comment in body #3120

Closed
@wtho

Description

@wtho

footer-leading-blank complains when comment in body

Example Commit Message

fix: failing example

body line 1
# comment in body breaks footer-leading-blank - uncomment to remove the error
body line 2

fixes #123

Try it out

This bug seems to differ from #896

Expected Behavior

The rule should locate the body lines properly and not think there is content between body and footer.

Current Behavior

The footer-leading-blank rule counts the body lines excluding the comments and then compares them to the raw input, which in turn contains the comments.

Affected packages

  • @commitlint/rules and all packages using it

Possible Solutions

Bug is in footer-leading-blank.ts

  • Correctly count the raw length of bodyLines in or
  • Remove comment lines from rawLines before slicing

Steps to Reproduce (for bugs)

See message or link at the top of the issue

Your Environment

Executable Version
commitlint --version 16.2.3
git --version 2.35.1
node --version 16.14.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions