Skip to content

New feature: PHPCSDev ruleset #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 14, 2019
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 14, 2019

New feature: PHPCSDev ruleset

This adds a new external PHPCS standard called PHPCSDev for use by sniff developers to check the code style of their sniff repo code.

Often, sniff repos will use the code style of the standard they are adding. However, not all sniff repos are actually about code style.

So for those repos which need a basic standard which will still keep their code-base consistent, this standard should be useful.

The standard checks the following:

The ruleset can be used like any other ruleset and specific sniffs and settings can be added to or overruled from a custom project based ruleset.

Includes adding QA checks for this ruleset to the Travis script.

QA: add code style check for the code in this repo

This:

  • Adds a custom PHPCS ruleset which uses the PHPCSDev ruleset to check the code style of code in this repo.
  • Adds convenience scripts to the composer.json file to check the code of the repo.
  • And allows for individual developers to overload the phpcs.xml.dist file by ignoring the typical overload files.

@jrfnl jrfnl added this to the 1.0.0 milestone Aug 14, 2019
jrfnl added 2 commits August 14, 2019 17:14
This adds a new external PHPCS standard called `PHPCSDev` for use by sniff developers to check the code style of their sniff repo code.

Often, sniff repos will use the code style of the standard they are adding. However, not all sniff repos are actually about code style.

So for those repos which need a basic standard which will still keep their code-base consistent, this standard should be useful.

The standard checks the following:
* Compliance with PSR-2.
* Use of camelCaps variable and function names.
* Use of normalized arrays.
* All files, classes, functions and properties are documented with a docblock and contain the minimally needed information.
* A small number of arbitrary additional code style checks.
* PHP cross-version compatibility, while allowing for the tokens back-filled by PHPCS itself.
    **Note**: for optimal results, the project custom ruleset should set the `testVersion` config variable.
    This is not done by default as config variables are currently difficult to overrule.
    Refs:
    - squizlabs/PHP_CodeSniffer#2197
    - squizlabs/PHP_CodeSniffer#1821

The ruleset can be used like any other ruleset and specific sniffs and settings can be added to or overruled from a custom project based ruleset.

Includes adding QA checks for this ruleset to the Travis script.
This:
* Adds a custom PHPCS ruleset which uses the `PHPCSDev` ruleset to check the code style of code in this repo.
* Adds convenience scripts to the `composer.json` file to check the code of the repo.
* And allows for individual developers to overload the `phpcs.xml.dist` file by ignoring the typical overload files.
@jrfnl jrfnl force-pushed the feature/add-phpcsdev-ruleset branch from f2c49b8 to 85382c0 Compare August 14, 2019 15:19
@jrfnl jrfnl merged commit bfc4899 into develop Aug 14, 2019
@jrfnl jrfnl deleted the feature/add-phpcsdev-ruleset branch August 14, 2019 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant