From 53b066a8cf9f9577c9dd22ad34caff703a6d7eee Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 16:16:04 +0200 Subject: [PATCH 1/6] Add exclude option to phpcs. --- src/Task/Phpcs.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Task/Phpcs.php b/src/Task/Phpcs.php index ab09ea4e4..acea95847 100644 --- a/src/Task/Phpcs.php +++ b/src/Task/Phpcs.php @@ -36,6 +36,7 @@ public function getConfigurableOptions(): OptionsResolver 'triggered_by' => ['php'], 'report' => 'full', 'report_width' => null, + 'exclude' => [], ]); $resolver->addAllowedTypes('standard', ['array', 'null', 'string']); @@ -50,6 +51,7 @@ public function getConfigurableOptions(): OptionsResolver $resolver->addAllowedTypes('triggered_by', ['array']); $resolver->addAllowedTypes('report', ['null', 'string']); $resolver->addAllowedTypes('report_width', ['null', 'int']); + $resolver->addAllowedTypes('standard', ['array']); return $resolver; } @@ -117,6 +119,7 @@ protected function addArgumentsFromConfig( $arguments->addOptionalIntegerArgument('--warning-severity=%s', $config['warning_severity']); $arguments->addOptionalCommaSeparatedArgument('--sniffs=%s', $config['sniffs']); $arguments->addOptionalCommaSeparatedArgument('--ignore=%s', $config['ignore_patterns']); + $arguments->addOptionalCommaSeparatedArgument('--exclude=%s', $config['exclude']); return $arguments; } From 4d114f001900d0eb890e41cb9e09aaa7f0e7f0d8 Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 16:29:09 +0200 Subject: [PATCH 2/6] Update phpcs.md --- doc/tasks/phpcs.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/tasks/phpcs.md b/doc/tasks/phpcs.md index 568a48e59..0fdcbe634 100644 --- a/doc/tasks/phpcs.md +++ b/doc/tasks/phpcs.md @@ -29,6 +29,7 @@ parameters: ignore_patterns: [] sniffs: [] triggered_by: [php] + exclude: [] ``` @@ -123,6 +124,12 @@ This is a list of sniffs that need to be executed. Leave this option blank to ru This is a list of extensions to be sniffed. +**exclude** + +*Default: []* + +A list of rules that should not be checked. Leave this option blank to run all configured rules for the selected standard. + ## Framework presets ### Symfony 2 From 2e1d361895fc7f10563a828ce66cfc0458c2d707 Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 16:32:30 +0200 Subject: [PATCH 3/6] Update Phpcs.php --- src/Task/Phpcs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Task/Phpcs.php b/src/Task/Phpcs.php index acea95847..573936216 100644 --- a/src/Task/Phpcs.php +++ b/src/Task/Phpcs.php @@ -51,7 +51,7 @@ public function getConfigurableOptions(): OptionsResolver $resolver->addAllowedTypes('triggered_by', ['array']); $resolver->addAllowedTypes('report', ['null', 'string']); $resolver->addAllowedTypes('report_width', ['null', 'int']); - $resolver->addAllowedTypes('standard', ['array']); + $resolver->addAllowedTypes('exclude', ['array']); return $resolver; } From 736f4459ea909fd0c734315212571d11c1945373 Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 18:41:42 +0200 Subject: [PATCH 4/6] Update PhpcsSpec.php --- spec/Task/PhpcsSpec.php | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/Task/PhpcsSpec.php b/spec/Task/PhpcsSpec.php index 7eec40932..75009e83c 100644 --- a/spec/Task/PhpcsSpec.php +++ b/spec/Task/PhpcsSpec.php @@ -52,6 +52,7 @@ function it_should_have_configurable_options() $options->getDefinedOptions()->shouldContain('ignore_patterns'); $options->getDefinedOptions()->shouldContain('sniffs'); $options->getDefinedOptions()->shouldContain('triggered_by'); + $options->getDefinedOptions()->shouldContain('exclude'); } function it_should_run_in_git_pre_commit_context(GitPreCommitContext $context) From 3273a22016f61bae85f082172b97139a4f88913c Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 19:02:13 +0200 Subject: [PATCH 5/6] Update PhpcsSpec.php --- spec/Task/PhpcsSpec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Task/PhpcsSpec.php b/spec/Task/PhpcsSpec.php index 75009e83c..16cdb25fb 100644 --- a/spec/Task/PhpcsSpec.php +++ b/spec/Task/PhpcsSpec.php @@ -52,7 +52,7 @@ function it_should_have_configurable_options() $options->getDefinedOptions()->shouldContain('ignore_patterns'); $options->getDefinedOptions()->shouldContain('sniffs'); $options->getDefinedOptions()->shouldContain('triggered_by'); - $options->getDefinedOptions()->shouldContain('exclude'); + //$options->getDefinedOptions()->shouldContain('exclude'); } function it_should_run_in_git_pre_commit_context(GitPreCommitContext $context) From 744b8c9d10089d6faee0f2b71cb47760117fbc28 Mon Sep 17 00:00:00 2001 From: Jeroen Tubex Date: Wed, 15 May 2019 19:02:25 +0200 Subject: [PATCH 6/6] Update PhpcsSpec.php --- spec/Task/PhpcsSpec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/Task/PhpcsSpec.php b/spec/Task/PhpcsSpec.php index 16cdb25fb..75009e83c 100644 --- a/spec/Task/PhpcsSpec.php +++ b/spec/Task/PhpcsSpec.php @@ -52,7 +52,7 @@ function it_should_have_configurable_options() $options->getDefinedOptions()->shouldContain('ignore_patterns'); $options->getDefinedOptions()->shouldContain('sniffs'); $options->getDefinedOptions()->shouldContain('triggered_by'); - //$options->getDefinedOptions()->shouldContain('exclude'); + $options->getDefinedOptions()->shouldContain('exclude'); } function it_should_run_in_git_pre_commit_context(GitPreCommitContext $context)