|
| 1 | +<?xml version="1.0"?> |
| 2 | +<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="wp-parsely" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> |
| 3 | + <description>Custom ruleset for Edit Flow plugin.</description> |
| 4 | + |
| 5 | + <!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> |
| 6 | + <!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> |
| 7 | + |
| 8 | + <!-- What to scan --> |
| 9 | + <file>.</file> |
| 10 | + <!-- Ignoring Files and Folders: |
| 11 | + https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders --> |
| 12 | + <exclude-pattern>/node_modules/</exclude-pattern> |
| 13 | + <exclude-pattern>/vendor/</exclude-pattern> |
| 14 | + <exclude-pattern>/tests/</exclude-pattern> |
| 15 | + |
| 16 | + <!-- How to scan --> |
| 17 | + <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> |
| 18 | + <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> |
| 19 | + <!-- Show sniff and progress --> |
| 20 | + <arg value="sp"/> |
| 21 | + <!-- Strip the file paths down to the relevant bit --> |
| 22 | + <arg name="basepath" value="./"/> |
| 23 | + <!-- Show results with colors --> |
| 24 | + <arg name="colors"/> |
| 25 | + <!-- Limit to PHP files --> |
| 26 | + <arg name="extensions" value="php"/> |
| 27 | + <!-- Enables parallel processing when available for faster results. --> |
| 28 | + <arg name="parallel" value="8"/> |
| 29 | + |
| 30 | + <!-- Rules: Check PHP version compatibility - see |
| 31 | + https://github.com/PHPCompatibility/PHPCompatibilityWP --> |
| 32 | + <rule ref="PHPCompatibilityWP"/> |
| 33 | + <!-- For help in understanding this testVersion: |
| 34 | + https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> |
| 35 | + <config name="testVersion" value="8.0-"/> |
| 36 | + |
| 37 | + <!-- Rules: WordPress Coding Standards - see |
| 38 | + https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> |
| 39 | + <!-- WordPress-Extra includes WordPress-Core --> |
| 40 | + <rule ref="WordPress-Extra"/> |
| 41 | + <rule ref="WordPress-Docs"/> |
| 42 | + <!-- For help in understanding these custom sniff properties: |
| 43 | + https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> |
| 44 | + <config name="minimum_supported_wp_version" value="6.4"/> |
| 45 | + |
| 46 | + <!-- Rules: WordPress VIP - see |
| 47 | + https://github.com/Automattic/VIP-Coding-Standards --> |
| 48 | + <rule ref="WordPress-VIP-Go"> |
| 49 | + <!-- These disallow anonymous functions as action callbacks --> |
| 50 | + <exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" /> |
| 51 | + <exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" /> |
| 52 | + <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" /> |
| 53 | + |
| 54 | + <!-- Allow short array syntax --> |
| 55 | + <exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" /> |
| 56 | + |
| 57 | + <!-- Do not enforce 'class-' prefix --> |
| 58 | + <exclude name="WordPress.Files.FileName.InvalidClassFileName" /> |
| 59 | + |
| 60 | + <!-- Allow short ternaries --> |
| 61 | + <exclude name="WordPress.PHP.DisallowShortTernary.Found" /> |
| 62 | + |
| 63 | + <!-- Generates too many false positives --> |
| 64 | + <exclude name="WordPress.WP.CapitalPDangit.Misspelled" /> |
| 65 | + |
| 66 | + <!-- We use trigger_error extensively --> |
| 67 | + <exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" /> |
| 68 | + |
| 69 | + <!-- ToDo: Remove these exceptions over time --> |
| 70 | + <!-- These are for legacy reasons, as EditFlow's main file cannot be altered --> |
| 71 | + <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" /> |
| 72 | + <exclude name="Universal.Files.SeparateFunctionsFromOO.Mixed" /> |
| 73 | + <exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital" /> |
| 74 | + <exclude name="PEAR.NamingConventions.ValidClassName.Invalid" /> |
| 75 | + <!-- Allow not returning after the setup theme filter for now --> |
| 76 | + <exclude name="WordPressVIPMinimum.Hooks.AlwaysReturnInFilter.MissingReturnStatement" /> |
| 77 | + <!-- Localization is done in a legacy manner in some places, and its been left as is for now --> |
| 78 | + <exclude name="WordPress.WP.I18n.InterpolatedVariableSingular" /> |
| 79 | + <exclude name="WordPress.WP.I18n.InterpolatedVariablePlural" /> |
| 80 | + <exclude name="WordPress.WP.I18n.MissingSingularPlaceholder" /> |
| 81 | + <exclude name="WordPress.WP.I18n.NonSingularStringLiteralText" /> |
| 82 | + <!-- This rule is hard to solve given the heavy use of JS in the PHP code right now --> |
| 83 | + <exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure" /> |
| 84 | + <exclude name="WordPress.DateTime.RestrictedFunctions.date_date" /> |
| 85 | + </rule> |
| 86 | + |
| 87 | + <rule ref="WordPress.NamingConventions.PrefixAllGlobals"> |
| 88 | + <properties> |
| 89 | + <property name="prefixes" type="array"> |
| 90 | + <element value="ef"/> |
| 91 | + <element value="Edit_Flow"/> |
| 92 | + </property> |
| 93 | + </properties> |
| 94 | + </rule> |
| 95 | + |
| 96 | + <rule ref="WordPress.WP.I18n"> |
| 97 | + <properties> |
| 98 | + <property name="text_domain" type="array"> |
| 99 | + <element value="edit-flow"/> |
| 100 | + </property> |
| 101 | + </properties> |
| 102 | + </rule> |
| 103 | + |
| 104 | + <rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> |
| 105 | + <properties> |
| 106 | + <property name="blank_line_check" value="true"/> |
| 107 | + </properties> |
| 108 | + </rule> |
| 109 | + |
| 110 | +</ruleset> |
0 commit comments