It is likely that the next release of Coder will include the modification #3153448: Why is a two-element array allowed to exceed the maximum line length?. This will mean that the following errors will be reported:

FILE: scheduler/scheduler.module
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
 379 | ERROR | The array declaration line has 104 characters (the limit is 80). The array
     |       | content should be split up over multiple lines
     |       | (Drupal.Arrays.Array.LongLineDeclaration)
------------------------------------------------------------------------------------------

FILE: ...scheduler/scheduler_rules_integration/scheduler_rules_integration.rules_defaults.inc
------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------
 25 | ERROR | The array declaration line has 115 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 40 | ERROR | The array declaration line has 115 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
------------------------------------------------------------------------------------------

FILE: ...scheduler/tests/src/Functional/SchedulerPastDatesTest.php
------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------
 97 | ERROR | The array declaration line has 82 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
------------------------------------------------------------------------------------------

FILE: ... scheduler/tests/src/Functional/SchedulerRulesEventsTest.php
------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
------------------------------------------------------------------------------------------
 56 | ERROR | The array declaration line has 126 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 57 | ERROR | The array declaration line has 135 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 58 | ERROR | The array declaration line has 105 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 59 | ERROR | The array declaration line has 130 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 60 | ERROR | The array declaration line has 139 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
 61 | ERROR | The array declaration line has 109 characters (the limit is 80). The array
    |       | content should be split up over multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
------------------------------------------------------------------------------------------

Instead of altering the source, we can chose to extend the 80-char limit (which is, by some accounts, fairly outdated now anyway). The phpcs.xml.dist setting for the array checking limit Y can be set separately from the overall line length X, and individual files can have their own limit Z

  <rule ref="Drupal.Files.LineLength">
    <properties>
      <property name="lineLimit" value="X"/>
    </properties>
  </rule>
  <rule ref="Drupal.Arrays.Array">
    <properties>
      <property name="lineLimit" value="Y"/>
    </properties>
  </rule>
*
* phpcs:set Drupal.Arrays.Array lineLimit Z
*

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes

Setting the main limit to 120 is fine, but 140 is too much for all files. However, we can make a special case for the test file, and add
* phpcs:set Drupal.Arrays.Array lineLimit 140 to the header for that file only.

jonathan1055’s picture

Title: Increase allowed line lenth » Increase allowed line length to 100 and array length to 120
Status: Active » Needs review
Related issues: +#3153448: Why is a two-element array allowed to exceed the maximum line length?
StatusFileSize
new1.49 KB

In preparation for the new sniff, might as well get this done now.

  • jonathan1055 committed 38fdf8b on 8.x-1.x
    Issue #3163709 by jonathan1055: Increase allowed line length to 100 and...
jonathan1055’s picture

Status: Needs review » Fixed
jonathan1055’s picture

Issue summary: View changes

Updated IS to include individual file limit.

  • jonathan1055 committed 2a277e6 on 8.x-1.x
    Issue #3163709 by jonathan1055: Revert max line length to default of 80
    
jonathan1055’s picture

Title: Increase allowed line length to 100 and array length to 120 » Increase allowed inline array length to 120

Changed title for accuracy.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.