- 
                Notifications
    You must be signed in to change notification settings 
- Fork 58
Support php-cs-fixer #66
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
Conversation
| @keradus, @mastercoding: could you try this version? thanks  | 
        
          
                README.md
              
                Outdated
          
        
      |  | ||
| Tool | PHP | Supported since | Description | Status | | ||
| ---- | --- | --------------- | ----------- | ------ | | ||
| [php-cs-fixer](http://cs.sensiolabs.org/) | `>= 5.6` | `1.12` | Automatically detect and fix PHP coding standards issues | stable | | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: if you want support for lower PHP, go with PHP CS Fixer v2.2+
| [phpcs.standard](https://pear.php.net/manual/en/package.php.php-codesniffer.usage.php#package.php.php-codesniffer.usage.coding-standard) | Coding standard | PSR2 | Name of existing standard (`PEAR`, `PHPCS`, `PSR1`, `PSR2`, `Squiz`, `Zend`), or path to your coding standard | ||
| [phpcs.ignoreWarnings](https://github.com/EdgedesignCZ/phpqa/issues/53) | If number of allowed errors is compared with warnings+errors, or just errors from `checkstyle.xml` | `false` | Boolean value | ||
| [phpcs.reports](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting) | Report types | [`full`](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting#printing-full-and-summary-reports) report in [cli mode](#output-modes), [`checkstyle`](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting#printing-a-checkstyle-report) in [file mode](#output-modes) | Predefined [report types](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Reporting) or [custom reports](https://github.com/wikidi/codesniffer#examples) | ||
| [php-cs-fixer.rules](http://cs.sensiolabs.org/#usage) | Coding standard rules | `@PSR2` | String value | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may require risky support, as some of the rules require that to be enabled
        
          
                app/report/php-cs-fixer.xsl
              
                Outdated
          
        
      | <xsl:template match="/"> | ||
| <html> | ||
| <head> | ||
| <title>php-cs-fixer report</title> | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP CS Fixer report
(tool name is PHP CS Fixer, not php-cs-fixer)
| ); | ||
| } | ||
|  | ||
| private function phpcsfixer() | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you like, you could execute the code (FixCommand) instead of running it as separated CLI process
| Hi @zdenekdrahos! Great to see that you tackled this so soon. I would propose two configurable options in addition to what you've got: 
 The cache is because the results with cache enabled are not always the same. I would default to not using cache. The configuration file i've got for php-cs-fixer is complex (https://gist.github.com/mastercoding/49db81e63b5b849779ecb79bd1e896e0). It would almost be impossible to put that in your tool. What do you think? | 
| yeah, let point config file instead of mapping the properties | 
| Thanks for great comments. @keradus, @mastercoding: Cache can be disabled in config file. Is it necessary to define cache in  | 
The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 17 https://travis-ci.org/EdgedesignCZ/phpqa/jobs/229883765
v2.2 supports older php and symfony2 components
…rules in .phpqa.yml
a6fb482    to
    966dda6      
    Compare
  
    | @keradus, @mastercoding: is current version ok? Or is there something you'd like to change? | 
| /vendor/ | ||
| /build/ | ||
| phpstan-phpqa.neon | ||
| .php_cs.cache | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add .php_cs (not .php_cs.dist) as well
        
          
                src/CodeAnalysisTasks.php
              
                Outdated
          
        
      | $analyzedDirs = $this->options->getAnalyzedDirs(); | ||
| $analyzedDir = reset($analyzedDirs); | ||
| if (count($analyzedDirs) > 1) { | ||
| $this->say("<error>php-cs-fixer analyzes only first directory {$analyzedDir}</error>"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
huh? you could provide multiple paths (dirs or files) in single CLI run
[PhpCsFixer\ConfigurationException\InvalidConfigurationException] For multiple paths config parameter is required. PHP-CS-Fixer/PHP-CS-Fixer#2390
Closes #60
.phpqa.ymlbin/suggested-tools.sh installdoesn't work in default "clone", the tool needs Symfony3 components# install php-cs-fixer after git clone composer require friendsofphp/php-cs-fixer symfony/filesystem symfony/config symfony/process symfony/finder symfony/console symfony/event-dispatcher phploc/phploc