Skip to content

Default "longer description" is always "-" #2971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks
dangreen opened this issue Jan 14, 2022 · 7 comments
Closed
4 tasks

Default "longer description" is always "-" #2971

dangreen opened this issue Jan 14, 2022 · 7 comments

Comments

@dangreen
Copy link
Member

Expected Behavior

Empty longer description.

Current Behavior

"longer description" is always "-"

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

restore this

const commitBody = body || breakingBody || issuesBody || '-';

to this

const commitBody = body ?? breakingBody ?? issuesBody ?? '-';

Tested

Steps to Reproduce (for bugs)

  1. clone https://github.com/TrigenSoftware/scripts
  2. pnpm i
  3. pnpm commit -- --allow-empty
  4. "longer description" is "-"

Your Environment

Issue appeared in @commitlint/[email protected]

@escapedcat
Copy link
Member

@dangreen if you changed it and all existing tests are still I green I guess we could revert this.
@honzamelena what do you think? This came from you, right? a038b41

@honzamelena
Copy link
Contributor

@escapedcat @dangreen I don't think this is the solution. As you can see from the line, this behavior was always there. Unfortunately because of the wrongly used "??" instead of "||" it never actually got to the point of using "-" as the default value when all the other body types are empty was never triggered due to always having an empty body (first occurrence).

See the attached screen for the different behavior between using "??" and "||".

image

If we revert this, the issueBody and breakingBody will never be triggered and my newly created test in the library to check this would fail. As seen below (not sure what was tested then):

image

I would suggest just removing the default "-" at the end if we want to not have it there in case of an empty body supplied.

@dangreen
Copy link
Member Author

@honzamelena @escapedcat How soon will you fix it?

@escapedcat
Copy link
Member

@dangreen happy for a PR if you find time and motivation

@escapedcat
Copy link
Member

escapedcat commented Jan 19, 2022

@honzamelena would you have time to look at the PR as well? lgtm

@honzamelena
Copy link
Contributor

@escapedcat yes, added a comment on the pull request. LGTM

@escapedcat
Copy link
Member

Published in v16.0.3. Please give it a try and close this issue if it works, thanks

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

No branches or pull requests

3 participants