wmde/WikibaseCodeSniffer

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Wikibase CodeSniffer standards

Abstract

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.

How to install
  1. 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"
    }
    
    
  2. Create a .phpcs.xml with our configuration:

    l version="1.0"?>
    eset>
    <rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase"/>
    
    <file>.</file>
    leset>
    
  3. Install: composer update

  4. Run: composer test

  5. Run: composer fix to auto-fix some of the errors, others might need manual intervention.

  6. Commit!


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.