diff --git a/standards/Tighten/ruleset.xml b/standards/Tighten/ruleset.xml index ab4635c..cbabfe7 100644 --- a/standards/Tighten/ruleset.xml +++ b/standards/Tighten/ruleset.xml @@ -3,12 +3,13 @@ Tighten PHP CS rules for Laravel + */cache/* - */*.js - */*.css - */*.xml - */*.blade.php - */autoload.php + */*\.js + */*\.css + */*\.xml + */*\.blade\.php + */autoload\.php */storage/* */docs/* */vendor/* diff --git a/tests/Feature/LintCommandTest.php b/tests/Feature/LintCommandTest.php index aad73ae..5b19399 100755 --- a/tests/Feature/LintCommandTest.php +++ b/tests/Feature/LintCommandTest.php @@ -82,6 +82,22 @@ expect($statusCode)->toBe(0); }); +it('lints with PHP_CodeSniffer respecting ruleset exclude-patterns', function () { + [$statusCode, $output] = run('lint', [ + 'path' => base_path('tests/Fixtures/PhpCodeSnifferRulesetExclusions'), + '--using' => 'phpcs', + ]); + + expect($statusCode)->toBe(1) + ->and($output) + ->toContain('Linting using PHP_CodeSniffer') + ->toContain('Filename doesn\'t match class name') + ->toContain('WrongName') + ->toContain('NarrowingFileMustBeLinted') + ->not->toContain('AutoloadShouldNotBeLinted') + ->not->toContain('BladeShouldNotBeLinted'); +}); + it('lints with PHP CS Fixer', function () { [$statusCode, $output] = run('lint', [ 'path' => base_path('tests/Fixtures/PhpCsFixerFixableIssues'), diff --git a/tests/Fixtures/PhpCodeSnifferRulesetExclusions/ExampleClass.php b/tests/Fixtures/PhpCodeSnifferRulesetExclusions/ExampleClass.php new file mode 100644 index 0000000..b8d53ff --- /dev/null +++ b/tests/Fixtures/PhpCodeSnifferRulesetExclusions/ExampleClass.php @@ -0,0 +1,5 @@ + +