phpro / grumphp

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

Can not find parallel-lint executable [Windows] #249

Closed cedricdo closed 7 years ago

cedricdo commented 7 years ago
Q A
Branch master for features and deprecations
Bug? yes
New feature? no
Question? no
Documentation? no
Related tickets comma-separated list of related tickets

My configuration Windows 7 64 bits

C:\Vagrant\local.dev55.dodion\html\test>git --version
git version 2.9.3.windows.3

C:\Vagrant\local.dev55.dodion\html\test>php -v
PHP 5.6.25 (cli) (built: Aug 18 2016 11:40:20)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.3.3, Copyright (c) 2002-2015, by Derick Rethans

C:\Vagrant\local.dev55.dodion\html\test>composer --version
You are running composer with xdebug enabled. This has a major impact on runtime
 performance. See https://getcomposer.org/xdebug
Composer version 1.2.0 2016-07-19 01:28:52

C:\Vagrant\local.dev55.dodion\html\test>
# grumphp.yml
parameters:
    git_dir: .
    bin_dir: vendor/bin
    tasks:
        phplint: ~

Steps to reproduce:

mkdir test
cd test
git init
composer init
composer require --dev phpro/grumphp
composer require --dev jakub-onderka/php-parallel-lint
git add .
git commit -m "initial commit"
# set the grumphp.yml as the one above, create a file test.php with any content
git add .
git commit -m "test phplint"

Result:

C:\Vagrant\local.dev55.dodion\html\test>git commit -m "test phplint"
GrumPHP detected a pre-commit command.
GrumPHP is sniffing your code!
Running task 1/1: PhpLint
             ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
           ▄▄▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
         █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▄
        █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
       █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
  ▄███▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
 █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
 ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
   ▀█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
     ▀▀▓▓▓▓▓▓▓▓▓▓▓▓█▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████████▄
      ▄███████                       ██████████
     ███████▀  ▀▀▀▀▀▄      ▄▀▀▀▀▀     █████ ▀
      █████      ███        ███        █████
      █████                            ███
       ████           ▄▄ ▄▄           ████
        ███       ▄▄▄▄▄▄▄▄▄▄▄▄       ████
         ██▄ ████████████████████████████
        █▀███████████▀     ▀▀███████████
          ██████████▄███████▄███████████
         ██████████████████████████████
          █████████████████████████████
           ██ ████████████████████████▀
            ▀ █████████████████████ █▀
                ████▀████████▀████
                 ▀██  ██████  ███
                        ██▀   █▀

       ██████████████████████████████████
       █░░░░░░▀█▀░░░░░░▀█░░░░░░▀█▀░░░░░▀█
       █░░███░░█░░░██░░░█░░██░░░█░░░██░░█
       █░░███░░█░░░██░░░█░░██░░░█░░░██░░█
       █░░███░░█░░░██░░░█░░░░░░▄█░░▄▄▄▄▄█
       █░░███░░█░░░██░░░█░░░░████░░░░░░░█
       █░░░█░░░█▄░░░░░░▄█░░░░████▄░░░░░▄█
       ██████████████████████████████████

The executable for "parallel-lint" could not be found.
To skip commit checks, add -n or --no-verify flag to commit command

Warning: Your console font probably doesn't support Unicode. If you experience s
trange characters in the output, consider switching to a TrueType font such as C
onsolas!

C:\Vagrant\local.dev55.dodion\html\test>

If i try to exec vendor/bin/parallel-lint, i have an error saying it's not an executable file, which is correct. But if do do a sh vendor/bin/parallel-lint, i've a result :

C:\Vagrant\local.dev55.dodion\html\test>sh vendor/bin/parallel-lint ./test.php
PHP 5.6.25 | 10 parallel jobs
X                                                            1/1 (100 %)

Checked 1 files in 0.3 seconds
Syntax error found in 1 file

------------------------------------------------------------
Parse error: ./test.php:3
    1| <?php
    2|
  > 3| ();
Unexpected ')'

C:\Vagrant\local.dev55.dodion\html\test>

The issue is the same for any task.

Thanks in advance.

cedricdo commented 7 years ago

My bad, i found the origin of the issue. It has nothing to do with grumphp. As i'm using vagrant, i got my depencies in linux in vagrant so composer didn't generate the vendor/bin/.bat. But since my IDE is running on windows, it was looking for these .bat files.

Thanks for this nice project!

veewee commented 7 years ago

No problem! You might want to take a look at the documentation of the hooks_preset parameter: https://github.com/phpro/grumphp/blob/master/doc/parameters.md

This way you can run the specified actions inside your vagrant box instead of on your windows machine.

cedricdo commented 7 years ago

Thanks, i'll take a look at this.