WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 3 months ago

Last modified 3 months ago

#49542 closed task (blessed) (fixed)

Coding Standards fixes for WP 5.5

Reported by: SergeyBiryukov Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: coding-standards Cc:

Description

Previously:

Change History (39)

#1 @SergeyBiryukov
7 months ago

In 47550:

Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.

This reduces the number of WordPress.PHP.StrictInArray.MissingTrueStrict issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.

#2 @SergeyBiryukov
7 months ago

In 47551:

Coding Standards: Switch WordPress.PHP.YodaConditions.NotYoda back to error level.

This was marked as a warning in [45665] until all the issues associated with the sniff are addressed, so that linting on Travis could run across the entire codebase.

With all the instances now addressed, this override is no longer needed.

Follow-up to [47054], [47218], [47219].

See #49542.

#3 @SergeyBiryukov
7 months ago

In 47552:

Coding Standards: Whitelist date_default_timezone_set() usage in wp-settings.php.

See #49542.

#4 @SergeyBiryukov
7 months ago

In 47557:

Coding Standards: Use strict type check for in_array() and array_search().

This addresses all the remaining WordPress.PHP.StrictInArray.MissingTrueStrict issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.

#5 @SergeyBiryukov
6 months ago

In 47593:

Coding Standards: Format the markup of widget forms in a more consistent manner.

See #49542.

#6 @SergeyBiryukov
6 months ago

In 47595:

Coding Standards: Fix WPCS indentation issue in wp-admin/includes/class-wp-links-list-table.php.

This was causing a Generic.WhiteSpace.ScopeIndent.IncorrectExact error if PHP_CodeSniffer 3.4.1 or newer is installed locally, despite the task passing on Travis.

See #49542.

#7 @SergeyBiryukov
6 months ago

In 47596:

Coding Standards: Fix WPCS indentation issue in wp-admin/nav-menus.php.

This was causing a PEAR.Functions.FunctionCallSignature.Indent error if PHP_CodeSniffer 3.5.3 or newer is installed locally, despite the task passing on Travis.

See #49542.

#8 @SergeyBiryukov
6 months ago

In 47759:

Coding Standards: Fix WPCS issues in wp-includes/canonical.php.

Reformat long conditions and dense code blocks for better readability.

See #49542.

#9 @SergeyBiryukov
6 months ago

In 47775:

Coding Standards: Fix WPCS issues in wp-admin/includes/template.php.

See #49542.

#10 @SergeyBiryukov
6 months ago

In 47780:

Coding Standards: Rename some files and classes in phpunit/tests/functions/ per the naming conventions.

https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

See #49542.

#11 @SergeyBiryukov
5 months ago

In 47802:

Coding Standards: Fix WPCS issues in wp-admin/includes/class-wp-screen.php.

See #49542.

#12 @SergeyBiryukov
5 months ago

In 47808:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

#13 @SergeyBiryukov
5 months ago

In 47814:

Coding Standards: Fix WPCS issues in plugin and theme upgrader classes.

See #49542.

#14 @SergeyBiryukov
5 months ago

In 47821:

Coding Standards: Fix WPCS issues in wp-includes/class-wp-customize-manager.php.

Follow-up to [47819].

Props sorenbronsted.
See #49542.

#15 @SergeyBiryukov
5 months ago

In 47841:

Coding Standards: Fix WPCS issues in wp-admin/includes/class-wp-site-health-auto-updates.php.

See #49542.

#16 @SergeyBiryukov
5 months ago

In 47845:

Coding Standards: Fix WPCS issues in wp-admin/plugin-editor.php and wp-admin/theme-editor.php.

See #49542.

#17 @SergeyBiryukov
5 months ago

In 47848:

Coding Standards: Use strict comparison for count() calls.

See #49542.

#18 @SergeyBiryukov
5 months ago

In 47851:

Coding Standards: Use strict comparison for more count() calls.

Follow-up to [47848].

Props mukesh27.
Fixes #50232. See #49542.

#19 @SergeyBiryukov
5 months ago

In 47852:

Coding Standards: Use strict comparison for $wp_db_version check in wp-admin/network/upgrade.php.

