phpro / grumphp

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

vscode shows alert on phpcsfixer #975

Closed crissi closed 2 years ago

crissi commented 2 years ago
Q A
Version vendor/bin/grumphp -V
Question? yes

I want phpcsfixer to fix my files and commit them.

But right now it fixes the files, but do not commit them and this alert shows.

My configuration


grumphp:
    fixer:
        enabled: true
        fix_by_default: true
    tasks:
        phpcsfixer:
            config: .php-cs-fixer.dist.php
    git_hook_variables:
        EXEC_GRUMPHP_COMMAND: 'docker-compose exec -T php'

Steps to reproduce:

git add -A && git commit -m"Test"

Result: image

image

veewee commented 2 years ago

This is intended and documented behaviour:

GrumPHP provides a way of fixing your code. However, we won't automatically commit the changes, so that you have the chance to review what has been fixed! You can configure how fixers work with following config: See https://github.com/phpro/grumphp/blob/master/doc/parameters.md

crissi commented 2 years ago

I set the fixer to fix_by_default:

What else do I need? @veewee

veewee commented 2 years ago

Your configuration is correct:

It won't commit the changed files, since this could result in broken code being committed automatically by GrumPHP. Therefor, this requires a manual review + second commit