Commit Graph

21 Commits

Author SHA1 Message Date
Ismail El Korchi cfdbdfc534 Add composer.json and package.json for linting with Travis 2020-04-07 20:51:04 +01:00
jrfnl 7c24fc751d 🔧 PHPCS: remove exclusions
The ruleset contained some exclusions which are no longer needed.
2018-02-27 14:34:53 +01:00
jrfnl cb7117a408 🔧 PHPCS: add a comprehensive PHPCompatibility exceptions ruleset
WordPress provides backfills for a number of PHP native functions and constants.
These can therefore be safely used in themes and plugins.

This commit adds a whitelist for the PHPCompatibility ruleset of the backfills currently provided by WP.

N.B.: At this moment, none of the whitelisted classes/constants/functions/interfaces are used in `_s`.
However, `_s` is also a teaching tool and an example for others, so having this whitelist block in there serves that purpose and allows for themes which are build onto `_s` to use these PHP features without having to worry about cross-version compatibility notices.
2018-02-27 14:34:52 +01:00
jrfnl cac65d8a54 🔧 PHPCS: enable checking for globals being prefixed
Everything which is defined in the global namespace should be prefixed to prevent conflicts with other themes and plugins.

This snippet enables the sniff which verifies this and tells it which prefix to look for.
2018-02-27 14:34:52 +01:00
jrfnl 60071168e5 🔧 PHPCS: add configuration for array double arrow alignment
This configuration makes the sniff less finicky when all array items are multi-line.

It allow allows for cleaner diffs as an array will not need to be reformatted when the array item with the largest key has been removed.

Refs:
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-allow-for-new-lines
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-allow-non-exact-alignment
* https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#array-alignment-maximum-column
2018-02-27 14:34:52 +01:00
jrfnl 9ff286964b 🔧 PHPCS: specify the minimum supported WP version
A number of additional sniffs have been added to WPCS which all use the `minimum_supported_version` property to know which WP version to check against.

As setting these properties for each sniff becomes tedious and would necessitate the ruleset to be adjusted each time a new sniff which uses that property becomes available, WPCS now offers a (forward-compatible) way to set the minimum supported WP version for all sniffs in one go.
2018-02-27 14:34:51 +01:00
jrfnl 878fbde6c4 🔧 PHPCS: speed up by checking files in parallel
This uses a new feature which is available since PHPCS 3.x.
The effect will depend on the system on which PHPCS is being run, but if parallel processing can be run, the build should be faster using this option.
2018-02-27 14:34:51 +01:00
jrfnl dd7a1604e6 🔧 PHPCS: clean up the file paths PHPCS shows
This uses a new feature which is available since PHPCS 3.x.
2018-02-27 14:34:50 +01:00
jrfnl c453749f7a 🔧 PHPCS: don't ignore warnings, don't list scanned files
The `-n` flag will ignore warnings completely, while often it is useful to see them and to fix them.

Using `--runtime-set ignore_warnings_on_exit 1` in the Travis script instead, warnings will be shown, both when a developer runs PHPCS on their own machine, as well as in Travis, but warnings will not cause a failed Travis build.

The `-v` flag will list each file being scanned. This is intended for debugging purposes and not needed for normal use.
2018-02-27 14:34:50 +01:00
jrfnl 92d8673e4a 🔧 PHPCS: add section headings
This is intended to make it clearer for a newcomer to PHPCS to understand how the ruleset is build up and what each part of the ruleset means.
2018-02-27 14:34:50 +01:00
jrfnl 94767ab051 🔧 PHPCS: tidy up config file
Comply with strict XML standard.
2018-02-27 14:34:50 +01:00
Truong Giang 6e75903248 Update PHPCS ruleset to check coding standard for CSS and SCSS files 2017-07-24 08:23:45 +07:00
Truong Giang 6e5adc24bb Trim white space in a blank line 2017-07-01 10:22:22 +07:00
jrfnl e475309cd5 WPCS: Verify that no deprecated or removed WP functions are being used.
Ref: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#minimum-wp-version-to-check-for-usage-of-deprecated-functions-and-function-parameters
2017-06-17 17:08:58 +02:00
David A. Kennedy 1f9ad8893d Merge pull request #1122 from jrfnl/feature/wpcs-allow-theme-specific-filenames
WPCS: Allow for typical theme specific file names based on the theme hierarchy
2017-06-17 16:27:58 +02:00
jrfnl 755619e74d WPCS: Allow for typical theme specific file names based on the theme hierarchy.
Ref: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#themes-allow-filename-exceptions
2017-06-16 00:53:50 +02:00
jrfnl b560425ff1 PHPCS ruleset: add link to the PHPCompatibility repo.
At the top of the ruleset there were links to the PHPCS and the WPCS repo, but not to the PHPCompatibility repo which is also being used.
2017-06-16 00:48:12 +02:00
jrfnl bc9d5f742e Fix link to WPCS in the PHPCS ruleset.
The link was pointing to the `WordPress-Core` ruleset, while `_s` uses the `WordPress` ruleset which encompasses more than just the core rules.

Pointing to the repo + the wiki seems more appropriate to me.
2017-06-16 00:48:11 +02:00
David A. Kennedy 67d6d59235 Merge branch 'feature/rename-phpcs-ruleset' 2017-06-16 00:39:39 +02:00
jrfnl b78d053772 PHPCS: Move the recommended command line arguments into the custom ruleset. 2017-06-12 00:21:34 +02:00
jrfnl 0d353e1c0c Rename the PHPCS ruleset.
If the file is called `phpcs.xml` or `phpcs.xml.dist`, it is automatically picked up by PHPCS.

A `phpcs.xml` is given preference over a `phpcs.xml.dist` file. So renaming the file to `phpcs.xml.dist` allows for people to use the file provided by `_s` if they choose not to add their own, but also leaves people the freedom to easily overrule it.
2017-06-12 00:11:53 +02:00
Renamed from codesniffer.ruleset.xml (Browse further)