Commit Graph

1264 Commits

Author SHA1 Message Date
jrfnl f03dfdecd5 Contributing: add directive about compliance with WPCS 2018-02-27 15:03:17 +01:00
jrfnl eb091acf66 CS: reformat a very long line
This line was quite unreadable.

Additionally, it was using the "heavy" `wp_kses_data()` function to escape item count phrase, while that phrase should not contain HTML in the first place and therefore can use the lighter `esc_html()` function to do the output escaping.
2018-02-27 14:34:55 +01:00
jrfnl 1abaebcdaa CS: correct indentation of a newly introduced function 2018-02-27 14:34:54 +01:00
jrfnl 98e3e75109 CS: prefix all variables
While template files are intended to be included from within a function, this doesn't guarantee they always will be.

Therefore all variables declared within template files also need to be prefixed with a theme specific prefix.

As these are "local" variables, renaming them does not constitute a BC-break.
2018-02-27 14:34:54 +01:00
jrfnl ec877e48c3 CS: fix up embedded PHP inconsistencies introduced in the mean time. 2018-02-27 14:34:54 +01:00
Ulrich Pogson b26b6ebfa4 Move PHP tags on it’s own line & correct indention
This fixes a few of the errors from the news sniffs in WPCS 0.12.0 and also standardizes the indention between the PHP and HTML
2018-02-27 14:34:53 +01:00
jrfnl 54ad32a598 🔖 CS: whitelist two global variable overrides
The one in `functions.php` can be considered a bug in WPCS and has been reported as such.
Once that issue is fixed, the whitelisting can be removed.

The one in `inc/wpcom.php` will need to remain as WPCS does not keep track of globals introduced by wpcom.
2018-02-27 14:34:53 +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
jrfnl a0d2892cad 🔧 Travis: update the versions used by the various PHPCS libaries
As WPCS and PHPCompatibility were for a little while (May - July 2017) not compatible with PHPCS 3.x, the library tags cloned were previously fixed to prevent issues with that.

As both WPCS as well as the PHPCompatibility standard are now compatible with PHPCS 3.x, the changes made in PR 1110 and PR 1183 can be reverted.

Notes:
* PHPCS - use `master`.
    WPCS uses a limited set of sniffs from PHPCS itself.
    Most of these sniffs are long established, stable and rarely get updated, so using PHPCS `master` should be safe.
* WPCS - use the latest release `0.14.0`.
    WPCS is the main source of CS violations and is under active development. This means that new versions of WPCS will easily break the build, so should be managed.
* PHPCompatibility - use `master`.
    PHPCompatibility checks PHP cross-version compatibility.
    It is actively developed and heavily unit tested, so any new violations found in `_s` because of changes in that library, should actually be addressed in `_s` ASAP.

    The PHPCompatibility library became compatible with PHPCS 3.x and improved compatibility with Composer installs in version `8.0.0` which was a breaking change.
    To account for that, the location where the library is cloned to and the `phpcs --installed_paths` command have been updated.
    Ref: https://github.com/wimg/PHPCompatibility/pull/446
