Skip to content

Conversation

@zdenekdrahos
Copy link
Member

@zdenekdrahos zdenekdrahos commented May 8, 2017

Closes #60

  • configure dry-run and rules in .phpqa.yml
  • html report - demo
  • add as suggested tool
  • bin/suggested-tools.sh install doesn'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

@zdenekdrahos
Copy link
Member Author

@keradus, @mastercoding: could you try this version? thanks

composer update edgedesign/phpqa:dev-php-cs-fixer

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 |
Copy link

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
Copy link

@keradus keradus May 8, 2017

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

<xsl:template match="/">
<html>
<head>
<title>php-cs-fixer report</title>
Copy link

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()
Copy link

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

@mastercoding
Copy link

mastercoding commented May 8, 2017

Hi @zdenekdrahos! Great to see that you tackled this so soon. I would propose two configurable options in addition to what you've got:

  • using-cache (yes/no)
  • config

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?

@keradus
Copy link

keradus commented May 9, 2017

yeah, let point config file instead of mapping the properties

@zdenekdrahos
Copy link
Member Author

zdenekdrahos commented May 21, 2017

Thanks for great comments.

@keradus, @mastercoding: Cache can be disabled in config file. Is it necessary to define cache in .phpqa.yml?

@zdenekdrahos
Copy link
Member Author

@keradus, @mastercoding: is current version ok? Or is there something you'd like to change?

/vendor/
/build/
phpstan-phpqa.neon
.php_cs.cache
Copy link

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

$analyzedDirs = $this->options->getAnalyzedDirs();
$analyzedDir = reset($analyzedDirs);
if (count($analyzedDirs) > 1) {
$this->say("<error>php-cs-fixer analyzes only first directory {$analyzedDir}</error>");
Copy link

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
@zdenekdrahos zdenekdrahos merged commit 3227212 into master Jun 10, 2017
@zdenekdrahos zdenekdrahos deleted the php-cs-fixer branch June 10, 2017 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support PHP CS Fixer

4 participants