Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with PhpCpd progress helper #19

Closed
nbk195 opened this issue May 7, 2016 · 7 comments
Closed

Error with PhpCpd progress helper #19

nbk195 opened this issue May 7, 2016 · 7 comments

Comments

@nbk195
Copy link

nbk195 commented May 7, 2016

Hi Guys,

first of all thanks for your tool, it's really great !
I encounter an issue with phpcpd running via phpqa. I've trying with parallel and non parallel execution, here the console output.

Output for  /Users/Cyril/.composer/vendor/edgedesign/phpqa/../../bin/phpcpd --progress  --exclude=build --exclude=vendor --exclude=Tests --exclude=scripts --exclude=var --exclude=web "./src" --min-lines 5 --min-tokens 70 --log-pmd "./build/phpcpd.xml" 
phpcpd 2.0.4 by Sebastian Bergmann.




  [Symfony\Component\Console\Exception\InvalidArgumentException]  
  The helper "progress" is not defined.                           


phpcpd [--names NAMES] [--names-exclude NAMES-EXCLUDE] [--exclude EXCLUDE] [--log-pmd LOG-PMD] [--min-lines MIN-LINES] [--min-tokens MIN-TOKENS] [--fuzzy] [--progress] [--] [<values>]...



 [Edge\QA\Task\NonParallelExec]  Exit code 2  Time 68.85s

With phpcpd 2.0.1 with same arguments no problem.
Can you help me please ?
Thanks
Cyril

@zdenekdrahos
Copy link
Member

It looks like bug in new version of phpcpd.

For now you can downgrade it, phpqa does not restrict versions.
phpcpd was upgraded in v1.5.0 (v2.0.2 to v2.0.4), so I guess that v2.0.2 should work:

composer global require sebastian/phpcpd:2.0.2

@nbk195
Copy link
Author

nbk195 commented May 7, 2016

Thanks a lot,

after a small struggle with phpcpd dependencies everything is fine...

@nbk195 nbk195 closed this as completed May 7, 2016
@zdenekdrahos
Copy link
Member

I've just had the same problem. The bug occurs when symfony/console version 3.X is installed. So instead of downgrading phpcpd, you can downgrade symfony/console and have latest version of phpcpd.

{
    "require": {
        "symfony/console": "~2.8",
        "edgedesign/phpqa": ">=1.5",
    }
}
composer global update symfony/console sebastian/phpcpd

@eko3alpha
Copy link

eko3alpha commented Sep 15, 2016

Im using the following docker image (docker-phpqa) and ran into this same issue, I can confirm that part of @zdenekdrahos 's solution removes this issue. I only changed the symfony/console version.

composer global require 'edgedesign/phpqa' --update-no-dev "symfony/console:~2.8"

Here is a verbose output using the latest phpqa build with only phpcpd

  [FileSystem\CleanDir] Cleaned build/
  [FileSystem\FilesystemStack] mkdir ["build\/"]
  0/1 [>---------------------------]   0% 0/1 [>---------------------------]   0% [ParallelExec] /composer/vendor/edgedesign/phpqa/../../bin/phpcpd --progress  --exclude=vendor "./" --min-lines 5 --min-tokens 70 --log-pmd "build//phpcpd.xml"

  [ParallelExec] Output for  /composer/vendor/edgedesign/phpqa/../../bin/phpcpd --progress  --exclude=vendor "./" --min-lines 5 --min-tokens 70 --log-pmd "build//phpcpd.xml" 

  1/1 [============================] 100%phpcpd 2.0.4 by Sebastian Bergmann.




 [Symfony\Component\Console\Exception\InvalidArgumentException]  
 The helper "progress" is not defined.                           


 phpcpd [--names NAMES] [--names-exclude NAMES-EXCLUDE] [--exclude EXCLUDE] [--log-pmd LOG-PMD] [--min-lines MIN-LINES] [--min-tokens MIN-TOKENS] [--fuzzy] [--progress] [--] [<values>]...



 [ParallelExec]  Exit code 1  Time 0.069s

 [phpqa] 
 +--------+----------------+--------------+--------+--------------------+
 | Tool   | Allowed Errors | Errors count | Is OK? | HTML report        |
 +--------+----------------+--------------+--------+--------------------+
 | phpcpd |                | 0            | x      | build//phpcpd.html |
 +--------+----------------+--------------+--------+--------------------+
 | phpqa  |                | 0            | x      | build//phpqa.html  |
 +--------+----------------+--------------+--------+--------------------+

 [phpqa] Failed tools: phpcpd

composer global require "symfony/console:~2.8" did the trick!

+------------+----------------+--------------+--------+------------------------+
| Tool       | Allowed Errors | Errors count | Is OK? | HTML report            |
+------------+----------------+--------------+--------+------------------------+
| phpcpd     |                | 0            | ✓      | build//phpcpd.html     |
+------------+----------------+--------------+--------+------------------------+
| phpqa      |                | 0            | ✓      | build//phpqa.html      |
+------------+----------------+--------------+--------+------------------------+

@zdenekdrahos
Copy link
Member

@eko3alpha: thanks for the docker image.
I've copy-pasted your example to readme. Feel free to send a PR with better tutorial :)

@eko3alpha
Copy link

Thanks! I certainly will. I love how this project makes it so easy to use all the tools together. I'm still wrapping my head around each individual tool and how to create custom rule sets. Once I have everything together I'll certainly contribute!

Great work!

@zdenekdrahos
Copy link
Member

The bug occurs when symfony/console version 3.X is installed. So instead of downgrading phpcpd, you can downgrade symfony/console and have latest version of phpcpd.

Install phpcpd dev-master If you need symfony/console 3.X:

composer require sebastian/phpcpd:dev-master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants