Fix the issues reported by phpcs

Created on 8 July 2024, 5 months ago
Updated 10 July 2024, 5 months ago

Problem/Motivation

command -:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig web/modules/contrib/martelus_companion/

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/README.md
------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------
14 | WARNING | [ ] Line exceeds 80 characters; contains 115 characters
23 | WARNING | [ ] Line exceeds 80 characters; contains 152 characters
27 | ERROR | [x] Expected 1 newline at end of file; 3 found
------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/config/schema/martelus_companion.schema.yml
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/martelus_companion.info.yml
-------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" 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: /var/www/html/d10/web/modules/contrib/martelus_companion/martelus_companion.module
--------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------------------------
9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
13 | ERROR | [x] There must be no blank lines after the function comment
36 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
37 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
46 | ERROR | [x] Expected 1 space after IF keyword; 0 found
52 | ERROR | [x] Expected 1 newline at end of file; 2 found
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/martelus_companion.links.menu.yml
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
6 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/src/Plugin/Block/MartelusCompanionBlock.php
---------------------------------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 7 LINES
---------------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactory.
8 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
16 | ERROR | [x] There must be exactly one newline after the class comment
35 | ERROR | [x] Missing function doc comment
49 | ERROR | [x] Empty array declaration must have no space between the parentheses
59 | ERROR | [x] Short array syntax must be used to define arrays
67 | ERROR | [x] Expected 1 blank line after function; 0 found
68 | ERROR | [x] Expected 1 newline at end of file; 3 found
68 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/src/Form/MartelusCompanionForm.php
----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 6 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------------------------------------------------------
11 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
35 | WARNING | [x] A comma should follow the last multiline array item. Found: 'martelus_companion.settings'
62 | WARNING | [x] A comma should follow the last multiline array item. Found: '
77 | WARNING | [x] A comma should follow the last multiline array item. Found: '
83 | WARNING | [x] A comma should follow the last multiline array item. Found: '
98 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
101 | ERROR | [x] Expected 1 newline at end of file; 3 found
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/martelus_companion.routing.yml
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
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.
9 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/d10/web/modules/contrib/martelus_companion/martelus_companion.libraries.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
9 | ERROR | [x] Expected 1 newline at end of file; 2 found
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------

Time: 141ms; Memory: 10MB

Steps to reproduce

Run PHPCS on Config Pages module.

Proposed resolution

Fixed the coding standards.

Remaining tasks

Submit the patch either MR.

📌 Task
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇮🇳India hetal.solanki

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024