question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reference may not be empty

See original GitHub issue

Expected Behavior

➜ echo "feat(code): KON-69 fix navbar style"  | npx commitlint
⧗   input: feat(code): KON-69 fix navbar style
✔   found 0 problems, 0 warnings

Current Behavior

➜ echo "feat(code): KON-69 fix navbar style"  | npx commitlint
⧗   input: feat(code): KON-69 fix navbar style
✖   references may not be empty [references-empty]
✖   found 1 problems, 0 warnings

~/code/1k/frontend develop

code/1k/frontend on  develop 
➜ echo "feat(code): KON-69 change navbar style"  | npx commitlint
⧗   input: feat(code): KON-69 change navbar style
✔   found 0 problems, 0 warnings


~/code/1k/frontend develop

code/1k/frontend on  develop 
➜ echo "feat(code): KON-69 update navbar style"  | npx commitlint
⧗   input: feat(code): KON-69 update navbar style
✔   found 0 problems, 0 warnings

Affected packages

  • [x ] cli
commitlint.config.js
/**
 * If you need to add your own validated
 * scope for git commit message, just add a new value to scope-enum
 * as shown below
 * code - this is general scope
 * deployment - when devops team does something related to CI/CD
 * see this: https://github.com/marionebl/commitlint/blob/master/%40commitlint/config-conventional/index.js
 * this solution require JIRA project prefix defined in issuePrefixes
 * and then reference-empty rule
 */
module.exports = {
  extends:      ['@commitlint/config-conventional'],
  parserPreset: {
    parserOpts: {
      issuePrefixes: ['KON-'],
    },
  },
  rules: {
    'header-max-length': [ 1, 'always', 72 ],
    'scope-enum':        [ 1, 'always', [
      'code',
      'deployment',
      'tests',
    ] ],
    'references-empty': [ 2, 'never' ],
  },

Your Environment

Executable Version
commitlint --version 6.1.3
git --version 2.7.1
node --version 8.7.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
viktorseccommented, Aug 22, 2018

This is because fix is a reserved word that expects to be followed by issue number. GitHub will then automatically close that issue after merging such commit into the default branch.

3reactions
marioneblcommented, Sep 4, 2018

@viktorsec is right, this is indeed correct yet a bit surprising behavior driven by conventional-commits-parser’s defaults:.

You could work around this by passing an empty referenceActions array to conventional changelog:

// commitlint.config.js
parserPreset: {
  parserOpts: {
    referenceActions: [],
    issuePrefixes: ['KON-'],
  },
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

husky - Strange error when attempting to commit. [subject-empty]
There is a package called husky that defines a certain template for your commit messages. If the template is not fulfilled, one gets...
Read more >
Blank, Coalesce, IsBlank, and IsEmpty functions in Power Apps
In the context of the IsEmpty function, empty is specific to tables that contain no records. The table structure may be intact, complete...
Read more >
How to delete parentheses for empty fields in references? - TeX
In particular issuing a \clearfield when the field is already empty will not bring any improvement whatsoever. There are two main reasons that...
Read more >
How to Write Good Commit Messages with Commitlint
This is not a good practice, as commit messages should be helpful and ... an empty JavaScript project with the respective package manager....
Read more >
Promela Reference -- empty(5) - Spin
empty - predefined, boolean function to test emptiness of a buffered ... The expression in which it appears, though, may not be negated....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found