Skip to content

body-leading-blank complains about missing line #876

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

Closed
1 of 4 tasks
kai156277 opened this issue Dec 14, 2019 · 8 comments
Closed
1 of 4 tasks

body-leading-blank complains about missing line #876

kai156277 opened this issue Dec 14, 2019 · 8 comments

Comments

@kai156277
Copy link

Expected Behavior

body-leading-blank should pass if the body has a leading blank line

Current Behavior

body-leading-blank returns a warning if the body has a leading blank line
and is present.

If no body exists no warning is returned

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. create a message like below
chore(zf9012): zf9012 模块加入 modules.pro 

import_lib 中包含第三方依赖库和其配置
$ commitlint -e
⧗   input: chore(zf9012): zf9012 模块加入 modules.pro  
⚠   body must have leading blank line [body-leading-blank]

⚠   found 0 problems, 1 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
commitlint.config.js
{
    extends: ['@commitlint/config-conventional'],
        rules: {
        'body-leading-blank': [1, 'always'],        // body 和 header 之间总是包含空行
        'footer-leading-blank': [1, 'always'],      // footer 和 body 之间总是包含空行
        'header-max-length': [2, 'always', 72],     // header 的最大长度
        'scope-case': [2, 'always', 'lower-case'],  // scope 总是为小写
        'scope-empty': [2, 'never'],                // scope 不允许为空
        'scope-enum': [ // scope 必须满足以下字段
            2,
            'always',
            [
                'ladybug5',
                'ladybug5p',
                'lbas',
                'lucid',
                'novatel',
                'octans',
                'r2sonic',
                'riegl',
                'seabat7125',
                'zf9012',
                'non-sensor'
            ]
        ],
        'subject-case': [                           // subject 不允许为以下格式
            2,
            'never',
            [
                'sentence-case',    // Sentence case
                'start-case',       // Start Case
                'pascal-case',      // PascalCase
                'upper-case'        // UPPERCASE
            ]
        ],
        'subject-empty': [2, 'never'],              // subject 不允许为空
        'subject-full-stop': [2, 'never', '.'],     // subject 不允许以 . 结尾
        'type-case': [2, 'always', 'lower-case'],   // type 总是为小写
        'type-empty': [2, 'never'],                 // type 不允许为空
        'type-enum': [                              // type 必须满足以下字段
            2,
            'always',
            [
                'build',    // 编译环境发生改变
                'chore',    // 构建构成或辅助工具的变动 (eg: 本文件的改动)
                'ci',       // 持续集成环境改变
                'docs',     // 文档修改
                'feat',     // 新增功能
                'fix',      // 修复 bug
                'perf',     // 性能优化
                'refactor', // 重构,既不是新功能的增加,也不是修复 bug
                'revert',   // 回退
                'style',    // 代码样式的变更
                'test'      // 测试
            ]
        ]
    }
}

Context

Your Environment

Executable Version
commitlint --version 8.2.0
git --version 2.240.0.windows.1
node --version v12.13.1
@escapedcat
Copy link
Member

git commit -m 'chore(zf9012): zf9012 模块加入 modules.pro

import_lib 中包含第三方依赖库和其配置'
husky > commit-msg (node v10.1.0)
[development 12345678] chore(zf9012): zf9012 模块加入 modules.pro
 1 file changed, 1 insertion(+)

Weird. Looks ok here. I tested it with your config on OSX using node v10.1.0.
I wonder if this is related to Windows somehow.

@kai156277
Copy link
Author

git commit -m 'chore(zf9012): zf9012 模块加入 modules.pro

import_lib 中包含第三方依赖库和其配置'
husky > commit-msg (node v10.1.0)
[development 12345678] chore(zf9012): zf9012 模块加入 modules.pro
 1 file changed, 1 insertion(+)

Weird. Looks ok here. I tested it with your config on OSX using node v10.1.0.
I wonder if this is related to Windows somehow.

my node --version is v12.13.1 , I dont known why husky > commit-msg(node v10.1.0)`

@escapedcat
Copy link
Member

I tried it with v12.13.1 as well and it works. I can only assume it might be Windows related.

@kai156277
Copy link
Author

I tried same config in other PC . it as well and it works.....,so sad.

@escapedcat
Copy link
Member

怎么办呢? The other PC was also Windows? And it worked?

@kai156277
Copy link
Author

other PC is windows, it worked ....

@mschilli87
Copy link

I can reproduce this issue.

Executable Version
commitlint --version @commitlint/[email protected]
git --version git version 2.34.1
node --version v14.17.6

@escapedcat
Copy link
Member

@mschilli87 please open a new issue an provide more info, i.e. commit message, OS, commitlint-config, whatever might be relevant. Thanks

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