Problem/Motivation
https://www.drupal.org/project/coder/releases/8.3.9 released on 8 May 2020 at 18:31 CST
Proposed resolution
Remember checking potential coding standard violations
$ composer update drupal/coder squizlabs/php_codesniffer
$ composer run phpcs -- -ps
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
The development dependency drupal/coder has been updated to 8.3.9. New coding standards rules are now available with this update.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3134731-2.patch | 2.05 KB | jungle |
| #26 | 3134731-9.x-26.patch | 2.05 KB | jungle |
| #26 | 3134731-8.9.x-26.patch | 1.71 KB | jungle |
Comments
Comment #2
jungleComment #3
jungle$ composer update drupal/coder squizlabs/php_codesnifferget coder updated only$ composer run phpcs -- -psno coding standard violations.Comment #4
jungleAgain, a wrong patch uploaded, sorry!
Comment #5
andypostBtw maybe default core list of sniffers needs update with newly added to coder?
Comment #6
jungle#5, good point, thank you @andypost!
Comment #7
jungleComment #8
jonathan1055 commentedFor background, the reason for this new Coder release 8.3.9 (8th May) so soon after 8.3.8 (24th March) is primarily to allow #3094454: Fix remaining @deprecated manually and enable the coding standard to make progress at core 8.9. Work has already been done at Core 9.1 and 9.0 and they are completely clean with regard to @deprecated standards so there should be no problem in committing 8.3.9 there. Then it can be back-ported to Core 8.9 and that's the aim, so that we can fix all @deprecated text layouts and then enable the main deprecated sniff.
Comment #9
andypost@jonathan1055 thanks for pointer, looks like better to file follow-up to add new sniffers
Comment #10
jungleAll sniffers available in coder 8.3.9 generated with the command below and attached.
./vendor/bin/phpcs --standard=Drupal,DrupalPractice --runtime-set installed_paths vendor/drupal/coder/coder_sniffer -e > all-sniffers-coder-8.3.9.txtall-sniffers-coder-8.3.9.txt, another tab openscore/phpcs.xml.distcomparing the two files side by side.Key changes:
Generic.CodeAnalysis.EmptyPHPStatement is not available in the new version.
Thanks!
Comment #11
jungleForgot to mention that #10 is to address #5 and
Add two other changes
Comment #12
jungleFound a workaround to get coder installed from packagist explicitly
Remove Drupal composer repository temporarily first in composer.json
composer update drupal/coder squizlabs/php_codesniffer -vvvto get the new version installed from packagist.composer update --lockto update thecontent-hashvalue incomposer.lock.Comment #13
andypostNice! #12 is ready to be added to some docs page
Comment #14
jungleRerollted patch from #10 against 8.9.x
Comment #15
junglePlease ignore the patch in #14, again and again, it's a wrong patch uploaded, sorry!
Comment #16
jungleTo reviewer(s):
Thanks!
Comment #17
jonathan1055 commentedThanks @jungle. Are the changes to phpcs.xml.dist meant to result in all rules being listed, and now including the ones (commented out) that core does not yet meet. That's a good idea, but I think some are missing from the 8.9 patch.
Howevere, I am finding it hard to review/follow the differences when you have also re-sorted the sniffs alphabetically. I know this is a good idea, but can it be done in a separate patch later so that we can review th actual differences first? Then when we agree on the changes, the lines can be re-ordered.
Comment #18
jungleMoved
renamed
moved
renamed
moved
moved
moved
no more existed
moved
moved
Only one rule deleted,
Generic.CodeAnalysis.EmptyPHPStatement, as it does not exist any more.The rest of the deletion operations are related to move/rename operations.
I realised it's hard to review, but that was in the middle. I should make and submit a reordered patch first. If you think it's necessary, I am ok to do it in a separate issue. or do it again to make a reordered patch to make review easier.
Thank you @jonathan1055!
Comment #19
jonathan1055 commentedThanks @jungle, now I can see what is going on. No need to do a separate issue. Others may have an opinion on which is easier to review first, but I would say leave all the rules where they are for now, so we can see the differences, then when the renames/additions/deletions are agreed we can look at moving the rules.
There is one discrepancy which needs to be addressed - above the 'Drupal' rules is the comment
and only the sniffs which pass are listed. Sub-sniffs that fail are excluded, but rules which fail completely are not present.
However, with your patch, in the 'DrupalPractice' section you have added many rules, all commented out, so this is different from how it is done for the 'Drupal' section above. I think we need a consistent approach. Others will have a view on this too.
Comment #20
longwaveAgree that the diff is hard to read now, can we sort these in a separate issue with no other changes?
Comment #21
jungleThen I would suggest filing 3 more issues:
And about the principles, I would suggest that all sniffers should be listed in phpcs.xml.dist and sorted alphabetically.
a) if it's a sub-sniffer, it should be excluded and sorted alphabetically.
b) if it's not a sub-sniffer, it should be listed, commented and sorted alphabetically as well.
I will wait for agreement before proceeding. Thanks!
Comment #22
longwaveI think that is a reasonable approach, I guess splitting it that way makes the most sense although will take longer to get committed because of the multiple issues. I also think that once the sniffs are sorted and we have all sniffs in the phpcs.xml.dist (commented out or not) that we should add a test to ensure that they stay sorted and that all rules are in place, so future upgrades of Coder will tell us via test failure that we have missed new (or removed) sniffs.
Comment #23
longwaveAlternatively: is it possible to say something like
so we only explicitly exclude sniffs we know about? Then when we upgrade Coder and get new sniffs, they automatically apply, and we have to either fix or exclude them?
Comment #24
jonathan1055 commentedYes. This issue must focus solely on upgrading to Coder 8.3.9 as that is what it was created for. Then the other things can be done afterwards in preparation for when Coder 8.3.10 is released. Hence back at patch 2 in comment #4 which is ready for review at 9.0 and 9.1
That's a good idea
[edit, cross post]
That's an even better idea, as it reduces work, and will also allow new sniffs which already pass to be automatically included with no extra work. If that works, then why was it not done like that before? There must be a catch somewhere.
Comment #25
longwave@jonathan1055: OK so I read the earlier issue comments again and agree with #8 that we should get this upgrade done first, the reordering of rules etc can be done in a separate issue so as not to hold up this upgrade going back to 8.9.x. Therefore #4 is RTBC and @jungle is free to create separate issues as followups.
Comment #26
jungleThanks, @longwave and @jonathan1055 for your comments!
Reuploading the patch in #4 as 3134731-9.x-26.patch for 9.x, and rerolled a patch from #15 for 8.9.x
Comment #27
jungle2 issues field as discussed.
>Step4: Clean up the issue queue, adding @todo with filed issue links to corresponding sniffers/rules in phpcs.xml.dist (Issue #3 to be filed)
This is optional, so no issue filed.
Comment #28
alexpottCommitted and pushed 2838d78eba to 9.1.x and e7bf981a81 to 9.0.x. Thanks!
Committed 86f2bc2bc4 and pushed to 8.9.x. Thanks!
Backported to 8.9.x so that dependencies are up-to-date as much as possible.
Comment #32
jonathan1055 commentedThank you for the fast turn-around Alexpott. Now I can finish off #3094454: Fix remaining @deprecated manually and enable the coding standard and #3122186: Fix @deprecated versions and enable Commenting.Deprecated.DeprecatedVersionFormat sniff
Comment #33
alexpottComment #34
andypostThe dependent issue unblocked #2055851: Remove translation of exception messages
Comment #35
xjmComment #36
xjm