|
| 1 | +# Defaults for the code style check of the PHP blocks embedded in Behat feature |
| 2 | +# files, shared by `run-phpcs-tests` and `run-phpcbf-cleanup`. |
| 3 | +# |
| 4 | +# Keeping the list in one place is what makes the check and the fixer agree: a |
| 5 | +# sniff excluded for one but not the other would have the fixer rewrite feature |
| 6 | +# files over something the check never reports, or have the check report |
| 7 | +# something the fixer refuses to touch. |
| 8 | +# |
| 9 | +# The exclusions are passed on the command line rather than declared in a |
| 10 | +# ruleset because a ruleset aborts the whole run over a sniff that the installed |
| 11 | +# PHP_CodeSniffer does not know, while `--exclude` passes over it. The list |
| 12 | +# spans several major versions of PHP_CodeSniffer and of the standards it |
| 13 | +# builds on, and not every entry exists in all of them. |
| 14 | +# |
| 15 | +# A package replaces these defaults wholesale by adding a |
| 16 | +# `phpcs-feature-files.xml` (or `phpcs-feature-files.xml.dist`) ruleset to its |
| 17 | +# root, which is then used as the standard instead. |
| 18 | + |
| 19 | +WP_CLI_TESTS_FEATURE_STANDARD="WP_CLI_CS" |
| 20 | + |
| 21 | +# Warnings are advisory, and the fixer must not rewrite a feature file over |
| 22 | +# something the check does not report. |
| 23 | +WP_CLI_TESTS_FEATURE_ARGS="--warning-severity=0" |
| 24 | + |
| 25 | +# A block is not a file. It is padded with one empty line per preceding line of |
| 26 | +# the feature file so that reported line numbers match it, and one that does not |
| 27 | +# bring its own opening tag is given one. Neither is part of the snippet, and |
| 28 | +# the shared docstring indentation is taken off before the check and put back |
| 29 | +# afterwards, so none of the sniffs looking at a file as a whole apply. |
| 30 | +WP_CLI_TESTS_FEATURE_EXCLUDES="Generic.Files.InlineHTML" |
| 31 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Generic.PHP.CharacterBeforePHPOpenTag" |
| 32 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Generic.Files.LineEndings" |
| 33 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,PSR2.Files.EndFileNewline" |
| 34 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,PSR12.Files.FileHeader" |
| 35 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Squiz.Commenting.FileComment" |
| 36 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Generic.PHP.RequireStrictTypes" |
| 37 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,WordPress.Files.FileName" |
| 38 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Universal.WhiteSpace.PrecisionAlignment" |
| 39 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Squiz.WhiteSpace.SuperfluousWhitespace" |
| 40 | + |
| 41 | +# A block is a fixture, not production code. Snippets exist to set up a |
| 42 | +# scenario, run inside a throwaway WordPress installation, are written to be |
| 43 | +# read at a glance, and are routinely a single class or function on their own. |
| 44 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,WordPress.NamingConventions.PrefixAllGlobals" |
| 45 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,WordPress.WP.GlobalVariablesOverride" |
| 46 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,WordPress.PHP.YodaConditions" |
| 47 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Universal.Files.SeparateFunctionsFromOO" |
| 48 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Generic.Files.OneObjectStructurePerFile" |
| 49 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Universal.Namespaces.OneDeclarationPerFile" |
| 50 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Universal.Namespaces.DisallowCurlyBraceSyntax" |
| 51 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Universal.Namespaces.DisallowDeclarationWithoutName" |
| 52 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,PSR2.Methods.FunctionClosingBrace" |
| 53 | + |
| 54 | +# A snippet testing error handling is deliberately incomplete. |
| 55 | +WP_CLI_TESTS_FEATURE_EXCLUDES="$WP_CLI_TESTS_FEATURE_EXCLUDES,Generic.CodeAnalysis.EmptyStatement" |
| 56 | + |
| 57 | +WP_CLI_TESTS_FEATURE_ARGS="$WP_CLI_TESTS_FEATURE_ARGS --exclude=$WP_CLI_TESTS_FEATURE_EXCLUDES" |
0 commit comments