Name: WikibaseCodeSniffer
Owner: Wikimedia Deutschland e.V.
Description: Wikibase CodeSniffer standards
Created: 2017-02-10 14:41:06.0
Updated: 2018-04-21 10:26:24.0
Pushed: 2018-04-21 10:26:23.0
Homepage: https://www.mediawiki.org/wiki/Wikibase/Coding_conventions
Size: 86
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This project implements a set of rules for use with PHP CodeSniffer.
See Wikibase coding conventions on the MediaWiki wiki for an overview of the basic coding conventions that are validated by these rules. Detailed comments explaining individual rules can be found in the Wikibase/ruleset.xml file in this project.
This project aims to be less draconic than the MediaWiki CodeSniffer it is based on, especially on comments in your code. We believe the primary goal of an automatic code sniffer is to reduce pain in code reviews by guaranteeing a consistent, easy to read code style. When dealing with the consequences of a rule is more painful than what it is able to provide (e.g. some extra whitespace typically doesn't make code harder to read), we opt-out.
If you experience pain because of a rule you feel does not make your code easier to read, please
feel free to exclude it via <exclude name="?" />
in your local .phpcs.xml, or
suggest to opt-out of this rule entirely.
Create a composer.json which adds this project as a dependency:
"require-dev": {
"wikibase/wikibase-codesniffer": "^0.4.0"
},
"scripts": {
"test": [
"phpcs -p -s"
],
"fix": "phpcbf"
}
Create a .phpcs.xml with our configuration:
l version="1.0"?>
eset>
<rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase"/>
<file>.</file>
leset>
Install: composer update
Run: composer test
Run: composer fix
to auto-fix some of the errors, others might need
manual intervention.
Commit!