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.

`body-max-line-length` should not report false positives for line starts with `#`

See original GitHub issue

Expected Behavior

body-max-line-length should not report false positives for line starts with #

Current Behavior

body-max-line-length report false positives for line starts with #

While debuging in the node_modules/@commitlint/rules/lib/body-max-line-length.js

I found parsed.body have the following value as follows:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch chore/sync-remote-config2
# Your branch is up to date with 'origin/chore/sync-remote-config2'.
#
# Changes to be committed:
#       modified:   packages/code-standard-cli/package.json
#       new file:   packages/xxx/src/_private/yyyy/diffConfig.ts
#       renamed:   packages/xxx/src/_private/yyyy/foo/bar.ts ->  packages/xxx/src/_private/yyyy/foo/barabcdefg.ts
# 

Obviously, the lines come from the git commit command line, and should be ignored as they starts with #

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. First step
  2. Second step
commitlint.config.js ```js ```

Context

Your Environment

Executable Version
commitlint --version VERSION
git --version VERSION
node --version VERSION

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
escapedcatcommented, Jan 20, 2022

Should be fixed with 16.1.0.
@xboy2012 please give it a try and close this this issue if it works. Thanks.
@Zirak thanks for your PR!

1reaction
Zirakcommented, Jan 15, 2022

Why the following codes are not OK?

// Create parser opts from factory if (isParserOptsFunction(parser)) {

From my understanding @xboy2012, that logic isn’t reached. Since earlier in the function there’s a check which filters out all non-objects, no matter what function is passed in the result is undefined:

loadParserOpts(() => {}) // undefined

It applies to passing in an object with a parserOpts function and a certain name, like:

loadParserOpts({
  name: 'conventional-changelog-example',
  parserOpts: () => {}, // <-- this will be called
})

As I mentioned above, function support could be added by conditionally checking for passing in functions earlier in the code, and dealing with that there. If there’s interest I can draw up a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example Responses to False Positives in a Security Review ...
The following example shows how to document your responses to false positives listed in a Salesforce security review failure report. It's written to...
Read more >
Mark as False Positives - Knowledge Base - Outpost24
Go to Main Menu > Netsec > Reporting Tools. Select a group in Target Group. In the Findings tab, select the finding to...
Read more >
Diff - TF-A/trusted-firmware-a - Gitiles
In this case, 4096 is greater than 32, so the L0 +tables must be aligned to 4096 bytes. + +Sample calculation for L1...
Read more >
Vulnerability Scan Reports: Tired of Marking False Positives?
For unauthenticated scans, do not provide critical information such as software or kernel versions. Know what information is returned from ...
Read more >
debian-packaging: gitlint - Progress Linux
+- If you're looking to contribute code to gitlint, please start here: ... + title-must-not-contain-word, body-max-line-length, body-trailing-whitespace, ...
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