Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The 8.x-1.x code is not passing phpcs
using the Drupal standard.
Here are the current results:
$ phpcs --ignore=*.md --standard=Drupal .
FILE: ...iners/workspace/drupal-8.4.x/modules/datalayer/datalayer.api.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
35 | ERROR | [ ] Type hint "array" missing for $properties
49 | ERROR | [ ] Type hint "array" missing for $data_layer
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...ners/workspace/drupal-8.4.x/modules/datalayer/datalayer.info.yml
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
----------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added
| | by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added
| | by drupal.org packaging automatically
----------------------------------------------------------------------
FILE: ...ainers/workspace/drupal-8.4.x/modules/datalayer/datalayer.module
----------------------------------------------------------------------
FOUND 32 ERRORS AND 2 WARNINGS AFFECTING 32 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
10 | ERROR | [x] PHP keywords must be lowercase; expected "use"
| | but found "Use"
30 | ERROR | [x] Expected 1 blank line after function; 2 found
53 | ERROR | [x] Expected 1 blank line after function; 2 found
81 | ERROR | [x] Expected 1 blank line after function; 2 found
108 | ERROR | [x] Expected 1 blank line after function; 2 found
129 | ERROR | [x] Concat operator must be surrounded by a single
| | space
129 | ERROR | [x] Concat operator must be surrounded by a single
| | space
131 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: 'datalayers-js'
159 | ERROR | [x] Expected 1 blank line after function; 2 found
182 | ERROR | [x] Expected 1 blank line after function; 2 found
200 | ERROR | [x] Expected 1 blank line after function; 2 found
206 | ERROR | [ ] Description for the @return value is missing
221 | ERROR | [ ] Description for the @return value is missing
227 | ERROR | [x] Namespaced classes/interfaces/traits should be
| | referenced with use statements
256 | ERROR | [x] Expected 1 blank line after function; 2 found
329 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, colons, question marks, or
| | closing parentheses
338 | ERROR | [x] Namespaced classes/interfaces/traits should be
| | referenced with use statements
413 | ERROR | [x] Expected 1 blank line after function; 2 found
429 | ERROR | [ ] Type hint "array" missing for $data
459 | ERROR | [x] Expected 1 blank line after function; 2 found
465 | ERROR | [x] Doc comment long description must start with a
| | capital letter
471 | ERROR | [x] Expected 1 space after FOREACH keyword; 0 found
478 | ERROR | [x] Expected 1 blank line after function; 2 found
536 | ERROR | [x] Expected newline after closing brace
553 | ERROR | [x] Doc comment short description must end with a
| | full stop
555 | ERROR | [ ] Doc comment for parameter $field does not match
| | actual variable name $field_type
558 | ERROR | [x] Parameter comment must end with a full stop
568 | ERROR | [x] Case breaking statements must be followed by a
| | single blank line
575 | ERROR | [x] Case breaking statements must be followed by a
| | single blank line
588 | WARNING | [ ] Format should be "* Implements hook_foo().", "*
| | Implements hook_foo_BAR_ID_bar() for
| | xyz_bar().",, "* Implements
| | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.",
| | "* Implements hook_foo_BAR_ID_bar() for
| | xyz-bar.tpl.php.", or "* Implements
| | hook_foo_BAR_ID_bar() for block templates."
594 | ERROR | [x] Inline comments must start with a capital letter
594 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, colons, question marks, or
| | closing parentheses
608 | ERROR | [ ] Invalid function name, expected get_entity_group
| | but found getEntityGroup
----------------------------------------------------------------------
PHPCBF CAN FIX THE 28 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...rupal-8.4.x/modules/datalayer/src/Form/DatalayerSettingsForm.php
----------------------------------------------------------------------
FOUND 5 ERRORS AND 12 WARNINGS AFFECTING 17 LINES
----------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
11 | ERROR | [x] Missing class doc comment
93 | ERROR | [x] Missing function doc comment
119 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: TRUE
120 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
121 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
137 | WARNING | [x] A comma should follow the last multiline array
| | item. Found:
| | 'https://github.com/google/data-layer-helper'
159 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: TRUE
160 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
161 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
215 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: TRUE
216 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
217 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: ]
237 | ERROR | [x] Expected 1 space after "="; 2 found
263 | ERROR | [x] Inline comments must end in full-stops,
| | exclamation marks, colons, question marks, or
| | closing parentheses
337 | ERROR | [x] Inline comments must start with a capital letter
----------------------------------------------------------------------
PHPCBF CAN FIX THE 17 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: .../drupal-8.4.x/modules/datalayer/src/Tests/DataLayerUnitTests.php
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
16 | ERROR | [x] Missing class doc comment
23 | ERROR | [ ] If the line declaring an array spans longer than 80
| | characters, each element should be broken into its
| | own line
73 | ERROR | [x] Doc comment short description must end with a full
| | stop
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...e/drupal-8.4.x/modules/datalayer/src/Tests/DataLayerWebTests.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
7 | ERROR | [x] Missing class doc comment
45 | ERROR | [x] There must be exactly one blank line before the
| | tags in a doc comment
58 | ERROR | [x] Expected 1 blank line after function; 0 found
59 | ERROR | [x] The closing brace for the class must have an empty
| | line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Proposed resolution
Correct all current code style errors.
Remaining tasks
Correct all current code style errors.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#3 | code_style_updates-2877514-3.patch | 15.53 KB | bighappyface |
Comments
Comment #2
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedComment #3
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedComment #4
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedComment #5
WidgetsBurritos CreditAttribution: WidgetsBurritos at Rackspace commented+1 LGTM
Comment #7
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commentedComment #8
bighappyface CreditAttribution: bighappyface at Rackspace for Rackspace commented