Update phpcs ruleset
This commit is contained in:
parent
13f8c8d486
commit
5abb1baa8e
|
@ -15,10 +15,11 @@
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
|
||||||
"wp-coding-standards/wpcs": "^2.1"
|
"wp-coding-standards/wpcs": "^2.1",
|
||||||
|
"phpcompatibility/php-compatibility": "^9.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": ["phpcs"],
|
"test": ["vendor/bin/phpcs"],
|
||||||
"fix": ["phpcbf"]
|
"fix": ["vendor/bin/phpcbf"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "6f047956cbb4861fde466b775966f717",
|
"content-hash": "6e38e340aaa610ed48211f151263555e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/installers",
|
"name": "composer/installers",
|
||||||
|
@ -194,6 +194,64 @@
|
||||||
],
|
],
|
||||||
"time": "2018-10-26T13:21:45+00:00"
|
"time": "2018-10-26T13:21:45+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpcompatibility/php-compatibility",
|
||||||
|
"version": "9.2.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
||||||
|
"reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
|
||||||
|
"reference": "3db1bf1e28123fd574a4ae2e9a84072826d51b5e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3",
|
||||||
|
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"squizlabs/php_codesniffer": "2.6.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
||||||
|
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
||||||
|
},
|
||||||
|
"type": "phpcodesniffer-standard",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"LGPL-3.0-or-later"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Contributors",
|
||||||
|
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wim Godden",
|
||||||
|
"homepage": "https://github.com/wimg",
|
||||||
|
"role": "lead"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Juliette Reinders Folmer",
|
||||||
|
"homepage": "https://github.com/jrfnl",
|
||||||
|
"role": "lead"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
||||||
|
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
||||||
|
"keywords": [
|
||||||
|
"compatibility",
|
||||||
|
"phpcs",
|
||||||
|
"standards"
|
||||||
|
],
|
||||||
|
"time": "2019-06-27T19:58:56+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "squizlabs/php_codesniffer",
|
"name": "squizlabs/php_codesniffer",
|
||||||
"version": "3.4.2",
|
"version": "3.4.2",
|
||||||
|
@ -250,12 +308,12 @@
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
||||||
"reference": "bd9c33152115e6741e3510ff7189605b35167908"
|
"reference": "bd9c33152115e6741e3510ff7189605b35167908"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/bd9c33152115e6741e3510ff7189605b35167908",
|
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/bd9c33152115e6741e3510ff7189605b35167908",
|
||||||
"reference": "bd9c33152115e6741e3510ff7189605b35167908",
|
"reference": "bd9c33152115e6741e3510ff7189605b35167908",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
|
|
106
phpcs.xml
106
phpcs.xml
|
@ -1,10 +1,17 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset name="WordPress Theme Coding Standards">
|
<ruleset name="UnderStrap Coding Standards">
|
||||||
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
|
|
||||||
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
|
|
||||||
|
|
||||||
<!-- Set a description for this ruleset. -->
|
<!-- Set a description for this ruleset. -->
|
||||||
<description>A custom set of code standard rules to check for WordPress themes.</description>
|
<description>A custom set of code standard rules for UnderStrap.</description>
|
||||||
|
|
||||||
|
<!-- Show colors in console -->
|
||||||
|
<arg value="-colors"/>
|
||||||
|
|
||||||
|
<!-- Show sniff codes in all reports -->
|
||||||
|
<arg value="s"/>
|
||||||
|
|
||||||
|
<!-- Don't show warnings -->
|
||||||
|
<arg value="n"/>
|
||||||
|
|
||||||
<!-- Only check the PHP files -->
|
<!-- Only check the PHP files -->
|
||||||
<arg name="extensions" value="php"/>
|
<arg name="extensions" value="php"/>
|
||||||
|
@ -13,31 +20,86 @@
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
|
|
||||||
<!-- Ignore the vendor directory -->
|
<!-- Ignore the vendor directory -->
|
||||||
<exclude-pattern>./vendor</exclude-pattern>
|
<exclude-pattern>*/vendor/*</exclude-pattern>
|
||||||
|
<exclude-pattern>*/node_modules/*</exclude-pattern>
|
||||||
|
|
||||||
<!-- Show colors in console -->
|
<!-- Use the WordPress Ruleset -->
|
||||||
<arg value="-colors"/>
|
<rule ref="WordPress">
|
||||||
|
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
|
||||||
|
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
|
||||||
|
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd"/>
|
||||||
|
<exclude name="WordPress.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed"/>
|
||||||
|
<exclude name="WordPress.Security.EscapeOutput.UnsafePrintingFunction"/>
|
||||||
|
<exclude name="WordPress.Security.EscapeOutput.OutputNotEscaped"/>
|
||||||
|
<exclude name="WordPress.Security.ValidatedSanitizedInput.InputNotSanitized"/>
|
||||||
|
<exclude name="WordPress.WP.GlobalVariablesOverride.Prohibited"/>
|
||||||
|
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/>
|
||||||
|
<exclude name="WordPress.WP.I18n.NonSingularStringLiteralText"/>
|
||||||
|
|
||||||
<!-- Show sniff codes in all reports -->
|
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/>
|
||||||
<arg value="s"/>
|
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed"/>
|
||||||
|
<exclude name="Generic.WhiteSpace.ScopeIndent"/>
|
||||||
<!-- Include the WordPress ruleset, with space for exclusions if necessary. -->
|
|
||||||
<rule ref="WordPress-Core">
|
|
||||||
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
|
||||||
<exclude name="Generic.WhiteSpace.ScopeIndent.IncorrectExact" />
|
|
||||||
|
|
||||||
|
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
|
||||||
|
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
|
||||||
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/>
|
<exclude name="PEAR.Functions.FunctionCallSignature.Indent"/>
|
||||||
|
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
|
||||||
|
|
||||||
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
|
<exclude name="Squiz.Commenting.FunctionComment.Missing"/>
|
||||||
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
|
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
|
||||||
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
|
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
|
||||||
<exclude name="Squiz.Commenting.InlineComment.NotCapital" />
|
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace"/>
|
||||||
</rule>
|
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found"/>
|
||||||
<rule ref="WordPress-Docs">
|
<exclude name="Squiz.PHP.EmbeddedPhp"/>
|
||||||
|
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
|
<!--
|
||||||
<severity>0</severity>
|
Verify that the text_domain is set to the desired text-domain.
|
||||||
|
Multiple valid text domains can be provided as a comma-delimited list.
|
||||||
|
-->
|
||||||
|
<rule ref="WordPress.WP.I18n">
|
||||||
|
<properties>
|
||||||
|
<property name="text_domain" type="array" value="understrap"/>
|
||||||
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Allow for theme specific exceptions to the file name rules based
|
||||||
|
on the theme hierarchy.
|
||||||
|
-->
|
||||||
|
<rule ref="WordPress.Files.FileName">
|
||||||
|
<properties>
|
||||||
|
<property name="is_theme" value="true"/>
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<!-- A closing tag is not permitted at the end of a PHP file -->
|
||||||
|
<!-- <rule ref="Zend.Files.ClosingTag"/> -->
|
||||||
|
|
||||||
|
<!-- Use the PHPCompatibility Ruleset -->
|
||||||
|
<config name="testVersion" value="5.2-99.0"/>
|
||||||
|
<rule ref="PHPCompatibility">
|
||||||
|
<!--
|
||||||
|
Whitelist PHP native classes, interfaces, functions and constants which
|
||||||
|
are back-filled by WP.
|
||||||
|
|
||||||
|
Based on:
|
||||||
|
* /wp-includes/compat.php
|
||||||
|
* /wp-includes/random_compat/random.php
|
||||||
|
-->
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewClasses.errorFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewClasses.typeerrorFound"/>
|
||||||
|
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewConstants.json_pretty_printFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewConstants.php_version_idFound"/>
|
||||||
|
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewFunctions.hash_equalsFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewFunctions.json_last_error_msgFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewFunctions.random_intFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewFunctions.random_bytesFound"/>
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound"/>
|
||||||
|
|
||||||
|
<exclude name="PHPCompatibility.PHP.NewInterfaces.jsonserializableFound"/>
|
||||||
|
</rule>
|
||||||
|
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
Reference in New Issue