Skip to content
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

fix: commitlint --last fails #3981

Closed
1 of 4 tasks
mfcollins3 opened this issue Mar 16, 2024 · 2 comments · Fixed by #3982
Closed
1 of 4 tasks

fix: commitlint --last fails #3981

mfcollins3 opened this issue Mar 16, 2024 · 2 comments · Fixed by #3982
Labels

Comments

@mfcollins3
Copy link

mfcollins3 commented Mar 16, 2024

Steps to Reproduce

I created a valid commit message and used the npx commitlint --last --verbose command to validate the commit message as shown here. I received the following errors:

  • subject may not be empty [subject-empty]
  • type may not be empty [type-empty]

The commit message was:

ci: validate commit messages

I added development dependencies on commitlint and husky. commitlint is
being used to validate commit messages conform to the Conventional
Commits format and follow the configured rules for the project. husky is
being used to run commitlint on every commit using the commit_msg Git
hook.

I created the setup.sh script to automate the steps to install the
project dependencies after cloning the repository.

I updated README.md with instructions on cloning the repository and
running the setup.sh script. I created the software requirements
document to list the software that developers need to install in their
development environments in order to contribute to the product.

I created CONTRIBUTING.md with instructions on how to contribute to the
product. I added instructions on commit signing,
writing commit messages, and the workflows for bug fixes or implementing
new features.

I created the commitlint GitHub Actions workflow to run commitlint to
validate commit messages for the main branch or pull requests for the
main branch.

My configuration is:

export default {
    extends: ['@commitlint/config-conventional'],
    rules: {
        'body-max-line-length': [1, 'always', 72],
        'body-case': [1, 'always', 'sentence-case'],
        'footer-max-line-length': [1, 'always', 72],
        'header-max-length': [2, 'always', 52],
        'scope-enum': [2, 'always', [
            'android',
            'api',
            'flutter',
            'ios'
        ]],
        'type-enum': [2, 'always', [
            'build',
            'change',
            'chore',
            'ci',
            'deprecate',
            'docs',
            'feat',
            'fix',
            'perf',
            'refactor',
            'remove',
            'revert',
            'security',
            'style',
            'test'
        ]]
    }
};

Running npx commitlint --from HEAD~1 --to HEAD --verbose succeeds.



### Current Behavior

```sh
✖   subject may not be empty [subject-empty]
✖   type may not be empty [type-empty]

✖   found 2 problems, 0 warnings

Expected Behavior

Commitlint should succeed and validate that the commit message is valid.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Context

No response

commitlint --version

@commitlint/[email protected]

git --version

2.44.0

node --version

20.11.1

@mfcollins3 mfcollins3 added the bug label Mar 16, 2024
@escapedcat
Copy link
Member

/cc @knocte

@knocte
Copy link
Contributor

knocte commented Mar 16, 2024

@mfcollins3 thanks for reporting this bug, we'll look at it on Monday.

webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
…est for running with --last flag. See [1].

Added regression test for running with --last flag. See [1].

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
Added regression test for running with --last flag. See [1].

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
Added regression test for running with --last flag. See [1].

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
Added regression test for running with --last flag. See [1].

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
Fixed regression [1] when using --last flag.

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
Fixed regression [1] when using --last flag.

[1] conventional-changelog#3981
webwarrior-ws added a commit to webwarrior-ws/commitlint that referenced this issue Mar 18, 2024
escapedcat pushed a commit that referenced this issue Mar 19, 2024
* test(cli): add regression test for --last flag

Added regression test for running with --last flag. See [1].

[1] #3981

* fix(cli): fixed regression when using --last flag

Fixed regression when using --last flag.

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

Successfully merging a pull request may close this issue.

3 participants