Skip to content

Commit

Permalink
Write up some more PRs
Browse files Browse the repository at this point in the history
Covers 789, 795, 799, 804, 807, 808, 815, 818, 820, 824
  • Loading branch information
jrfnl committed Mar 7, 2017
1 parent a23dfa8 commit 0e2aa3f
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,35 @@ For more detailed information about the changed sniff names and error codes, ple

### Important notes for sniff developers:

If you maintain or develop sniffs based upon the WordPress Coding Standards, most importantly, if you use methods and properties from the `WordPress_Sniff` class or extend other sniffs from WPCS to use their properties, please be aware that this release contains significant changes which will, more likely than not, affect your sniffs.
If you maintain or develop sniffs based upon the WordPress Coding Standards, notably, if you use methods and properties from the `WordPress_Sniff` class, extend one of the abstract sniff classes WPCS provides or extend other sniffs from WPCS to use their properties, please be aware that this release contains significant changes which will, more likely than not, affect your sniffs.

Please read this changelog carefully to understand how this will affect you.
For more detailed information on the most significant changes, please refer to PR [#833](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/833) and PR [#841](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/841).
You are also encouraged to check the file history of any WPCS classes you extend to.
For more detailed information on the most significant changes, please refer to PR [#795](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/795), PR [#833](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/833) and PR [#841](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/841).
You are also encouraged to check the file history of any WPCS classes you extend.


### Added
- `WordPress.WP.DeprecatedFunctions` sniff: this sniff will check for usage of deprecated WP version and show errors/warnings depending on a `minimum_supported_version` which [can be passed to the sniff from a custom ruleset](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). The default value for the `minimum_supported_version` property is three versions before the current WP version.
- `WordPress.WP.DeprecatedFunctions` sniff to the `WordPress-Extra` ruleset to check for usage of deprecated WP version and show errors/warnings depending on a `minimum_supported_version` which [can be passed to the sniff from a custom ruleset](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). The default value for the `minimum_supported_version` property is three versions before the current WP version.
-
-
-
- `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.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.
-
-
-
- `WordPress.WhiteSpace.CastStructureSpacing`: added ability to automatically fix errors thrown by the sniff.
- `WordPress.VIP.ValidatedSanitizedInput`: added `wp_strip_all_tags()` to the list of valid sanitizing functions.
- `WordPress.VIP.SessionFunctionsUsage`: added detection of the `session_abort()`, `session_create_id()`, `session_gc()` and `session_reset()` functions.

- Abstract `AbstractFunctionParameter` parent class to allow for examining parameters passed in function calls.
- A number of utility functions to the `WordPress_Sniff` class: `strip_quotes()`, `addMessage()`, `addFixableMessage()`, `string_to_errorcode()`, `does_function_call_have_parameters()`, `get_function_call_parameter_count()`, `get_function_call_parameters()`, `get_function_call_parameter()`, `has_html_open_tag()`.



- `Squiz.Commenting.LongConditionClosingComment`, `Squiz.WhiteSpace.CastSpacing`, `Generic.Formatting.DisallowMultipleStatements` to the `WordPress-Core` ruleset.
- `Squiz.PHP.NonExecutableCode`, `Squiz.Operators.IncrementDecrementUsage`, `Squiz.Operators.ValidLogicalOperators`, `Squiz.Functions.FunctionDuplicateArgument`, `Generic.PHP.BacktickOperator`, `Squiz.PHP.DisallowSizeFunctionsInLoops` to the `WordPress-Extra` ruleset.
- Instructions on how to use WPCS with Visual Studio to the Readme.
Expand All @@ -53,7 +62,7 @@ You are also encouraged to check the file history of any WPCS classes you extend

### Changed
- The minimum required PHP_CodeSniffer version to 2.8.1.
- Improved support for detecting issues in code using closures (anonymous functions) and anonymous classes.
- Improved support for detecting issues in code using closures (anonymous functions), short array syntax and anonymous classes.
- Improved sniff efficiency and performance for a number of sniffs.
- The discouraged/restricted functions sniffs have been reorganized and made more modular.
* The new `WordPress.PHP.DevelopmentFunctions` sniff now contains the checks related to PHP functions typically used during development which are discouraged in production code.
Expand Down Expand Up @@ -83,15 +92,16 @@ You are also encouraged to check the file history of any WPCS classes you extend
- 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.
-
-
- Made the `Generic.WhiteSpace.ScopeIndent` sniff in the `WordPress-Core` ruleset more lenient to allow for different indentation in inline HTML, heredoc and nowdoc structures.
- Made the `Generic.Strings.UnnecessaryStringConcat` sniff in the `WordPress-Extra` ruleset more lenient to allow for multi-line string concatenation.
-
- All sniffs are now also being tested against PHP 7.1 for consistent sniff results.
- Made the requirements for running the sniffs more explicit in the readme.
- 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.
- Various other code quality and code consistency improvements under the hood, including refactoring of some of the abstract sniff classes.


### Removed
- Removed some temporary work-arounds for changes which were pulled and merged into PHPCS upstream.
Expand All @@ -106,6 +116,7 @@ You are also encouraged to check the file history of any WPCS classes you extend
### Fixed
- 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.
Expand All @@ -117,10 +128,12 @@ You are also encouraged to check the file history of any WPCS classes you extend
- 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.
- `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.
-


Expand Down

0 comments on commit 0e2aa3f

Please sign in to comment.