Follow-up to [47787], [47788].

See #50155, #49542.

#20 @SergeyBiryukov
5 months ago

In 47853:

Coding Standards: Use strict comparison in wp-admin/network where static strings are involved.

Includes minor code layout fixes for better readability.

Follow-up to [47808].

See #49542.

#21 @SergeyBiryukov
5 months ago

In 47855:

Coding Standards: Fix instances of Generic.WhiteSpace.ArbitraryParenthesesSpacing.FoundEmpty.

See #49542.

#22 @SergeyBiryukov
5 months ago

In 47862:

Coding Standards: Use strict comparison in wp-admin/_index.php.

See #49542.

#23 @ocean90
4 months ago

In 48041:

Coding Standards: Fix code indentation in post_submit_meta_box() to improve readability.

See #49542.

#24 @SergeyBiryukov
4 months ago

In 48063:

Coding Standards: Fix WPCS issues in wp-admin/nav-menus.php.

Includes minor code layout fixes for better readability.

See #49542.

#25 @SergeyBiryukov
4 months ago

In 48065:

Coding Standards: Rename the $clean or $ids variable in several functions to $non_cached_ids for clarity.

  • _get_non_cached_ids()
  • update_meta_cache()
  • update_object_term_cache()

See #49542.

#26 @SergeyBiryukov
4 months ago

In 48080:

Coding Standards: Remove unused variable in WP_Sitemaps_Provider::get_sitemap_entries().

Follow-up to [48072].

See #49542, #50117.

#27 @SergeyBiryukov
4 months ago

In 48081:

Coding Standards: Fix WPCS issues in wp-includes/sitemaps/.

Some of these were not caught when running composer lint:errors, but are fixed when running phpcbf directly.

Follow-up to [48072], [48080].

See #49542, #50117.

#28 @SergeyBiryukov
4 months ago

In 48089:

Coding Standards: Add some space around control structures in WP_Filesystem_* classes for consistency and better readability.

Additionally, synchronize $tempfile and $temphandle variable names in WP_Filesystem_FTPext and WP_Filesystem_ftpsockets.

See #49542.

#29 @SergeyBiryukov
4 months ago

In 48111:

Coding Standards: Replace echo sprintf() with printf().

See #49542.

#30 @SergeyBiryukov
4 months ago

In 48167:

Coding Standards: Reformat some long apply_filters_deprecated() and do_action_deprecated() calls for better readability.

See #49542.

#31 @SergeyBiryukov
4 months ago

In 48176:

Tests: Reformat test_wp_list_pages_discarded_whitespace() for better readability.

See #50466, #49542.

#32 @jrf
4 months ago

FYI: The DealerDirect Composer PHPCS plugin has just released version 0.7.0.
This new version includes support for Composer 2.0.0 (expected soonish).

As Composer treats minors < 1.0 as majors, updating to this version requires an update to the composer.json requirements.

For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as >=0.3.0 <0.4.0.

Refs:

#33 @SergeyBiryukov
4 months ago

In 48229:

Coding Standards: Add missing visibility keywords to Tests_Comment methods.

See #49542.

#34 @SergeyBiryukov
4 months ago

In 48297:

Coding Standards: Rename functions in wp-admin/js/site-health.js per the JS coding standards.

See #49542.

#35 @SergeyBiryukov
4 months ago

In 48301:

Coding Standards: Wrap some long lines in wp-admin/js/site-health.js per the JS coding standards for better readability.

See #49542.

#36 @SergeyBiryukov
3 months ago

In 48421:

Coding Standards: Use strict comparison in WP_List_Util::filter().

Correct comments per the documentation standards.

See #49542, #49572.

#37 @SergeyBiryukov
3 months ago

In 48579:

Coding Standards: Use a consistent naming pattern for variables in wp-includes/comment-template.php.

See #49542.

#38 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from new to closed

Follow-up: #50767

#39 @SergeyBiryukov
3 months ago

In 48622:

Coding Standards: Rename the $id parameter in various category functions for clarity.

See #49542.

Note: See TracTickets for help on using tickets.