2018-02-27 14:34:49 +01:00
Chris Runnells 05511d4846
Merge pull request #1265 from crunnells/fix/1249
Update "Requires at least" version number in readme.txt
2018-02-26 14:59:27 -10:00
Chris Runnells 97620dcd79 Update minimum version requirement
the_custom_logo() was introduced in WP 4.5, so the requirement needed to be updated to reflect this. Fixes #1249
2018-02-26 14:54:27 -10:00
Laurel 388951f1ee
Merge pull request #1226 from Ismail-elkorchi/_s_posted
Split _s_posted_on into two functions
2018-01-26 09:50:01 -08:00
Laurel cd10ba650b
Merge pull request #1231 from webmandesign/patch-2
Fixing localization function inside `printf()`
2018-01-26 09:43:17 -08:00
Laurel c5f33c1966
Merge pull request #1228 from SergeyBiryukov/patch-1
Make comments number comparison work as expected
2018-01-26 09:42:42 -08:00
Laurel 115dd8209c
Merge pull request #1158 from Automattic/add-featured-image-content-options
_s: Add featured images to Post and Pages with the ability to hide them via Content Options.
2017-12-13 09:17:23 -08:00
laurelfulford c6427768ef Update array using associative keys to have each value on a new line. 2017-12-12 15:26:47 -10:00
Oliver Juhas eb3945f37b
Fixing localization function inside `printf()` 2017-11-05 19:13:42 +01:00
Sergey Biryukov e5da804748
Fix comment number comparison in comments.php 2017-11-01 03:05:24 +01:00
David A. Kennedy efd37d13a6 Revert 0112701c1f
* This is needed code. See: #770.
* Also, see Automattic/_s#1220.
2017-10-31 13:04:47 -04:00
David A. Kennedy 82a7f71bc0
Merge pull request #1227 from Automattic/revert-1220-patch-1
Revert "Remove unnecessary !"
2017-10-31 12:59:24 -04:00
David A. Kennedy 558f12ce9f
Revert "Remove unnecessary !" 2017-10-31 12:21:27 -04:00
David A. Kennedy fff1f33cc7
Merge pull request #1224 from B-07/master
Update template hierarchy link in docs
2017-10-30 10:29:18 -04:00
David A. Kennedy d193af532c
Merge pull request #1225 from BinaryMoon/patch-2
Update README.md for proper grammar
2017-10-30 10:09:11 -04:00
Thomas Guillot 2a1a954b98 Replace `'echo=0'` with `array( 'echo' => false )` and remove duplicate function 2017-10-30 10:57:58 +00:00
Ismail El Korchi f99c9b5bd0 Fix the indentation of the PHP tags 2017-10-29 21:30:50 +00:00
Ismail El Korchi 2d74ebd7c9 Split _s_posted_on into two functions 2017-10-29 15:31:22 +00:00
Ben 6d34e9a8a0
Update README.md
Correct grammar
2017-10-29 09:15:21 +00:00
Bappi 6bc640792a Update template hierarchy link 2017-10-29 14:51:29 +06:00
David A. Kennedy ff6cc41087
Merge pull request #1208 from awps/patch-1
Added a note about the need to rename `_s.pot`.
2017-10-29 00:33:41 -04:00
David A. Kennedy 56ef92ad51
Merge pull request #1223 from B-07/master
Update year to the latest
2017-10-29 00:25:59 -04:00
Bappi 6454bfb0bb Update year to the latest 2017-10-26 01:14:02 +06:00
David A. Kennedy 0112701c1f Remove extra `!` in `style.scss`
* Related: #1220.
2017-10-25 14:29:53 -04:00
David A. Kennedy ee3d905854 Merge pull request #1220 from B-07/patch-1
Remove unnecessary `!` in stylesheet comments
2017-10-25 14:04:38 -04:00
Bappi 6bd8c2b888 Remove unnecessary ! 2017-10-25 21:53:29 +06:00
David A. Kennedy 58de244dfb Merge pull request #1214 from B-07/master
Update URLs to https
2017-10-25 11:46:58 -04:00
David A. Kennedy 591bb2368f Merge pull request #1217 from webmandesign/patch-1
Updating "Upload Theme" button text to match core
2017-10-24 10:29:15 -04:00
David A. Kennedy 82df565433 Merge pull request #1218 from samikeijonen/issue/1211
Update screen-reader-text class to be in line with core
2017-10-24 09:46:20 -04:00
Sami Keijonen 3f9c31b6a1 Update screen-reader-text class. 2017-10-22 19:00:06 +03:00
Oliver Juhas aca1c3bc0d Fixing "Upload Theme" button text 2017-10-19 14:21:36 +02:00
Bappi 8d9886c535 Add necessay backticks 2017-10-10 23:30:46 +06:00
Bappi e4665250dd Change links http:// to https://
All necessary links checked and updated to https, some remain as http as those aren't using secured protocol yet
2017-10-10 23:29:36 +06:00