From ca8be9af3c6ed11e9fe8418a9d649b4a0e970b1d Mon Sep 17 00:00:00 2001 From: Dan Brown <ssddanbrown@googlemail.com> Date: Sat, 26 Jun 2021 16:40:29 +0100 Subject: [PATCH] Swapped PHPCS for StyleCI Trying out StyleCI as an automated easy way to ensure code style is consistent across the PHP codebase. PHPCS+PHPCBF was good but I wouldn't run it enough then I'd get paranoid about running it with pending PRs. Better to let the robots stay on top of things. --- composer.json | 3 +- composer.lock | 107 ++++++++++++-------------------------------------- phpcs.xml | 12 ------ readme.md | 4 +- 4 files changed, 29 insertions(+), 97 deletions(-) delete mode 100644 phpcs.xml diff --git a/composer.json b/composer.json index 4125ae7fe..bbd689454 100644 --- a/composer.json +++ b/composer.json @@ -41,8 +41,7 @@ "fakerphp/faker": "^1.13.0", "laravel/browser-kit-testing": "^5.2", "mockery/mockery": "^1.3.3", - "phpunit/phpunit": "^9.5.3", - "squizlabs/php_codesniffer": "^3.5.8" + "phpunit/phpunit": "^9.5.3" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index a7868b42a..0647038cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "70a290f0e2112361af4a0abe15148adc", + "content-hash": "d1109d0dc4a6ab525cdbf64ed21f6dd4", "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.184.7", + "version": "3.185.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149" + "reference": "0e6ece3f9c4ab26bb20183c697fd36e1d55c1053" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149", - "reference": "d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0e6ece3f9c4ab26bb20183c697fd36e1d55c1053", + "reference": "0e6ece3f9c4ab26bb20183c697fd36e1d55c1053", "shasum": "" }, "require": { @@ -92,9 +92,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.184.7" + "source": "https://github.com/aws/aws-sdk-php/tree/3.185.2" }, - "time": "2021-06-21T18:37:16+00:00" + "time": "2021-06-25T18:19:14+00:00" }, { "name": "barryvdh/laravel-dompdf", @@ -1874,16 +1874,16 @@ }, { "name": "league/commonmark", - "version": "1.6.4", + "version": "1.6.5", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "c3c8b7217c52572fb42aaf84211abccf75a151b2" + "reference": "44ffd8d3c4a9133e4bd0548622b09c55af39db5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c3c8b7217c52572fb42aaf84211abccf75a151b2", - "reference": "c3c8b7217c52572fb42aaf84211abccf75a151b2", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/44ffd8d3c4a9133e4bd0548622b09c55af39db5f", + "reference": "44ffd8d3c4a9133e4bd0548622b09c55af39db5f", "shasum": "" }, "require": { @@ -1971,20 +1971,20 @@ "type": "tidelift" } ], - "time": "2021-06-19T20:08:14+00:00" + "time": "2021-06-26T11:57:13+00:00" }, { "name": "league/flysystem", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a" + "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32", + "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32", "shasum": "" }, "require": { @@ -2000,7 +2000,6 @@ "phpunit/phpunit": "^8.5.8" }, "suggest": { - "ext-fileinfo": "Required for MimeType", "ext-ftp": "Allows you to use FTP server storage", "ext-openssl": "Allows you to use FTPS server storage", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", @@ -2058,7 +2057,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.x" + "source": "https://github.com/thephpleague/flysystem/tree/1.1.4" }, "funding": [ { @@ -2066,7 +2065,7 @@ "type": "other" } ], - "time": "2020-08-23T07:39:11+00:00" + "time": "2021-06-23T21:56:05+00:00" }, { "name": "league/flysystem-aws-s3-v3", @@ -8255,16 +8254,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.5", + "version": "9.5.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276" + "reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89ff45ea9d70e35522fb6654a2ebc221158de276", - "reference": "89ff45ea9d70e35522fb6654a2ebc221158de276", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb", + "reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb", "shasum": "" }, "require": { @@ -8294,7 +8293,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.2", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -8342,7 +8341,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.6" }, "funding": [ { @@ -8354,7 +8353,7 @@ "type": "github" } ], - "time": "2021-06-05T04:49:07+00:00" + "time": "2021-06-23T05:14:38+00:00" }, { "name": "react/promise", @@ -9481,62 +9480,6 @@ }, "time": "2020-07-07T18:42:57+00:00" }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.6.0", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, - "time": "2021-04-09T00:54:41+00:00" - }, { "name": "symfony/dom-crawler", "version": "v4.4.25", diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 8d5157d9e..000000000 --- a/phpcs.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<ruleset name="BookStack Standard"> - <!-- Format described at: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset --> - <description>The coding standard for BookStack.</description> - <config name="php_version" value="70205"/> - <file>./app</file> - <exclude-pattern>*/migrations/*</exclude-pattern> - <exclude-pattern>*/tests/*</exclude-pattern> - <arg value="np"/> - <arg name="colors"/> - <rule ref="PSR2"/> -</ruleset> \ No newline at end of file diff --git a/readme.md b/readme.md index eb98ae6d4..1b8c66061 100644 --- a/readme.md +++ b/readme.md @@ -81,7 +81,8 @@ Once done you can run `php vendor/bin/phpunit` in the application root directory ### 📜 Code Standards -PHP code within BookStack is generally to [PSR-2](http://www.php-fig.org/psr/psr-2/) standards. From the BookStack root folder you can run `./vendor/bin/phpcs` to check code is formatted correctly and `./vendor/bin/phpcbf` to auto-fix non-PSR-2 code. Please don't auto-fix code unless it's related to changes you've made otherwise you'll likely cause git conflicts. +PHP code style is enforced automatically [using StyleCI](https://github.styleci.io/repos/41589337). +If submitting a PR, any formatting changes to be made will be automatically fixed after merging. ### 🐋 Development using Docker @@ -188,3 +189,4 @@ These are the great open-source projects used to help build BookStack: * [OneLogin's SAML PHP Toolkit](https://github.com/onelogin/php-saml) * [League/CommonMark](https://commonmark.thephpleague.com/) * [League/Flysystem](https://flysystem.thephpleague.com) +* [StyleCI](https://styleci.io/) \ No newline at end of file