Adjust the drupal coding standards in the new 4.x version

Created on 23 January 2023, over 2 years ago
Updated 26 July 2023, almost 2 years ago

Problem/Motivation

Currently in the new 4.x version there is a technical debt in the code to start following the drupal coding standards in the code

Steps to reproduce

Execute the phpcs with standards of codes "DrupalCodingStandards to see the list of:

FILE: ...rsimple_redirect/src/EventSubscriber/SimpleRedirectRequestSubscriber.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 3 WARNINGS AFFECTING 8 LINES
-------------------------------------------------------------------------------------------------------------------------------------
 15 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 21 | ERROR   | [x] Visibility must be declared on method "getSubscribedEvents"
 29 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 31 | ERROR   | [ ] Missing parameter comment
 34 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
 34 | WARNING | [x] There must be no blank line following an inline comment
 34 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 0
 34 | ERROR   | [x] 4 spaces found before inline comment; expected "// drupal_set_message('Event kernel.request thrown by Subscriber
    |         |     in module simple_redirect.', 'status', TRUE);" but found "//    drupal_set_message('Event kernel.request thrown
    |         |     by Subscriber in module simple_redirect.', 'status', TRUE);"
 34 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 47 | ERROR   | [ ] Missing parameter comment
 47 | ERROR   | [ ] Missing parameter type
 48 | ERROR   | [x] Separate the @param and @return sections by a blank line.
 48 | ERROR   | [ ] Description for the @return value is missing
 54 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 0
 54 | ERROR   | [x] 6 spaces found before inline comment; expected "// if ("/drupal" . $conf->getFrom() == $fromUrl) {" but found
    |         |     "//      if ("/drupal" . $conf->getFrom() == $fromUrl) {"
 54 | ERROR   | [x] Inline comments must start with a capital letter
 54 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------


FILE: simple_redirect/src/Form/SimpleRedirectForm.php
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 16 ERRORS AND 4 WARNINGS AFFECTING 14 LINES
-------------------------------------------------------------------------------------------------------------------------------------
 13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
 42 | ERROR   | [x] Short array syntax must be used to define arrays
 50 | ERROR   | [x] Short array syntax must be used to define arrays
 62 | ERROR   | [x] Missing function doc comment
 68 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 68 | ERROR   | [x] 6 spaces found before inline comment; expected "// $form_id = $form_state->getValue('form_id');" but found "//  
    |         |        $form_id = $form_state->getValue('form_id');"
 69 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
 69 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 70 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 71 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 72 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 73 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
 73 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 73 | ERROR   | [ ] Comment indentation error, expected only 6 spaces
 74 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 75 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 76 | WARNING | [ ] Line exceeds 80 characters; contains 114 characters
 76 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
 76 | ERROR   | [ ] Comment indentation error, expected only 6 spaces
 77 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 0
-------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------


FILE: simple_redirect/src/Entity/SimpleRedirect.php
---------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
---------------------------------------------------------------------------------------------------------------
 80 | ERROR | [ ] Missing short description in doc comment
 87 | ERROR | [ ] Missing short description in doc comment
 92 | ERROR | [x] Expected 1 blank line after function; 0 found
 93 | ERROR | [x] The closing brace for the class must have an empty line before it
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------


FILE: simple_redirect/src/Entity/SimpleRedirectInterface.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
 17 | ERROR | Description for the @return value is missing
 24 | ERROR | Description for the @return value is missing
------------------------------------------------------------------------------------------------------------------------

Time: 633ms; Memory: 8MB

Proposed resolution

Fix all items for the 4.x version

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇧🇷Brazil renatog Campinas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024