Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Part of #2571965: [meta] Fix PHP coding standards in core.
Problem/Motivation
For easy reading is a Drupal Best Practice break one per line if exceed 80 chars (columns). In this case exists 642.
Screenshot:
Proposed resolution
I fixed the Long Array for one item per line.
The patch with the fix it's in the attachment.
https://www.drupal.org/files/issues/long_array_fixed_for-2901306-2.patch
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#24 | long_array_fix-2901306-24.patch | 2.5 KB | kkalashnikov |
#2 | long_array_fixed_for-2901306-2.patch | 3.14 KB | renatog |
Comments
Comment #2
renatogPatch with the fix it's in the attachment.
Thank you very much, people.
Good Work.
Regards.
Comment #3
renatogComment #4
cilefen CreditAttribution: cilefen commentedThank 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.
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.
If we grant exceptions then we'll never finish the larger task of making all of core coding standards automated and checked all the time.
Comment #5
cilefen CreditAttribution: cilefen commentedComment #6
renatogUpdate for standards of #2571965: [meta] Fix PHP coding standards in core as cited by @cilefen in #4
Thank you very much.
Comment #7
renatogComment #8
cilefen CreditAttribution: cilefen commentedIs every instance in core fixed in the patch and the phpcs rule activated?
Comment #9
mfernea CreditAttribution: mfernea at AmeXio commentedI think we should also clarify which sniff is targeted here. Drupal.Array.Array from the title contains 4 sniffs:
Comment #10
renatogMakes sense.
Updated
Comment #11
mfernea CreditAttribution: mfernea at AmeXio commentedComment #12
mfernea CreditAttribution: mfernea at AmeXio commentedPlease take a look at one of the related issues to see how the phpcs.xml.dist should be modified and how to test that the targeted sniff is fixed.
Comment #13
robertoperuzzoI'm working on this at DrupalCon Vienna 2017.
Comment #14
robertoperuzzoI have my flight back home now. I'll working on it next days.
Comment #15
Ivan Berezhnov CreditAttribution: Ivan Berezhnov as a volunteer and at Drupal Ukraine Community for Levi9 commentedComment #17
rakesh.gectcrComment #18
idebr CreditAttribution: idebr at iO commentedComment #23
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commentedComment #24
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commentedComment #25
kkalashnikov CreditAttribution: kkalashnikov at Srijan | A Material+ Company for Drupal India Association commentedComment #26
renatogReally Looks good!
Thank you so much.
Comment #27
longwaveThanks for the patch!
We should also remove the exclusion of this sniff from phpcs.xml.dist to check that this covers all cases and to avoid this rule being broken again in the future.
Comment #28
longwaveIt looks like there are hundreds of cases of long array declarations, fixing these one by one is going to be far too time consuming.
#3116859: [meta] Fix Drupal.Array.Array.LongLineDeclaration coding standard is already open to deal with this in a more structured way.