Skip to content

The body is truncated #3428

Closed
Closed
@tehraninasab

Description

@tehraninasab

Expected Behavior

The body shouldn't be truncated.

Current Behavior

The body is truncated unexpectedly when there is a pattern like '- Something between dashes -' in the commit message body:

The commit message:

Fix: catch/retry new -32002 err code

CI on master branch caught this:

```
Unhandled Exception:
System.AggregateException: One or more errors occurred. (Some problem when connecting to 'api.mycryptoapi.com/eth')

--- End of stack trace from previous location where exception was thrown ---

at GWallet.Backend.FSharpUtil.ReRaise (System.Exception ex) [0x00000] in /Users/runner/work/geewallet/geewallet/src/GWallet.Backend/FSharpUtil.fs:206
...
```

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Steps to Reproduce

Developed a local plugin like documented here:
https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-plugins.md#local-plugins
So the config file starts like this:

module.exports = {
    parserPreset: 'conventional-changelog-conventionalcommits',
    rules: {
        'body-leading-blank': [RuleStatus.Warning, 'always'],
        'body-soft-max-line-length': [RuleStatus.Error, 'always'],
        'footer-leading-blank': [RuleStatus.Warning, 'always'],
        'footer-max-line-length': [RuleStatus.Error, 'always', 150],
        'header-max-length': [RuleStatus.Error, 'always', 50],
        'subject-full-stop': [RuleStatus.Error, 'never', '.'],
        'type-empty': [RuleStatus.Warning, 'never'],
        'type-space-after-colon': [RuleStatus.Error, 'always'],
        'subject-lowercase': [RuleStatus.Error, 'always'],
        'body-prose': [RuleStatus.Error, 'always'],
        'type-space-after-comma': [RuleStatus.Error, 'always'],
        'trailing-whitespace': [RuleStatus.Error, 'always'],
        'prefer-slash-over-backslash': [RuleStatus.Error, 'always'],
        'type-space-before-paren': [RuleStatus.Error, 'always'],
        'proper-issue-refs': [RuleStatus.Error, 'always'],
    },
    plugins: [
        {
            rules: {
                'proper-issue-refs': ({body}: {body:any}) => {
                    let offence = false;   
                    if (body !== null) {
                        let bodyStr = convertAnyToString(body, "body");
                        console.log(bodyStr)
                        bodyStr = removeAllCodeBlocks(bodyStr);
                        offence = includeHashtagRef(bodyStr);
                    }

                    return [
                        !offence,
                        `Please use full URLs instead of #XYZ refs.`
                    ];
                },


...

  1. Run the plugin against the commit message mentioned in the Current Behaviour

  2. The body in 'body-soft-max-line-length' is truncated as mentioned in the Current Behaviour section.

Context

No response

commitlint --version

17.3.0

git --version

2.34.1

node --version

v18.12.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions