phpro / grumphp

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

grumphp is really verbose in a CI #817

Closed prudloff-insite closed 3 years ago

prudloff-insite commented 3 years ago
Q A
Version 0.22.0
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets

When running in a CI, grumphp is really verbose because the overwrite() method of ConsoleSectionOutput is not able to replace the text.

It would be nice to have an option to disable this behaviour and simply display the result at the end.

My configuration

---
grumphp:
  ascii:
    failed: ~
    succeeded: ~
  tasks:
    composer: ~
    jsonlint: ~
    yamllint: ~
    xmllint: ~
    phpcs:
      standard: tests/phpcs.xml
      triggered_by:
        - php
        - module
        - inc
        - install
        - test
        - profile
        - theme
        - info
        - txt
        - md
    phpmd:
      ruleset:
        - tests/phpmd.xml
    git_blacklist:
      keywords:
        - "kint("
        - "|raw"
        - "autoescape"
      triggered_by:
        - twig

Steps to reproduce: You can simulate this behaviour like this:

./vendor/bin/grumphp run | cat

Result:

GrumPHP is sniffing your code!

Running tasks with priority 0!
==============================

Running task 1/6: composer... 
Running task 2/6: jsonlint... 
Running task 3/6: yamllint... 
Running task 4/6: xmllint... 
Running task 5/6: phpcs... 
Running task 6/6: phpmd... 
Running task 1/6: composer... 
Running task 2/6: jsonlint... 
Running task 3/6: yamllint... 
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... 
Running task 6/6: phpmd... 
Running task 1/6: composer... 
Running task 2/6: jsonlint... ✔
Running task 3/6: yamllint... 
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... 
Running task 6/6: phpmd... 
Running task 1/6: composer... 
Running task 2/6: jsonlint... ✔
Running task 3/6: yamllint... ✔
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... 
Running task 6/6: phpmd... 
Running task 1/6: composer... ✔
Running task 2/6: jsonlint... ✔
Running task 3/6: yamllint... ✔
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... 
Running task 6/6: phpmd... 
Running task 1/6: composer... ✔
Running task 2/6: jsonlint... ✔
Running task 3/6: yamllint... ✔
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... ✔
Running task 6/6: phpmd... 
Running task 1/6: composer... ✔
Running task 2/6: jsonlint... ✔
Running task 3/6: yamllint... ✔
Running task 4/6: xmllint... ✔
Running task 5/6: phpcs... ✔
Running task 6/6: phpmd... ✔
veewee commented 3 years ago

That would be nice indeed. I was looking at the symfony/console a while ago to find out how we can determine if the overwrite will succeed or not, but didnt find it at the time. Feel free to suggest a solution!

prudloff-insite commented 3 years ago

I am not sure if this can be automated but having an option would be a correct workaround IMHO (similar to the --no-progress Composer option).

veewee commented 3 years ago

I was investigating this further last evening and think I might have something that works with default symfony/console settings. Need to test it out a bit more though :)

veewee commented 3 years ago

(FYI @prudloff-insite : I've uploaded the changeset to #818 - feel free to test it out)