Add PSR-4 naming checks to PHP linting (https://github.com/woocommerce/woocommerce-admin/pull/5512)
* Add PSR-4 class lint rule. * Fix path to Package file based on namespace. Co-authored-by: Jeff Stieler <jeff.m.stieler@gmail.com>
This commit is contained in:
parent
0a1cec3d4e
commit
134040bbe9
|
@ -14,7 +14,8 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "7.5.20",
|
||||
"woocommerce/woocommerce-sniffs": "0.1.0"
|
||||
"woocommerce/woocommerce-sniffs": "0.1.0",
|
||||
"suin/phpcs-psr4-sniff": "^2.2"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "4dd601e4232287cf0c8c9abc932a0d48",
|
||||
"content-hash": "13d25093aa13b1cfa4aedf6535085fd6",
|
||||
"packages": [
|
||||
{
|
||||
"name": "automattic/jetpack-autoloader",
|
||||
|
@ -1873,6 +1873,49 @@
|
|||
},
|
||||
"time": "2016-10-03T07:35:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "slevomat/coding-standard",
|
||||
"version": "4.8.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/slevomat/coding-standard.git",
|
||||
"reference": "bff96313d8c7c2ba57a4edb13c1c141df8988c58"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/bff96313d8c7c2ba57a4edb13c1c141df8988c58",
|
||||
"reference": "bff96313d8c7c2ba57a4edb13c1c141df8988c58",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"squizlabs/php_codesniffer": "^3.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||
"phing/phing": "2.16.1",
|
||||
"phpstan/phpstan": "0.9.2",
|
||||
"phpstan/phpstan-phpunit": "0.9.4",
|
||||
"phpstan/phpstan-strict-rules": "0.9",
|
||||
"phpunit/phpunit": "7.5.1"
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SlevomatCodingStandard\\": "SlevomatCodingStandard"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
|
||||
"support": {
|
||||
"issues": "https://github.com/slevomat/coding-standard/issues",
|
||||
"source": "https://github.com/slevomat/coding-standard/tree/4.8.7"
|
||||
},
|
||||
"time": "2019-01-03T13:15:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.5.8",
|
||||
|
@ -1929,6 +1972,61 @@
|
|||
},
|
||||
"time": "2020-10-23T02:01:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "suin/phpcs-psr4-sniff",
|
||||
"version": "v2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/suin/phpcs-psr4-sniff.git",
|
||||
"reference": "48ae7d95a7c82092527bd9c18f2431f62cae32da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/suin/phpcs-psr4-sniff/zipball/48ae7d95a7c82092527bd9c18f2431f62cae32da",
|
||||
"reference": "48ae7d95a7c82092527bd9c18f2431f62cae32da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.1 <7.4.0",
|
||||
"slevomat/coding-standard": ">=4.7 <5.0.0",
|
||||
"squizlabs/php_codesniffer": ">=3.3 <4.0.0"
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Suin\\Sniffs\\Classes\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "suin",
|
||||
"email": "suinyeze@gmail.com",
|
||||
"homepage": "https://github.com/suin",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer sniff that checks class name matches PSR-4 project structure.",
|
||||
"homepage": "https://github.com/suin/php",
|
||||
"keywords": [
|
||||
"PSR-4",
|
||||
"coding-standards",
|
||||
"coding-style",
|
||||
"namespace",
|
||||
"php-codesniffer",
|
||||
"phpcs",
|
||||
"static-analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/suin/php/issues",
|
||||
"source": "https://github.com/suin/phpcs-psr4-sniff/tree/v2.1.3"
|
||||
},
|
||||
"time": "2018-12-05T09:12:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.20.0",
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
</rule>
|
||||
|
||||
<rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
|
||||
<exclude-pattern>src/*</exclude-pattern>
|
||||
</rule>
|
||||
<exclude-pattern>src/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="Generic.Commenting">
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
|
@ -57,4 +57,11 @@
|
|||
<exclude-pattern>src/</exclude-pattern>
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<arg name="basepath" value="."/>
|
||||
<rule ref="Suin.Classes.PSR4">
|
||||
<exclude-pattern>includes/</exclude-pattern>
|
||||
<exclude-pattern>tests/</exclude-pattern>
|
||||
<exclude-pattern>src/Notes/DeprecatedNotes.php</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
|
Loading…
Reference in New Issue