Problem/Motivation
There are some Drupal coding standard errors which needs to to be fixed.
Steps to reproduce
Run phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml web/modules/contrib/pdb
FILE: ...t/lampp/htdocs/debugger/web/modules/contrib/pdb/src/ComponentDiscovery.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\Core\Extension\ExtensionDiscovery.
115 | WARNING | [x] There must be no blank line following an inline comment
115 | WARNING | [ ] There must be no blank line following an inline comment
152 | WARNING | [x] There must be no blank line following an inline comment
152 | WARNING | [ ] There must be no blank line following an inline comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ampp/htdocs/debugger/web/modules/contrib/pdb/src/Plugin/Block/PdbBlock.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
17 | WARNING | [ ] The class short comment should describe what the class
| | does and not simply repeat the class name
230 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
253 | ERROR | [ ] Each @deprecated tag must have a @see tag immediately
| | following it
257 | ERROR | [ ] The trigger_error message 'addEntityJsContext() is
| | deprecated in pdb:8.x-1.0 and is removed from pdb:2.0.0.
| | Use ::getContextEntityValue() instead.' does not match the
| | strict standard format: %thing% is deprecated in
| | %deprecation-version% and is removed from
| | %removal-version%. %extra-info%. See %cr-link%
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: /opt/lampp/htdocs/debugger/web/modules/contrib/pdb/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
210 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------
FILE: ...ugger/web/modules/contrib/pdb/tests/src/Unit/Plugin/Block/PdbBlockTest.php
--------------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 10 LINES
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
8 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is
| | Drupal\Core\DependencyInjection\ContainerBuilder.
86 | ERROR | [x] Missing function doc comment
90 | ERROR | [x] Missing function doc comment
94 | ERROR | [x] Missing function doc comment
98 | ERROR | [x] Missing function doc comment
102 | ERROR | [x] Missing function doc comment
106 | ERROR | [x] Missing function doc comment
114 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
128 | ERROR | [ ] Key specified for array entry; first entry has no key
143 | ERROR | [ ] No key specified for array entry; first entry specifies
| | key
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...dules/contrib/pdb/tests/src/Unit/Plugin/Derivative/PdbBlockDeriverTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
6 | ERROR | [x] Use statements should be sorted alphabetically. The first
| | wrong one is Drupal\pdb\ComponentDiscoveryInterface.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../pdb/modules/pdb_react/components/react_example_1/react_example_1.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: .../modules/contrib/pdb/modules/pdb_react/components/react_todo/css/index.css
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
6 | ERROR | No style definition found on line; check for missing colon
217 | ERROR | No style definition found on line; check for missing colon
218 | ERROR | No style definition found on line; check for missing colon
219 | ERROR | No style definition found on line; check for missing colon
220 | ERROR | No style definition found on line; check for missing colon
--------------------------------------------------------------------------------
FILE: ...es/contrib/pdb/modules/pdb_react/components/react_todo/react_todo.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: ...docs/debugger/web/modules/contrib/pdb/modules/pdb_react/pdb_react.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | All dependencies must be prefixed with the project name, for
| | example "drupal:"
--------------------------------------------------------------------------------
FILE: ...g2/components/ng2_example_configuration/ng2_example_configuration.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: ...ontrib/pdb/modules/pdb_ng2/components/ng2_example_1/ng2_example_1.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: .../modules/contrib/pdb/modules/pdb_ng2/components/ng2_hero/ng2_hero.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: ...ontrib/pdb/modules/pdb_ng2/components/ng2_example_2/ng2_example_2.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: .../pdb/modules/pdb_ng2/components/ng2_example_node/ng2_example_node.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: .../modules/contrib/pdb/modules/pdb_ng2/components/ng2_todo/ng2_todo.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | "core_version_requirement" property is missing in the info.yml
| | file
--------------------------------------------------------------------------------
FILE: ...gger/web/modules/contrib/pdb/modules/pdb_ng2/components/ng2_todo/style.css
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
245 | ERROR | No style definition found on line; check for missing colon
246 | ERROR | No style definition found on line; check for missing colon
247 | ERROR | No style definition found on line; check for missing colon
248 | ERROR | No style definition found on line; check for missing colon
--------------------------------------------------------------------------------
FILE: ...s/debugger/web/modules/contrib/pdb/modules/pdb_ng2/src/Form/PdbNg2Form.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
12 | WARNING | The class short comment should describe what the class does and
| | not simply repeat the class name
51 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------
FILE: ...mpp/htdocs/debugger/web/modules/contrib/pdb/modules/pdb_ng2/pdb_ng2.module
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
--------------------------------------------------------------------------------
6 | ERROR | [x] There must be exactly one blank line after the file comment
12 | ERROR | [ ] Missing parameter comment
14 | ERROR | [x] Expected 1 blank line before function; 2 found
16 | WARNING | [ ] Unused variable $key.
21 | WARNING | [ ] Unused variable $ext.
23 | WARNING | [ ] Unused variable $ext.
28 | ERROR | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...tdocs/debugger/web/modules/contrib/pdb/modules/pdb_ng2/pdb_ng2.routing.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
7 | WARNING | The administration page callback should probably use "administer
| | site configuration" - which implies the user can change
| | something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
--------------------------------------------------------------------------------
FILE: ...p/htdocs/debugger/web/modules/contrib/pdb/modules/pdb_ng2/pdb_ng2.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
8 | WARNING | All dependencies must be prefixed with the project name, for
| | example "drupal:"
--------------------------------------------------------------------------------
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | interdiff_phpcs-fixes_368001_4_3368001_8_coding_standard.txt | 5.44 KB | chaitanyadessai |
| #9 | 3368001-8-coding_standard.patch | 16.69 KB | chaitanyadessai |
| #7 | afterpatch.png | 125.08 KB | thakurnishant_06 |
| #4 | phpcs-fixes-3368001-4.patch | 9.71 KB | emacoti |
Issue fork pdb-3368001
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
emacoti commentedComment #3
emacoti commentedComment #4
emacoti commentedHere the patch with the fixes
Comment #5
arpitk commentedPlease update the summary with all details including the command and the arguments used to scan and the errors/warnings produced.
Thanks!
Comment #6
thakurnishant_06 commentedUpdated the issue summary :)
Comment #7
thakurnishant_06 commentedHello @emacoti , hope you are doing well.
Applied your patch for Decoupled Blocks 8.x-1.x-dev . Patch applied cleanly . But some issue still remains .
Added screenshot for references. Please have a look.
Thank you .
Comment #9
chaitanyadessai commentedPatch added please review, Fixed errors reported by phpcs command used vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,install,inc,theme,install,test,profile,css,info,txt,md,yml web/modules/pdb/
Comment #11
zarpele commented@emacoti @chaitanyadessai Please try to use MR instead of patch method.
The MR!5 do implements @emacoti patch and the new fixes.
Probably we need a new ticket to implement these lines https://git.drupalcode.org/project/pdb/-/merge_requests/5/diffs#ea414eb1..., I completely removed the code.
I have a clean board doing: `phpcs --standard=Drupal,DrupalPractice --extensions=php,module,in,install,test,profile,theme,css,info,txt,md,yml`
Comment #12
zarpele commentedThanks, @emacoti to complete the tasks on the MR, the changes make sense to me.
Comment #14
segovia94 commentedComment #15
emacoti commented