Skip to content

Commit

Permalink
Write up some more PRs
Browse files Browse the repository at this point in the history
Covers 710, 752, 806, 814, 827, 833
  • Loading branch information
jrfnl committed Mar 9, 2017
1 parent 0e2aa3f commit 0df27f5
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ You are also encouraged to check the file history of any WPCS classes you extend
- `WordPress.WP.I18n`: added ability to check for missing _translators comments_ when a I18n function call contains translatable text strings containing placeholders. This check will also verify that the _translators comment_ is correctly placed in the code and uses the correct comment type for optimal compatibility with various tools which create `.pot` files.
- `WordPress.WP.I18n`: added ability to pass the `text_domain` to check for [from the command line](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#setting-text_domain-from-the-command-line).
- `WordPress.Arrays.ArrayDeclarationSpacing`: added check + fixer for single line associative arrays. The [handbook](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#indentation) states that these should always be multi-line.
- `WordPress.Files.FileName`: added verification that files containing a class reflect this in the filename as per the core guidelines. This particular check can be disabled in a custom ruleset by setting the new [`strict_class_file_names` property](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#disregard-class-file-name-rules).
- `WordPress.Files.FileName`: added verification that files in `/wp-includes/` containing template tags - annotated with `@subpackage Template` in the file header - use the `-template` suffix.
- `WordPress.Files.FileName`: added an [`is_theme` property](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#themes-allow-filename-exceptions) which can be set from the ruleset to indicate that the project being checked is a theme and make allowances for a predefined theme hierarchy based set of exceptions to the file name rules.
- `WordPress.WhiteSpace.ControlStructureSpacing`: added support for checking the whitespace in `try`/`catch` constructs.
- `WordPress.WhiteSpace.ControlStructureSpacing`: added check that the space after the open parenthesis and before the closing parenthesis of control structures and functions is *exactly* one space. Includes auto-fixer.
-
Expand Down Expand Up @@ -72,6 +75,7 @@ You are also encouraged to check the file history of any WPCS classes you extend
* A number of checks contained in the `WordPress.VIP.RestrictedFunctions` sniff have been moved to other sniffs.
* The `WordPress.PHP.DiscouragedFunctions` sniff has been deprecated and is no longer used. The checks which were previously contained herein have been moved to other sniffs.
* The reorganized sniffs also detect a number of additional functions which were previously ignored by these sniffs. For more detail, please refer to the [summary of the PR](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/633#issuecomment-269693016) and to [PR #759](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/759).
- The error codes for these sniffs as well as for `WordPress.DB.RestrictedClasses`, `WordPress.DB.RestrictedFunctions`, `WordPress.Functions.DontExtract`, `WordPress.PHP.POSIXFunctions` and a number of the `VIP` sniffs have changed. They were previously based on function group names and will now be based on function group name in combination with the identified function name. Complete function groups can still be silenced by using the [`exclude` property](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#excluding-a-group-of-checks) in a custom ruleset.
- `WordPress.NamingConventions.ValidVariableName`: The `customVariablesWhitelist` property which could be passed from the ruleset has been renamed to [`customPropertiesWhitelist`](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#mixed-case-property-name-exceptions) as it is only usable to whitelist class properties.
-
-
Expand All @@ -88,7 +92,6 @@ You are also encouraged to check the file history of any WPCS classes you extend
- The `WordPress.VIP.FileSystemWritesDisallow`, `WordPress.VIP.TimezoneChange` and `WordPress.VIP.SessionFunctionsUsage` sniffs now extend the `WordPress_AbstractFunctionRestrictionsSniff`.
-
-
-
- Moved `Squiz.PHP.DisallowMultipleAssignments` from the `WordPress-Extra` to the `WordPress-Core` ruleset.
- Replaced the `WordPress.Classes.ValidClassName`, `WordPress.PHP.DisallowAlternativePHPTags` and the `WordPress.Classes.ClassOpeningStatement` sniffs with the existing `PEAR.NamingConventions.ValidClassName` and the new upstream `Generic.PHP.DisallowAlternativePHPTags` and `Generic.Classes.OpeningBraceSameLine` sniffs in the `WordPress-Core` ruleset.
- Use the upstream `Squiz.PHP.Eval` sniff for detecting the use of `eval()` instead of a WPCS native implementation.
Expand All @@ -100,12 +103,14 @@ You are also encouraged to check the file history of any WPCS classes you extend
- Updated composer installation instructions in the readme.
- Updated information about the rulesets in the readme and moved the information up to make it easier to find.
- Improved the information about running the unit tests in `Contributing.md`.
- Various other code quality and code consistency improvements under the hood, including refactoring of some of the abstract sniff classes.
- Improved the inline documentation of the rulesets.
- Various other code quality and code consistency improvements under the hood, including refactoring of some of the abstract sniff classes, closer coupling of the child classes to the `WordPress_Sniff` parent class.


### Removed
- Removed some temporary work-arounds for changes which were pulled and merged into PHPCS upstream.
- Individual sniffs will no longer throw warning messages about parse errors they encounter. This is left up to the `Generic.PHP.Syntax` sniff which is included in the `WordPress-Extra` ruleset.
- Removed the `Generic.Files.LowercasedFilename` sniff from the `WordPress-Core` ruleset in favour of the improved `WordPress.Files.FileName` to prevent duplicate messages being thrown.
-
-
-
Expand All @@ -117,23 +122,29 @@ You are also encouraged to check the file history of any WPCS classes you extend
- Various (potential) `Undefined variable`, `Undefined index` and `Undefined offset` notices.
- An issue with placeholder replacement not taking place in some error messages.
- A (potential) issue which could play up when sniffs examined text strings which contained quotes text.
- `WordPress.WP.I18n`: a superfluous `UnorderedPlaceholders` error was being thrown when `%%` (a literal % sign) was encountered in a string.
- `WordPress.WP.I18n`: the sniff would sometimes erronuously trigger errors when a literal `%` was found in a translatable string without placeholders.
- `WordPress.WP.I18n`: compatibility with PHP nightly / PHP 7.2.
- `WordPress.PHP.YodaConditions`: minor clarification of the error message.
- `WordPress.Variables.GlobalVariables`: **_All known bugs have been fixed. If you'd previously disabled the sniff in your custom ruleset because of these bugs, it should be fine to re-enable it now._**
- Assignments to global variables using other assignment operators than the `=` operator were not detected.
- If a `global ...;` statement was detected, the whole file would be checked for the variables which were made global, not just the code after the global statement.
- If a `global ...;` statement was detected, the whole file would be checked for the variables which were made global, including code contained within a function/closure/class scope where there is no access to the global variable.
- If a `global ...;` statement was detected within a function call or closure, the whole file would be checked for the variables which were made global, not just the code within the function or closure.
- If a `global ...;` statement was detected and an assignment was made to a static class variable using the same name as one of the variables made global, an error would incorrectly be thrown.
- An override of a protected global via `$GLOBALS` in combination with simple string concatenation obfuscation was not being detected.
- `WordPress.WhiteSpace.ControlStructureSpacing`: the fixer would bork on control structures which contained only a single empty line.
- `WordPress.WhiteSpace.ControlStructureSpacing`: the sniff did not check the spacing used for `do {} while ()` control structures.
- `WordPress.WhiteSpace.ControlStructureSpacing`: conditional function declarations could cause an infinite loop when using the fixer.
* Assignments to global variables using other assignment operators than the `=` operator were not detected.
* If a `global ...;` statement was detected, the whole file would be checked for the variables which were made global, not just the code after the global statement.
* If a `global ...;` statement was detected, the whole file would be checked for the variables which were made global, including code contained within a function/closure/class scope where there is no access to the global variable.
* If a `global ...;` statement was detected within a function call or closure, the whole file would be checked for the variables which were made global, not just the code within the function or closure.
* If a `global ...;` statement was detected and an assignment was made to a static class variable using the same name as one of the variables made global, an error would incorrectly be thrown.
* An override of a protected global via `$GLOBALS` in combination with simple string concatenation obfuscation was not being detected.
- `WordPress.WP.I18n`: a reported bugs have been fixed.
* A superfluous `UnorderedPlaceholders` error was being thrown when `%%` (a literal % sign) was encountered in a string.
* The sniff would sometimes erronuously trigger errors when a literal `%` was found in a translatable string without placeholders.
* Not all type of placeholders were being recognized.
* No warning was being thrown when encountering a mix of ordered and unordered placeholders.
* The fixer for unordered placeholders was erroruously replacing all placeholders as if they were the first one.
* The fixer for unordered placeholders could cause faulty replacements in double quoted strings.
* Compatibility with PHP nightly / PHP 7.2.
- `WordPress.WhiteSpace.ControlStructureSpacing`: synced in fixes from the upstream version.
* The fixer would bork on control structures which contained only a single empty line.
* The sniff did not check the spacing used for `do {} while ()` control structures.
* Conditional function declarations could cause an infinite loop when using the fixer.
- `WordPress.VIP.PluginMenuSlug`: the sniff would potentially incorrectly process method calls and namespaced functions with the same function name as the targetted WordPress native functions.
- `WordPress.VIP.CronInterval`: the native WP time constants were not recognized leading to false positives.
- `WordPress.VIP.CronInterval`: the finding of the referenced function declaration has been made more accurate.
- `WordPress.PHP.YodaConditions`: minor clarification of the error message.
-


Expand Down

0 comments on commit 0df27f5

Please sign in to comment.