Fix the issues reported by phpcs

Created on 4 July 2023, over 1 year ago
Updated 6 October 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/required_content/src/Form/SettingsForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 24 WARNINGS AFFECTING 34 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | [x] Unused use statement
8 | WARNING | [x] Unused use statement
9 | WARNING | [x] Unused use statement
10 | WARNING | [x] Unused use statement
11 | WARNING | [x] Unused use statement
15 | WARNING | [x] Unused use statement
43 | ERROR | [x] Data types in @var tags need to be fully namespaced
47 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
81 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
86 | ERROR | [x] Data types in @var tags need to be fully namespaced
97 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
119 | WARNING | [x] 'TODO: include values for base fields that do not have a default value' should match the format '@todo Fix problem X
| | here.'
120 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
120 | WARNING | [x] 'TODO: include values for base fields where the actual value is different from the default' should match the format
| | '@todo Fix problem X here.'
120 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
126 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 3 empty lines
128 | ERROR | [ ] More than 2 empty lines are not allowed
132 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
133 | ERROR | [x] Array indentation error, expected 8 spaces but found 10
163 | WARNING | [ ] #options values usually have to run through t() for translation
164 | WARNING | [ ] #options values usually have to run through t() for translation
174 | ERROR | [x] Data types in @var tags need to be fully namespaced
189 | WARNING | [ ] #description values usually have to run through t() for translation
219 | ERROR | [x] Expected newline after closing brace
235 | WARNING | [ ] Unused variable $bundle.
242 | ERROR | [x] Data types in @var tags need to be fully namespaced
265 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
270 | WARNING | [x] There must be no blank line following an inline comment
270 | WARNING | [ ] There must be no blank line following an inline comment
279 | ERROR | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
281 | WARNING | [x] There must be no blank line following an inline comment
281 | WARNING | [ ] There must be no blank line following an inline comment
281 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 24 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/required_content/src/EventSubscriber/RequiredContentSubscriber.php
-------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 6 WARNINGS AFFECTING 10 LINES
-------------------------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
16 | ERROR | [ ] Missing member variable doc comment
18 | ERROR | [x] Missing function doc comment
38 | ERROR | [x] Visibility must be declared on method "handleMissingContentEntity"
38 | ERROR | [x] Missing function doc comment
52 | ERROR | [x] Data types in @var tags need to be fully namespaced
68 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
-------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------

FILE: /var/www/html/vb/d_cont/required_content/src/EventSubscriber/MissingContentSubscriber.php
-----------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 2 WARNINGS AFFECTING 14 LINES
-----------------------------------------------------------------------------------------------
11 | ERROR | [x] Missing class doc comment
13 | ERROR | [ ] Missing member variable doc comment
14 | ERROR | [ ] Missing member variable doc comment
17 | ERROR | [x] Missing function doc comment
17 | ERROR | [x] Expected 1 blank line before function; 2 found
20 | ERROR | [x] Expected 1 blank line after function; 2 found
58 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
59 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
59 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
60 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
61 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
62 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 8
63 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
64 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
65 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
67 | ERROR | [x] Line indented incorrectly; expected 5 spaces, found 4
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------

Time: 113ms; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig required_content/

Remaining tasks

Patch review

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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

Comments & Activities

  • Issue created by @urvashi_vora
  • Hii, @urvashi_vora thanks for the patch,

    These are the steps I followed:

    1. Took clone from git version 1.0.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/required_content/

    3. Applied your patch and, again ran phpcs command

    found errors.

    4. Created a patch and resolved the errors again check with
    phpcs command found no errors

    Please Review.

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi Satish_kumar

    I reviewed patch #2, applied against Required Content, and confirmed it fixes all the issues reported by phpcs.

    I added screenshots for reference.
    Thank you.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    Gautam_105@ โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    Hi Satish_kumar
    i have applied patch #2 that resolved all the phpcs issues And i have created MR for the same. see screenshot as well.

  • @gautam_105 opened merge request.
Production build 0.71.5 2024