Closed (fixed)
Project:
Drupal core
Version:
9.0.x-dev
Component:
migration system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Jul 2020 at 10:43 UTC
Updated:
13 Aug 2020 at 10:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
s_bhandari commentedComment #3
s_bhandari commentedAdded a patch to address the same.
Comment #4
s_bhandari commentedIgnoring patch #3, as some modifications are not needed as per the standard. Patch #4 should get considered.
Comment #5
s_bhandari commentedComment #6
sharma.amitt16 commentedThanks for the patch.
Changing the status to RTBC
Comment #7
hardik_patel_12 commentedComment #8
alexpottThank you for your work on cleaning up Drupal core's code style!
In order to fix core coding standards in a maintainable way, all our coding standards issues should be done on a per-rule basis across all of core, rather than fixing standards in individual modules or files. We should also separate fixes where we need to write new documentation from fixes where we need to correct existing standards. This all should be done as part of #2571965: [meta] Fix PHP coding standards in core, stage 1. A good place to for unused variables is #3106216: Remove unused variables from core.
For background information on why we usually will not commit coding standards fixes that aren't scoped in that way, see the core issue scope guidelines, especially the note about coding standards cleanups. That document also includes numerous suggestions for scoping issues including documentation coding standards cleanups.
Contributing to the overall plan above will help ensure that your fixes for core's coding standards remain in core the long term.
Comment #9
alexpottIn discussion with xim, catch and larowlan, my earlier comment is incorrect. We should handle each unused variable on its own merit and do the work to work out why it is not used.
This can point to broken code or incomplete testing see #3157369: Use unused variable $filters from DateTimeSchemaTest for example. A useful tool for this is
git log -S “SOME TEXT”which will search git commits for matching text to find out when the variable might have become unused. Without doing the work to show why the variable is unused the patch will not be committed. Alsogit blamecan be useful as well.Comment #10
s_bhandari commentedHi @alexpott,
Thank you for reviewing it and yes, I have understood your point on this. I will look into this.
Thanks.
Comment #11
s_bhandari commentedHi @alexpott,
As per the work done in comment #5 of the following issue you have suggested checking: https://www.drupal.org/project/drupal/issues/3157369, I have modified the patch.
Also, after doing the analysis I have found that the variable got introduced and became as unused in the following two commits: 7d6e615f, 5123f756. I have checked it by running the git blame and git show [COMMIT_ID] respectively in-order to confirm the same.
Please review the patch and let me know for any other information or observation regarding the same.
Thanks.
Comment #12
quietone commentedI don't see how this will affect the test. DrupalSqlBase::getSystemData returns an array and that isn't used. It may throw an exception but this is run before setting the expectException.
Comment #13
paulocsAs comment #13 said, I think we can just remove the two lines as this not interfere on the tests.
Comment #14
thallesBased in #12, #13 looks good to me, and the tests don't broken
Comment #15
alexpottI've looked back through the history and these has never been used. Also regardless of it being called in the test - this method will be called when checkRequirements is called so this code is still running as part of the test.
Committed 8fd13be and pushed to 9.1.x and 9.0.x. Thanks!
Didn't apply to 8.9.x so didn't bother backporting there.