phpro / grumphp

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

enforce_single_lined_subject raises error when message is one line #413

Closed glamorous closed 6 years ago

glamorous commented 6 years ago
Q A
Version 0.12.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets comma-separated list of related tickets

My configuration

parameters:
    git_dir: .
    bin_dir: vendor/bin
    tasks:
      composer: ~
      git_commit_message:
        enforce_capitalized_subject: false
        max_subject_width: 72
        matchers:
          - /^(bugfix|feature|refactor|cleanup|typo|other|test|doc|release|sync|staging) - /

Steps to reproduce:

# Prepare new commit in bash
touch test.txt
git commit
# bash "opens window" to add git commit message
# you add:
other - test of my commits works

# There is no blank line, only commits
# GrumpHP has runned and gives the `enforce_single_lined_subject ` error

Result:

Subject should be one line and followed by a blank line.

If you commit through git commit -am 'other - here is my message' there is no such error. Not logical that this check run if you commit message is only one line and not multiline. It should only check for the blank lines if more then one line is given.

geoffreyvanwyk commented 6 years ago

Seems to be fixed in master branch: https://github.com/phpro/grumphp/commit/2844ed06f8d1b78ba888e15a2adcb21b11118176

glamorous commented 6 years ago

@systemovich Did you test it too? Doesn't seems that it was mentioned to fix this problem too. The bug described from me has to do with no blank line between subject and (potential) comments