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.
This commit is contained in:
Dan Brown 2021-06-26 16:40:29 +01:00
parent 0155525945
commit ca8be9af3c
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 29 additions and 97 deletions

View File

@ -41,8 +41,7 @@
"fakerphp/faker": "^1.13.0", "fakerphp/faker": "^1.13.0",
"laravel/browser-kit-testing": "^5.2", "laravel/browser-kit-testing": "^5.2",
"mockery/mockery": "^1.3.3", "mockery/mockery": "^1.3.3",
"phpunit/phpunit": "^9.5.3", "phpunit/phpunit": "^9.5.3"
"squizlabs/php_codesniffer": "^3.5.8"
}, },
"autoload": { "autoload": {
"classmap": [ "classmap": [

107
composer.lock generated
View File

@ -4,20 +4,20 @@
"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": "70a290f0e2112361af4a0abe15148adc", "content-hash": "d1109d0dc4a6ab525cdbf64ed21f6dd4",
"packages": [ "packages": [
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.184.7", "version": "3.185.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149" "reference": "0e6ece3f9c4ab26bb20183c697fd36e1d55c1053"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0e6ece3f9c4ab26bb20183c697fd36e1d55c1053",
"reference": "d5d5fe5fdfca6c7a56f2f8364d09c3100d5c2149", "reference": "0e6ece3f9c4ab26bb20183c697fd36e1d55c1053",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -92,9 +92,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "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", "name": "barryvdh/laravel-dompdf",
@ -1874,16 +1874,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "1.6.4", "version": "1.6.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "c3c8b7217c52572fb42aaf84211abccf75a151b2" "reference": "44ffd8d3c4a9133e4bd0548622b09c55af39db5f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/c3c8b7217c52572fb42aaf84211abccf75a151b2", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/44ffd8d3c4a9133e4bd0548622b09c55af39db5f",
"reference": "c3c8b7217c52572fb42aaf84211abccf75a151b2", "reference": "44ffd8d3c4a9133e4bd0548622b09c55af39db5f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1971,20 +1971,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-06-19T20:08:14+00:00" "time": "2021-06-26T11:57:13+00:00"
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.1.3", "version": "1.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "9be3b16c877d477357c015cec057548cf9b2a14a" "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
"reference": "9be3b16c877d477357c015cec057548cf9b2a14a", "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2000,7 +2000,6 @@
"phpunit/phpunit": "^8.5.8" "phpunit/phpunit": "^8.5.8"
}, },
"suggest": { "suggest": {
"ext-fileinfo": "Required for MimeType",
"ext-ftp": "Allows you to use FTP server storage", "ext-ftp": "Allows you to use FTP server storage",
"ext-openssl": "Allows you to use FTPS 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", "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
@ -2058,7 +2057,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/flysystem/issues", "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": [ "funding": [
{ {
@ -2066,7 +2065,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2020-08-23T07:39:11+00:00" "time": "2021-06-23T21:56:05+00:00"
}, },
{ {
"name": "league/flysystem-aws-s3-v3", "name": "league/flysystem-aws-s3-v3",
@ -8255,16 +8254,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.5.5", "version": "9.5.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "89ff45ea9d70e35522fb6654a2ebc221158de276" "reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/89ff45ea9d70e35522fb6654a2ebc221158de276", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb",
"reference": "89ff45ea9d70e35522fb6654a2ebc221158de276", "reference": "fb9b8333f14e3dce976a60ef6a7e05c7c7ed8bfb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8294,7 +8293,7 @@
"sebastian/global-state": "^5.0.1", "sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3", "sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3", "sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.2", "sebastian/type": "^2.3.4",
"sebastian/version": "^3.0.2" "sebastian/version": "^3.0.2"
}, },
"require-dev": { "require-dev": {
@ -8342,7 +8341,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "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": [ "funding": [
{ {
@ -8354,7 +8353,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-06-05T04:49:07+00:00" "time": "2021-06-23T05:14:38+00:00"
}, },
{ {
"name": "react/promise", "name": "react/promise",
@ -9481,62 +9480,6 @@
}, },
"time": "2020-07-07T18:42:57+00:00" "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", "name": "symfony/dom-crawler",
"version": "v4.4.25", "version": "v4.4.25",

View File

@ -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>

View File

@ -81,7 +81,8 @@ Once done you can run `php vendor/bin/phpunit` in the application root directory
### 📜 Code Standards ### 📜 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 ### 🐋 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) * [OneLogin's SAML PHP Toolkit](https://github.com/onelogin/php-saml)
* [League/CommonMark](https://commonmark.thephpleague.com/) * [League/CommonMark](https://commonmark.thephpleague.com/)
* [League/Flysystem](https://flysystem.thephpleague.com) * [League/Flysystem](https://flysystem.thephpleague.com)
* [StyleCI](https://styleci.io/)