hydrawiki / hydrawiki-codesniffer
HydraWiki CodeSniffer Standards
Requires
- php: >= 7.2
- composer/semver: 1.5.0
- mediawiki/mediawiki-codesniffer: 29.0.0
Requires (Dev)
- jakub-onderka/php-console-highlighter: 0.3.2
- jakub-onderka/php-parallel-lint: 1.0.0
- mediawiki/minus-x: 1.0.0
- phpunit/phpunit: 4.8.36 || ^6.5
README
Abstract
This project implements a set of rules for use with [PHP CodeSniffer]0.
HydraWiki is based on MediaWiki's Coding Standards, it applies additional coding standards on top of the MediaWiki Standard.
See MediaWiki conventions from MediaWiki for a detailed description of the coding conventions that are validated by these rules. :-)
How to install
Create a composer.json which adds this project as a dependency:
{ "require-dev": { "hydrawiki/hydrawiki-codesniffer": "1.0.9" }, "scripts": { "test": [ "phpcs -p -s" ], "fix": "phpcbf" } }
Create a .phpcs.xml with our configuration:
<?xml version="1.0"?> <ruleset> <rule ref="./vendor/hydrawiki/hydrawiki-codesniffer/HydraWiki"/> <file>.</file> <arg name="extensions" value="php,php5,inc"/> <arg name="encoding" value="UTF-8"/> </ruleset>
- Install:
composer update
- Run:
composer test
- Run:
composer fix
to auto-fix some of the errors, others might need manual intervention. - Commit!
Note that for most MediaWiki projects, MediaWiki also recommend to add a PHP linter
to your composer.json
– see the full documentation for more details.
Acknowledgements
This extension is based off of the mediawiki-codesniffer
extension created by MediaWiki and some parts of [PHP CodeSniffer]0.
Contributing and Licensing
This coding standard is used internally on HydraWiki projects in support of the Gamepedia Platform. This project is made public for ease of use by our team and it is not our intention to maintain it for public use as an alternative to the original project from which it was derived. However, if you do find it useful and want to contribute improvements to it, any merge request will be consider against our internal needs for this project before public considerations.
The project is available under MIT license unless otherwise noted in files that are used from other projects. These files retain the original license under which they were created.