Added PHP_Codesniffer to project to keep the code styles in check

This commit is contained in:
Gregory Ballantine 2022-03-06 22:28:58 -05:00
parent 1ab911e7df
commit c36a97b62e
4 changed files with 86 additions and 3 deletions

View File

@ -14,5 +14,11 @@
"hassankhan/config": "^3.0",
"madcoda/php-youtube-api": "^1.2",
"team-reflex/discord-php": "^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.6"
},
"scripts": {
"phpcs": "phpcs"
}
}

61
composer.lock generated
View File

@ -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": "0e481dbc149344c9772f4f2b425d7739",
"content-hash": "8ba316fe7bd06a7e80b406cbe3263164",
"packages": [
{
"name": "discord-php/http",
@ -2804,7 +2804,64 @@
"time": "2016-01-13T22:50:58+00:00"
}
],
"packages-dev": [],
"packages-dev": [
{
"name": "squizlabs/php_codesniffer",
"version": "3.6.2",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a",
"reference": "5e4e71592f69da17871dba6e80dd51bce74a351a",
"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-12-12T21:44:58+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],

20
phpcs.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PHPCS configuration file.</description>
<!-- pigeon.php is the only file to check currently -->
<file>pigeon.php</file>
<!-- Our base rule: set to PSR12-->
<rule ref="PSR12"/>
<!-- Set indent size to 2 -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="2" />
</properties>
</rule>
</ruleset>