Skip to content
Snippets Groups Projects
Verified Commit a2549f07 authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

build: move some deps to composer


Signed-off-by: default avatarBart Jaskulski <bjaskulski@protonmail.com>
parent c3fb21d0
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive"> <phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.9.2" installed="1.9.2" location="./tools/phpstan" copy="true"/>
<phar name="phpunit" version="^9.5.20" installed="9.5.27" location="./tools/phpunit" copy="true"/> <phar name="phpunit" version="^9.5.20" installed="9.5.27" location="./tools/phpunit" copy="true"/>
<phar name="phpcs" version="^3.6.2" installed="3.7.1" location="./tools/phpcs" copy="true"/>
<phar name="phpcbf" version="^3.6.2" installed="3.7.1" location="./tools/phpcbf" copy="true"/> <phar name="phpcbf" version="^3.6.2" installed="3.7.1" location="./tools/phpcbf" copy="true"/>
<phar name="grumphp" version="^1.12.0" installed="1.13.0" location="./tools/grumphp" copy="true"/> <phar name="grumphp" version="^1.12.0" installed="1.16.0" location="./tools/grumphp" copy="true"/>
<phar name="composer" version="^2.3.4" installed="2.4.4" location="./tools/composer" copy="true"/> <phar name="composer" version="^2.3.4" installed="2.6.5" location="./tools/composer" copy="true"/>
</phive> </phive>
...@@ -29,16 +29,25 @@ ...@@ -29,16 +29,25 @@
}, },
"require-dev": { "require-dev": {
"szepeviktor/phpstan-wordpress": "^1.1", "szepeviktor/phpstan-wordpress": "^1.1",
"wp-coding-standards/wpcs": "^2" "wpdesk/wp-code-sniffer": "^1.2",
"phpstan/phpstan": "^1.10",
"phpstan/extension-installer": "^1.3"
}, },
"scripts": { "scripts": {
"test:phpstan": "./tools/phpstan --configuration=phpstan.neon.dist --memory-limit=-1 analyze", "style:fix": "phpcbf",
"test:phpcs": "./tools/phpcs", "test:phpstan": "phpstan --configuration=phpstan.neon.dist --memory-limit=-1 analyze",
"test:phpcs": "phpcs",
"test:phpunit": "./tools/phpunit --bootstrap tests/bootstrap.php tests", "test:phpunit": "./tools/phpunit --bootstrap tests/bootstrap.php tests",
"test": [ "test": [
"@test:phpcs", "@test:phpcs",
"@test:phpstan", "@test:phpstan",
"@test:phpunit" "@test:phpunit"
] ]
} },
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
}
}
} }
This diff is collapsed.
...@@ -8,12 +8,9 @@ ...@@ -8,12 +8,9 @@
############################################################################# #############################################################################
--> -->
<config
name="installed_paths"
value="vendor/wp-coding-standards/wpcs,vendor/wpdesk/wp-code-sniffer"/>
<!-- Scan all files. --> <!-- Scan all files. -->
<file>./src</file> <file>./src</file>
<file>./tests</file>
<!-- Only check PHP files. --> <!-- Only check PHP files. -->
<arg name="extensions" value="php"/> <arg name="extensions" value="php"/>
...@@ -27,148 +24,33 @@ ...@@ -27,148 +24,33 @@
<!-- Cache outcomes for better performance. Remember to add the file to .gitignore. --> <!-- Cache outcomes for better performance. Remember to add the file to .gitignore. -->
<arg name="cache" value="./.phpcs-cache"/> <arg name="cache" value="./.phpcs-cache"/>
<!-- Always exclude all files in version management related directories. -->
<exclude-pattern>*/.git/*</exclude-pattern>
<exclude-pattern>*/.wordpress-svn/*</exclude-pattern>
<!-- Always exclude all files in dependency related directories. -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor(_prefixed)?/*</exclude-pattern>
<!-- Always exclude all tests. Differences between PHPUnit, mocking libraries and WPCS make it hard to enforce some CS. -->
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>scoper\.inc\.php$</exclude-pattern>
<rule ref="WordPress">
<!-- Follow PSR-4 for autoloading naming convention -->
<exclude name="WordPress.Files.FileName"/>
<!-- WPCS demands long arrays. WPDeskCS demands short arrays. -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- Demanding Yoda conditions is stupid. -->
<exclude name="WordPress.PHP.YodaConditions"/>
<exclude name="Squiz.Commenting.FunctionComment"/>
<exclude name="Squiz.Commenting.ClassComment"/>
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<!-- You can use short if-else form. -->
<exclude name="WordPress.PHP.DisallowShortTernary"/>
<!-- If a conscious choice has been made for a non-strict comparison, that's ok.
I.e. when `strict` has been explicitly set to `false` in an array comparison,
it will be allowed. -->
<exclude name="WordPress.PHP.StrictInArray.FoundNonStrictFalse"/>
<exclude name="WordPress.WP.AlternativeFunctions" />
<!-- Sometimes it's better not to use user's timezone. -->
<exclude name="WordPress.DateTime.RestrictedFunctions.date_date" />
</rule>
<!-- Allow slash in hook name. -->
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/"/>
</properties>
</rule>
<!-- Template files should have comment with passed variables. -->
<rule ref="Squiz.Commenting.FileComment">
<include-pattern>*/templates/*</include-pattern>
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag"/>
</rule>
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<type>error</type>
<properties>
<!-- No need to adjust alignment of large arrays when the item with the largest key is removed. -->
<property name="exact" value="false"/>
<!-- Don't align multi-line items if ALL items in the array are multi-line. -->
<property name="alignMultilineItems" value="!=100"/>
<!-- Array Assignment operator should always be on the same line as the array key. -->
<property name="ignoreNewlines" value="false"/>
</properties>
</rule>
<!-- In contrast to WPCS: demand short arrays. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Check the complexity of code in advance to prevent too complex structures. -->
<rule ref="Generic.Metrics.CyclomaticComplexity">
<properties>
<property name="complexity" value="15"/>
<property name="absoluteComplexity" value="30"/>
</properties>
</rule>
<rule ref="Generic.Metrics.NestingLevel">
<properties>
<property name="nestingLevel" value="6" />
<property name="absoluteNestingLevel" value="10" />
</properties>
</rule>
<!-- <!--
############################################################################# #############################################################################
ADD SOME SPECIFIC EXTRA SNIFFS USE THE WPDeskCS RULESET
These may make it into WPCS at some point. If so, they can be removed here.
############################################################################# #############################################################################
--> -->
<!-- CS: no blank line between the content of a function and a function close brace.-->
<rule ref="PSR2.Methods.FunctionClosingBrace"/>
<!-- CS: ensure exactly one blank line before each property declaration. -->
<rule ref="Squiz.WhiteSpace.MemberVarSpacing"/>
<!-- CS: don't allow "// end class" comments and the likes. --> <!-- Define plugin text domain for i18n. -->
<rule ref="PSR12.Classes.ClosingBrace"/> <config name="text_domain" value="shopmagic-for-woocommerce"/>
<!-- CS: enforce consistent indentation of chained object method calls. --> <!-- This value should be aligned with WordPress support version declared in plugin header -->
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"> <config name="minimum_supported_wp_version" value="5.0"/>
<properties>
<property name="multilevel" value="true"/>
</properties>
</rule>
<!-- Error prevention: Ensure no git conflicts make it into the code base. -->
<!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset.
Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1500 -->
<rule ref="Generic.VersionControl.GitMergeConflict"/>
<!-- CS: no space between an increment/decrement operator and the variable it applies to. -->
<!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset.
Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1511 -->
<rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
<!-- QA: Function declarations should not contain parameters which will never be used. -->
<!-- PHPCS 3.4.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset.
Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1510 -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.Found"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed"/>
<!-- CS: Ensure consistent whitespace around spread operators. --> <!-- Set value aligned with supported PHP Version for PHPCompatibilityWP check. -->
<!-- PHPCS 3.5.0: This sniff will be added to WPCS in due time and can then be removed from this ruleset. <config name="testVersion" value="7.1-"/>
Related: https://github.com/WordPress/WordPress-Coding-Standards/issues/1762 -->
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
<!-- CS: Disallow a leading backslash at the start of an import use statement. --> <rule ref="WPDeskPlugin"/>
<!-- PHPCS 3.5.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. -->
<rule ref="PSR12.Files.ImportStatement"/>
<!-- CS: Enforces that a PHP open tag is on a line by itself when used at the start of a PHP-only file. --> <!--
<!-- PHPCS 3.5.0: This sniff may be added to WPCS in due time and can then be removed from this ruleset. --> ##############################################################################
<rule ref="PSR12.Files.OpenTag"/> CUSTOM RULES
##############################################################################
<!-- ##### Documentation Sniffs vs empty index files ##### --> -->
<rule ref="Squiz.ControlStructures.InlineIfDeclaration">
<exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets"/>
</rule>
<!-- Exclude the 'empty' index files from some documentation checks --> <rule ref="Squiz.Commenting.ClassComment">
<rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore"> <exclude name="Squiz.Commenting.ClassComment.Missing"/>
<exclude-pattern>*/index\.php$</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.WrongStyle">
<exclude-pattern>*/index\.php$</exclude-pattern>
</rule> </rule>
</ruleset> </ruleset>
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters: parameters:
level: 8 level: 8
paths: paths:
......
No preview for this file type
No preview for this file type
File deleted
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment