phpro / grumphp

A PHP code-quality tool
MIT License
4.14k stars 430 forks source link

max_body_width setting of git task also is applied to commented lines #406

Closed schmengler closed 7 years ago

schmengler commented 7 years ago
Q A
Version 0.12.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets

The max_body_witdth check for git commit messages should exclude lines starting with #. These are comments that do not end up in the commit and often are automatically generated with long lines, for example in merge commits or with a localized git installation.

My configuration

# grumphp.yml
parameters:
    tasks:
        git_commit_message:
            max_subject_width: 80
            max_body_width: 80

Steps to reproduce:

# Generate empty folder
mkdir tmp
cd tmp
git init
echo "vendor" > .gitignore
pbpaste > grumphp.yml
composer require --dev phpro/grumphp

# Your actions

git commit --allow-empty -m "Test

# this looks like a long line, but it won't actually end up in the commit. I am writing random stuff now to reach the limit. Knowledge is power, France is bacon.
"

Result:

Line 3 of commit message has > 80 characters.
veewee commented 7 years ago

Fixed in #407