Closed
Description
Expected Behavior
Default setting for commentchar
is the output of git config core.commentchar
.
Current Behavior
Default setting for commentchar
is #
.
Affected packages
- clicorepromptconfig-angular
Context
Hi, thanks for this tool. The commentChar
setting appears to default to #
if not overridden explicitly:
commitlint/@commitlint/cli/src/cli.ts
Lines 224 to 229 in 1ee518c
I think it would be better if it defaulted to the output of git config core.commentchar
. I know I can override it in my config, but other people might have it set to something else (I have mine set globally in ~/.gitconfig
) so not sure how I can make that work without being able to specify a global override.
This was brought up before in #2351.
Activity
escapedcat commentedon May 22, 2022
Thanks! Uhm, sounds like a valid improvement. Do you have time to give that a try?
jscheid commentedon May 22, 2022
Sure, I can give it a go.
Can I remove this test? 5badf6d#diff-c89c0216f62496bace8eebb7c6e1f9c11a6f1a1f55acbff74afb358439363b88
escapedcat commentedon May 22, 2022
"Adjusting" sounds better, sure. I assume you could cover different examples with tests, right? Like i.s.
#
and$
?jscheid commentedon May 22, 2022
I meant that the test will fail after the change because
#1234
isn't an empty commit when commentChar is$
.escapedcat commentedon May 22, 2022
Yeah, makes sense
jscheid commentedon May 22, 2022
Should these instructions be working? It runs (
Found 0 errors
) but doesn't seem to pick up file changes incli.test.ts
. I'm on MacOSjscheid commentedon May 22, 2022
Ah,
yarn test
works (but only afteryarn build
). Might want to update the instructions. All good.escapedcat commentedon May 22, 2022
Looks like it only picks up changes in non-test files and does not run tests (anymore). The README might still reffer to the pre-TS setup. Happy for any improvements you're willing to add :)
jscheid commentedon May 22, 2022
Actually, can you help me understand that test case ☝️
It still passes when I comment out the line where it sets
core.commentChar
with git so that's irrelevant.typeof opts.parserOpts.commentChar !== 'string'
is false withfixtures/comment-char
, so the lineopts.parserOpts.commentChar = '#';
should never be executed.. andopts.parserOpts.commentChar
remain at$
which would mean#1234
isn't empty. But the test passes.So... does that mean
opts.parserOpts.commentChar
is ignored? What exactly is this test testing?fix(cli): use core.commentChar from git config with --edit flag (conv…
fix(cli): use core.commentChar from git config with --edit flag (conv…
core.commentChar
from git config with--edit
flag #3191jscheid commentedon May 22, 2022
I've worked it out, the test was broken because it checks to see if subject is empty but with a commit message like
#1234
the subject is always empty, regardless of comment char, because there's noxyz:
header. I've changed the tests to use body instead.PR pushed: #3191
6 remaining items