Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2020 at 08:32 UTC
Updated:
2 Jan 2025 at 15:09 UTC
Jump to comment: Most recent
Part of #2571965: [meta] Fix PHP coding standards in core, stage 1.
Sniff for coding standard is not implemented.
<rule ref="Drupal.Semantics.FunctionT.NotLiteralString"/>
Add <rule ref="Drupal.Semantics.FunctionT.NotLiteralString"/> to phpcs.xml.dist
Add ignore lines where it can't be changed to using only literals. That is currently 70 lines.
Review
Commit
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
longwaveSome of these will be fixed by #3143339: Clean up the arguments of calls to WebAssert::titleEquals() and AssertLegacyTrait::assertTitle()
Comment #3
longwaveAlso a lot of false positives here, e.g. the definition of t() itself, a test of the TranslatableMarkup object, etc.
Comment #4
munish.kumar commentedComment #5
munish.kumar commentedComment #7
quietone commentedHere are some examples of the lines identified by this sniff.
Perhaps this sniff is one not to implement? Or does it need more work?
Comment #8
spokjeComment #14
quietone commentedComment #15
quietone commentedComment #16
smustgrave commentedThis one seems straightforward as it's adding the ignore line.
Comment #17
alexpottWhen I read the issue title I was like uhoh I hope I agree with the implementation of this rule by coder as some of coder's opinions are highly debatable. So I reviewed all the places where we are adding skips and I think this shows the value of the rule. There are things we would not have done in core if this rule was present - so that is great. However that means I think we should add follow-ups to address all these places where we are skipping the rule and should not be.
Comment #18
quietone commentedMade lots of followups and committed the suggestions made in the MR. Setting back to NR.
Comment #19
smustgrave commentedShould todos be placed next to the ignore comments?
Comment #20
smustgrave commentedRemoving the follow up tag as appears @quietone did all that.
Disregard my comment in #19 seeing other phpcs ignores I don't see todos.
Comment #21
alexpottThe MR has conflicts with changes in HEAD
Comment #22
quietone commentedRebased and added ignore for two recent changes.
Comment #23
smustgrave commentedRebase seems fine.
Comment #24
catchAnother question on the MR.
Comment #25
smustgrave commentedFor the 1 suggestion from @catch in the MR.
Comment #26
quietone commentedComment #27
smustgrave commentedFeedback appears to be addressed.
Comment #28
larowlanCouple of questions on the MR
Comment #29
quietone commentedI expanded the followup to include all three methods that raised questions, \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition::label, \Drupal\breakpoint\BreakpointManager::getGroupLabel, and \Drupal\breakpoint\Breakpoint::getLabel. That will allow the sniff to be enabled, and prevent further violations, and leave the existing code as is.
Comment #30
smustgrave commentedResolved most of the threads but the 3 could use some feedback on.
Comment #31
quietone commentedRebased.
Feedback on what? What are the questions that need to be answered?
Comment #32
smustgrave commentedNeeds manual rebase.
As mentioned there are a number of these floating around if you want to focus on one and ping that to me I'll prioritize it @quietone, so you don't have to keep rebasing a dozen of them.
Comment #33
quietone commentedI have thought about that but I also like that the changes are less when rebasing frequently.
Rebase and add more ignore lines.
Comment #34
smustgrave commentedNo worries just made the offer to help. But if you don't mind rebasing I'll keep reviewing.
Latest rebase seems fine.
Comment #37
larowlanCommitted to 11.x - fixed
Comment #38
nikolay shapovalov commentedIt looks like code duplication was made at core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php
There is fix at #3227598: Remove remaining uses of FormattableMarkup in kernel test assertions.