phpro / grumphp

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

Php7cc task does not work correctly #296

Closed lucalbert closed 7 years ago

lucalbert commented 7 years ago
Q A
Bug yes

My configuration

parameters:
    git_dir: .
    bin_dir: vendor/bin
    tasks:
      php7cc: ~

Composer file

{
  "require-dev" : {
    "phpro/grumphp" : "^0.11.1",
    "sstalle/php7cc": "^1.1"
  }
}

Test files

<?php
// bad.php
$a = mktime(5, 5, 5, 5, 5, 2000, -1);
<?php
// good.php
$a = mktime(5, 5, 5, 5, 5, 2000);

Run Php7cc standalone:

./vendor/bin/php7cc --except=vendor .

Result

File: bad.php
> Line 2: Removed argument $is_dst used for function "mktime"
    mktime(5, 5, 5, 5, 5, 2000, -1);

Checked 2 files in 0.023 second

Run GrumPHP:

./vendor/bin/grumphp run -vvv

Result:

[2017-02-15 12:32:13] GrumPHP.INFO: run command: ls-files ""  [] []
[2017-02-15 12:32:14] GrumPHP.DEBUG: last command (ls-files) duration: 207.75ms [] []
[2017-02-15 12:32:14] GrumPHP.DEBUG: last command (ls-files) return code: 0 [] []
[2017-02-15 12:32:14] GrumPHP.DEBUG: last command (ls-files) output: bad.php composer.json good.php grumphp.yml  [] []
GrumPHP is sniffing your code!
Running task 1/1: Php7cc
Command: 'vendor/bin/php7cc' 'bad.php' 'good.php'

                          ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
           ▄▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌           
         ▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
        ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
  ▄▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌
 ▐▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
 ▐█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
   ▀█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▌        
     ▀▀▓▓▓▓▓▓▓▓▓▓▓▓█▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████████▄
      ▄████████▀▀▀▀▀                 ██████████   
     ███████▀                         ██████▀
      ▐████      ██▌          ██       ████▌      
        ▐█▌                            ███        
         █▌           ▄▄ ▄▄           ▐███        
        ███       ▄▄▄▄▄▄▄▄▄▄▄▄       ▐███         
         ██▄ ▐███████████████████████████
        █▀█████████▌▀▀▀▀▀▀▀▀▀██████████▌▐         
          ███████████▄▄▄▄▄▄▄███████████▌          
         ▐█████████████████████████████           
          █████████████████████████████           
           ██ █████████████████████▐██▀           
            ▀ ▐███████████████████▌ ▐▀            
                ████▀████████▀▐███                
                 ▀█▌  ▐█████  ▐█▌                 
                        ██▀   ▐▀                  
       _    _ _                         _ _
      / \  | | |   __ _  ___   ___   __| | |
     / _ \ | | |  / _` |/ _ \ / _ \ / _` | |
    / ___ \| | | | (_| | (_) | (_) | (_| |_|
   /_/   \_\_|_|  \__, |\___/ \___/ \__,_(_)
                  |___/

But all is not good :(

veewee commented 7 years ago

Thanks for reporting @lucalbert,

We'll have to dig into this one.

jyggen commented 7 years ago

The issue seems to be due to php7cc always returning exit code 0.