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

Expect newlines in output after linting commit messages #504

Closed
1 of 4 tasks
hsxfjames opened this issue Nov 29, 2018 · 3 comments
Closed
1 of 4 tasks

Expect newlines in output after linting commit messages #504

hsxfjames opened this issue Nov 29, 2018 · 3 comments

Comments

@hsxfjames
Copy link

hsxfjames commented Nov 29, 2018

When I try to merge more than two branches, commitlint will print its output before git's diff info. Then git will continue to print its output but without a newline.

Current Behavior

▶ git merge dev_name_A dev_name_B
Fast-forwarding to: dev_name_A
Trying simple merge with dev_name_B
Simple merge did not work, trying automatic merge.
Auto-merging package-lock.json
Auto-merging package.json
husky > commit-msg (node v10.12.0)

⧗   input: Merge branches 'dev_name_A' and 'dev_name_B' into dev_name_C
✔   found 0 problems, 0 warningsMerge made by the 'octopus' strategy.
 build/prod.js                                                         |   2 +-

 ...any other diff info

Expected Behavior

⧗   input: Merge branches 'dev_name_A' and 'dev_name_B' into dev_name_C
✔   found 0 problems, 0 warnings

Merge made by the 'octopus' strategy.
 build/prod.js                                                         |   2 +-

 ...any other diff info

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Print additional newlines after printing commitlint's output.

Steps to Reproduce (for bugs)

  1. Create three git chunks.
  2. Merge two of those chunks into another chunk.
commitlint.config.js
module.exports = {
    extends: ['@commitlint/config-conventional'],
    rules: {
        'scope-empty': [2, 'never'],
        'scope-enum': [2, 'always', [
            'scope-A',
            'scope-B',
        ]],
        'subject-empty': [2, 'never'],
        'subject-case': [0, 'never'],
    },
};

Context

Your Environment

Executable Version
commitlint --version 7.2.1
git --version 2.19.2
node --version v10.12.0
Others Version
husky 1.2.0
os macOS Mojave 10.14.1
@RoyalHunt
Copy link

In master we have newline in code. Problem could be in not published package @commitlint/format, cause in npm we have version not from master branch

@hsxfjames
Copy link
Author

hsxfjames commented Dec 7, 2018

@RoyalHunt No, I look into the code of locally installed package, and also found the newline.

So I test it in another way, and below is the origin output when I generate a commit:

▶ touch b
▶ git add .
▶ git commit -m "test: 123"
husky > commit-msg (node v10.12.0)

⧗   input: test: 123
✔   found 0 problems, 0 warnings[v1 28bf5c5] test: 123
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 b

Redirect the output from stdout into file(but I don't know what is % stands for):

▶ git reset --soft HEAD^1
▶ git commit -m "test: 123" > out
husky > commit-msg (node v10.12.0)

⧗   input: test: 123
✔   found 0 problems, 0 warnings%

and then:

▶ cat out
[v1 36ae863] test: 123
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 b

Seems they were output into different stream.

@hsxfjames hsxfjames changed the title Expect newlines after linting "Merge branch ..." message in output Expect newlines in output after linting commit messages Dec 7, 2018
escapedcat added a commit to escapedcat/commitlint that referenced this issue Dec 12, 2018
@marionebl
Copy link
Contributor

Adressed via #518

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