phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 431 forks source link

Blacklist keywords not working somehow #59

Closed dstollie closed 9 years ago

dstollie commented 9 years ago

Hey guys,

For some reason i can still put my blacklisted keywords in my commit messages:

This is my grumpphp file

parameters:
    git_dir: .
    bin_dir: ./vendor/bin
    tasks:
        # Analyzes some PHP source code and tries to fix coding standards issues
        # Documentation for phpcsfixer: https://github.com/phpro/grumphp#php-cs-fixer
        # and for the used library PHP-CS-Fixer: https://github.com/FriendsOfPHP/PHP-CS-Fixer#usage
        phpcsfixer:
            level: "psr2"
            filters:
                #You can also blacklist the fixers you don't want by placing a dash in front of the fixer name, if this is more convenient
                - "-indentation"
                - "-elseif"
                - "-php_closing_tag"
        # The Phpcs task will sniff your code for bad coding standards.
        # Documentation for PHPCS https://github.com/phpro/grumphp#phpcs
        # ----
        # For now this task is commented because none of our theme classes are in namespaces and psr2 wants this.
        # ----
        phpcs:
            standard: "PSR2"
        # The Blacklist task will test your changes for blacklisted keywords in the commit messages
        # Documetation for blacklist https://github.com/phpro/grumphp#blacklist
        blacklist:
            keywords:
                - "die("
                - "var_dump("
                - "exit;"
                - " "
                - "global styling"
                - "spacings"
                - "test"

Here are some successfull commit messages:

commit 4828296a9b786fafbed7b0d9bbdfe4ba54ddf4c8
Author: Dennis Stolmeijer <*@hotmail.com>
Date:   Mon Nov 16 00:26:47 2015 +0100

    global styling

commit 3a754f42afdc78da4cd7dd0c35fa2ec19036e9c5
Author: Dennis Stolmeijer <*@hotmail.com>
Date:   Mon Nov 16 00:20:59 2015 +0100

    global styling

commit d185f76c52414fcdec01861d8b0e0b69421dd314
Author: Dennis Stolmeijer <*@hotmail.com>
Date:   Mon Nov 16 00:19:58 2015 +0100

    die()

commit d7cd48f4d94f106bb1000f84861b8afb24563d59
Author: Dennis Stolmeijer <*@hotmail.com>
Date:   Mon Nov 16 00:19:16 2015 +0100

    die()

Hope you guys can help me out

veewee commented 9 years ago

Hello @dstollie,

The blacklist task only scans the committed lines for blacklisted strings. The commit message won't be checked. For validating to the commit message, you can use the git_commit_message task as described here: https://github.com/phpro/grumphp#git-commit-message-git_commit_message

dstollie commented 9 years ago

Thanks! I was somewhat confused.