-
Notifications
You must be signed in to change notification settings - Fork 843
phpcs: Fix and enable Jetpack.PHPUnit.Attributes sniff
#43175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Boost plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
|
This is one that I'll want to at least locally rebase and re-run phpcs before actually merging, to try to make sure other PRs didn't add new things needing fixing. |
Code Coverage SummaryCoverage changed in 11 files. Only the first 5 are listed here.
|
Mostly this is the result of running phpcbf on files failing the sniff. Things needing manual cleanup were: * `projects/packages/image-cdn/tests/php/Image_CDN_Test.php`: Remove a broken `@covers` that had no space between the tag and class name. * `projects/plugins/jetpack/tests/php/core-api/WPCOM_REST_API_V2_Field_Controller_Test.php`: Fix a `@group` that was accidentally "rest-api\n\nphpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound". * `projects/plugins/jetpack/tests/php/core-api/wpcom-fields/WPCOM_REST_API_V2_Attachment_VideoPress_Data_Test.php`: * `projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_TestBase.php`: Move some `@group`s from the file comment to class comment. * `projects/plugins/jetpack/tests/php/Functions_OpenGraph_Test.php`: * `projects/plugins/jetpack/tests/php/general/Jetpack_Client_Server_Test.php`: Fix where it got confused about whether a comment was a file or class comment. * `projects/plugins/jetpack/tests/php/json-api/Jetpack_Json_Api_Plugins_Endpoints_Test.php`: Fix `@covers` for nonexistent class. * `projects/plugins/jetpack/tests/php/modules/shortcodes/trait.http-request-cache.php`: * `projects/plugins/jetpack/tests/php/trait-woo-tests.php`: Manually fix, since the sniff doesn't recognize the trait as a test class.
…und` in phpcompatibility-dev run. `PHPCompatibility.Attributes.NewAttributes.Found` was already disabled.
fc6607e to
1328706
Compare
|
Surprising that this PR somehow changed code coverage on anything. On investigation, it looks like |
tbradsha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed through plugins/jetpack so far. It looks like GH's interface only auto-loads diff content for the first 200 files, so I'm submitting this portion in case what I do next would lose those comments.
projects/packages/autoloader/tests/php/tests/acceptance/AutoloaderTest.php
Show resolved
Hide resolved
projects/packages/stub-generator/tests/php/PhpParser/PhpDocNameResolverTest.php
Show resolved
Hide resolved
tbradsha
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few random inline comments (mostly to satisfy my own curiosity and keep me engaged), but it looks good to me.
projects/plugins/jetpack/tests/php/json-api/Jetpack_Json_Api_Plugins_Endpoints_Test.php
Show resolved
Hide resolved
Mostly this is the result of running phpcbf on files failing the sniff. Things needing manual cleanup were: * `projects/packages/image-cdn/tests/php/Image_CDN_Test.php`: Remove a broken `@covers` that had no space between the tag and class name. * `projects/plugins/jetpack/tests/php/core-api/WPCOM_REST_API_V2_Field_Controller_Test.php`: Fix a `@group` that was accidentally "rest-api\n\nphpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound". * `projects/plugins/jetpack/tests/php/core-api/wpcom-fields/WPCOM_REST_API_V2_Attachment_VideoPress_Data_Test.php`: * `projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_TestBase.php`: Move some `@group`s from the file comment to class comment. * `projects/plugins/jetpack/tests/php/Functions_OpenGraph_Test.php`: * `projects/plugins/jetpack/tests/php/general/Jetpack_Client_Server_Test.php`: Fix where it got confused about whether a comment was a file or class comment. * `projects/plugins/jetpack/tests/php/json-api/Jetpack_Json_Api_Plugins_Endpoints_Test.php`: Fix `@covers` for nonexistent class. * `projects/plugins/jetpack/tests/php/modules/shortcodes/trait.http-request-cache.php`: * `projects/plugins/jetpack/tests/php/trait-woo-tests.php`: Manually fix, since the sniff doesn't recognize the trait as a test class. * Disable `PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound` in phpcompatibility-dev run. `PHPCompatibility.Attributes.NewAttributes.Found` was already disabled.
* We need to remove directories when rebuilding too GC can delete rebuild files, leaving empty directories. Removing this check makes sure those directories are deleted. * Return directoroes in iterator too. * changelog * Add tests for Filesyste_Utils.php * Fix the type of the $type parameter as static analysis checks failed * Checks seem to be stalled. Kick them? * Updating PHAN baseline * Delete index.html files when deleting everything If that file is left over, then the directory can't be deleted * Refactor walk_directory and garbage collection * Decouple file-storage from cache * Reuse delete and rebuild path actions * Fix this typo and it's one file * Delete the cache file for this user as they left a comment We need to delete this file instead of rebuild as the cache file is only used by that particular user because of their cookies. * Add $parameters parameter to rebuild and delete page functions This allows those functions to delete a single page visited by a particular visitor with cookies. * Apply the action to the root $path too. * Re-use some code * Remove unused method * Refactor the storage interface * Refactor rebuilding * Schedule a garbage collection when page output changes * Fix comment approval check * Update changelog * Fix single garbage collection * Finish cache to account for cache preloading * Update dependency @mdn/browser-compat-data to v6 (#43199) Co-authored-by: Renovate Bot <bot@renovateapp.com> * Add support for sqlite in wordbless (#43197) * phpcs: Fix and enable `Jetpack.PHPUnit.Attributes` sniff (#43175) Mostly this is the result of running phpcbf on files failing the sniff. Things needing manual cleanup were: * `projects/packages/image-cdn/tests/php/Image_CDN_Test.php`: Remove a broken `@covers` that had no space between the tag and class name. * `projects/plugins/jetpack/tests/php/core-api/WPCOM_REST_API_V2_Field_Controller_Test.php`: Fix a `@group` that was accidentally "rest-api\n\nphpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound". * `projects/plugins/jetpack/tests/php/core-api/wpcom-fields/WPCOM_REST_API_V2_Attachment_VideoPress_Data_Test.php`: * `projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_TestBase.php`: Move some `@group`s from the file comment to class comment. * `projects/plugins/jetpack/tests/php/Functions_OpenGraph_Test.php`: * `projects/plugins/jetpack/tests/php/general/Jetpack_Client_Server_Test.php`: Fix where it got confused about whether a comment was a file or class comment. * `projects/plugins/jetpack/tests/php/json-api/Jetpack_Json_Api_Plugins_Endpoints_Test.php`: Fix `@covers` for nonexistent class. * `projects/plugins/jetpack/tests/php/modules/shortcodes/trait.http-request-cache.php`: * `projects/plugins/jetpack/tests/php/trait-woo-tests.php`: Manually fix, since the sniff doesn't recognize the trait as a test class. * Disable `PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound` in phpcompatibility-dev run. `PHPCompatibility.Attributes.NewAttributes.Found` was already disabled. * phpunit: Enable reporting and failing on PHPUnit 11 deprecations (#43179) Now that we've fixed all the PHPUnit 11 deprecations, adjust the configs to enable `displayDetailsOnPhpunitDeprecations` and `failOnPhpunitDeprecation`. For plugins/crm, plugins/jetpack, and plugins/wpcomsh, there's one more deprecation left that's also fixed in this PR: WP Core's obsolete `WP_UnitTestCase_Base::checkRequirements()` function has a doc comment that PHPUnit is mis-parsing to see a `@group` annotation that's not actually intended. We can override it to stop PHPUnit from seeing that doc comment. * Update Eslint packages (#43200) * Update Eslint packages * Ignore another package with a build dep trying to `npm install` something * Remove no-longer-needed eslint-disable directives --------- Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Brad Jorsch <brad.jorsch@automattic.com> * Forms: Change data structure for integrations endpoint (#43183) * Gravatar: add Gravatar profiles to comments form (#42458) * Add initial Gravatar comments * Add changelog * Revert webpack changes Problem fixed in hovercard package * Add i18n * Use latest hovercard library * Fix flex on email field On simple sites it seems to be different * Fix changelog? * Bump to 0.8.0 Quick Editor Track where interaction is coming from * Lazy load Gravatar profile * CSS lint fix * Jetpack Sync: Switch 'jetpack_package_version' to a callable (#43188) * Jetpack Sync: Switch 'jetpack_package_version' to a callable * Gravatar comments: fix hovercard style (#43207) * Gravatar: fix hovercard style Ensure the hovercard style is loaded in the main CSS * Add changelog * Update/file field interactivity fixes (#43201) * Image Compare block: Ensure compare line is not visible on top of a sticky menu (#43187) * General: Bump minimum WordPress version to 6.7 (#43192) * API Update Post: Fix warning when `$input['type']` does not exist (#43180) * e2e Slack notifications: update file upload logic (#43196) * e2e Slack notifications: update file upload logic Slack will soon deprecate the files.upload API: https://docs.slack.dev/changelog/2024-04-a-better-way-to-upload-files-is-here-to-stay/ We are encouraged to move to files.getUploadURLExternal and files.completeUploadExternal instead. https://api.slack.com/methods/files.getUploadURLExternal https://api.slack.com/methods/files.completeUploadExternal * changelog * Expand the tests to avoid coverage failure * changelog: update wording. Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> * Update implementation to use @slack/web-api See #43196 (review) * Additional error check See https://github.com/Automattic/jetpack/pull/43196/files#r2054583550 Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> * Bring filesUploadV2 back into postOrUpdateMessage We don't need to extract things anymore, since we simplified the upload in bf38b5f Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> * Update test * Remove extra handling of errors --------- Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> * Fix extra parameter issue * Remove unused const --------- Co-authored-by: Donncha O Caoimh <5656673+donnchawp@users.noreply.github.com> Co-authored-by: Liam Sarsfield <43409125+LiamSarsfield@users.noreply.github.com> Co-authored-by: Brandon Kraft <public@brandonkraft.com> Co-authored-by: Automattic Bot <sysops+ghmatticbot@automattic.com> Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com> Co-authored-by: Brad Jorsch <brad.jorsch@automattic.com> Co-authored-by: Erick Danzer <edanzer@gmail.com> Co-authored-by: John <johng75@gmail.com> Co-authored-by: Foteini Giannaropoulou <giannaropoulou.foteini@gmail.com> Co-authored-by: Enej Bajgoric <enej.bajgoric@automattic.com> Co-authored-by: Karen Attfield <karenlattfield@gmail.com> Co-authored-by: Joseph Scott <joseph@josephscott.org> Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
Proposed changes:
Mostly this is the result of running phpcbf on files failing the sniff.
Things needing manual cleanup were:
projects/packages/image-cdn/tests/php/Image_CDN_Test.php: Remove a broken@coversthat had no space between the tag and class name.projects/plugins/jetpack/tests/php/core-api/WPCOM_REST_API_V2_Field_Controller_Test.php: Fix a@groupthat was accidentally "rest-api\n\nphpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound".projects/plugins/jetpack/tests/php/core-api/wpcom-fields/WPCOM_REST_API_V2_Attachment_VideoPress_Data_Test.php:projects/plugins/jetpack/tests/php/sync/Jetpack_Sync_Queue_TestBase.php: Move some@groups from the file comment to class comment.projects/plugins/jetpack/tests/php/Functions_OpenGraph_Test.php:projects/plugins/jetpack/tests/php/general/Jetpack_Client_Server_Test.php: Fix where it got confused about whether a comment was a file or class comment.projects/plugins/jetpack/tests/php/json-api/Jetpack_Json_Api_Plugins_Endpoints_Test.php: Fix@coversfor nonexistent class.projects/plugins/jetpack/tests/php/modules/shortcodes/trait.http-request-cache.php:projects/plugins/jetpack/tests/php/trait-woo-tests.php: Manually fix, since the sniff doesn't recognize the trait as a test class.Other information:
Jetpack product discussion
pf4qpu-Fo-p2
p1745258954968799/1745251420.256849-slack-C02LK1W8T4Z
Does this pull request change what data or activity we track or use?
No
Testing instructions: