Skip to content

Commit

Permalink
[PSR-2 Compliance] The Great @codingStandardsIgnoreFile Massacre
Browse files Browse the repository at this point in the history
- adjust php-cs-fixer configuration: add is_null and method_separation rules already enforced by phpcs sniffers, update excluded paths
  • Loading branch information
orlangur committed Apr 22, 2017
1 parent bbe3ee0 commit a1f9e1a
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,16 @@
* Pre-commit hook installation:
* vendor/bin/static-review.php hook:install dev/tools/Magento/Tools/StaticReview/pre-commit .git/hooks/pre-commit
*/
$finder = PhpCsFixer\Finder::create()
->name('*.phtml')
->exclude('dev/tests/functional/generated')
->exclude('dev/tests/functional/var')
->exclude('dev/tests/functional/vendor')
->exclude('dev/tests/integration/tmp')
->exclude('dev/tests/integration/var')
->exclude('lib/internal/Cm')
->exclude('lib/internal/Credis')
->exclude('lib/internal/Less')
->exclude('lib/internal/LinLibertineFont')
->exclude('pub/media')
->exclude('pub/static')
->exclude('setup/vendor')
->exclude('var');

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
'include' => true,
'is_null' => ['use_yoda_style' => false],

This comment has been minimized.

Copy link
@orlangur

orlangur Apr 23, 2017

Author Owner

is_null rule is considered to be risky just because of potential is_null function overriding: PHP-CS-Fixer/PHP-CS-Fixer#2534 (comment)

Which is not the case for Magento.

'method_separation' => true,

This comment has been minimized.

Copy link
@orlangur

orlangur Apr 23, 2017

Author Owner

This fixes a lot of "Empty line missed" violations by custom Magento PHPCS sniff.

'new_with_braces' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
Expand All @@ -46,4 +33,19 @@ return PhpCsFixer\Config::create()
'ordered_imports' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
]);
])
->setFinder(
PhpCsFixer\Finder::create()
->name('*.phtml')
->exclude('dev/tests/functional/generated')
->exclude('dev/tests/functional/var')
->exclude('dev/tests/functional/vendor')
->exclude('dev/tests/integration/tmp')
->exclude('dev/tests/integration/var')
->exclude('generated')
->exclude('lib/internal/LinLibertineFont')
->exclude('pub/media')
->exclude('pub/static')
->exclude('setup/vendor')
->exclude('var')
);

0 comments on commit a1f9e1a

Please sign in to comment.