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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RenatoG created an issue. See original summary.

renatog’s picture

Status: Active » Needs review
FileSize
3.14 KB

Patch with the fix it's in the attachment.

Thank you very much, people.

Good Work.

Regards.

renatog’s picture

Issue summary: View changes
FileSize
1.89 MB
cilefen’s picture

Status: Needs review » Needs work

Thank 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.

cilefen’s picture

Category: Feature request » Task
renatog’s picture

Title: Long array fixed for one item per line » Fix Drupal.Array.Array coding standard
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: +Coding standards, +Novice
Parent issue: » #2571965: [meta] Fix PHP coding standards in core

Update for standards of #2571965: [meta] Fix PHP coding standards in core as cited by @cilefen in #4

Thank you very much.

renatog’s picture

Issue summary: View changes
cilefen’s picture

Is every instance in core fixed in the patch and the phpcs rule activated?

mfernea’s picture

Status: Needs review » Needs work

I think we should also clarify which sniff is targeted here. Drupal.Array.Array from the title contains 4 sniffs:

renatog’s picture

Title: Fix Drupal.Array.Array coding standard » Fix Drupal.Array.Array.LongLineDeclaration coding standard
Status: Needs work » Needs review

Makes sense.

Updated

mfernea’s picture

Status: Needs review » Needs work

Please 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.

robertoperuzzo’s picture

I'm working on this at DrupalCon Vienna 2017.

robertoperuzzo’s picture

I have my flight back home now. I'll working on it next days.

Ivan Berezhnov’s picture

Issue tags: +CSKyiv18

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rakesh.gectcr’s picture

Issue tags: +Nwdug_may18
idebr’s picture

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

kkalashnikov’s picture

Assigned: Unassigned » kkalashnikov
kkalashnikov’s picture

kkalashnikov’s picture

Assigned: kkalashnikov » Unassigned
Status: Needs work » Needs review
renatog’s picture

Status: Needs review » Reviewed & tested by the community

Really Looks good!

Thank you so much.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Thanks 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.

longwave’s picture

Status: Needs work » Closed (duplicate)

It 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.