Fix the issues reported by phpcs

Created on 27 January 2023, over 1 year ago
Updated 13 March 2023, over 1 year ago

Couple more issues when running

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml $(pwd)

Result


Added automatic fixed. More issues need fixing:

<code>

FILE: /linkchecker/linkchecker.module
------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 9 LINES
------------------------------------------------------------------------------------------------------------------------------------------------
  35 | ERROR | [ ] Missing parameter type
  38 | ERROR | [ ] Missing parameter type
  44 | ERROR | [ ] Missing parameter type
  48 | ERROR | [ ] Missing parameter type
  50 | ERROR | [ ] Missing parameter type
  53 | ERROR | [x] Tag value indented incorrectly; expected 1 space but found 3
  53 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
 130 | ERROR | [ ] Doc comment is empty
 136 | ERROR | [ ] The array declaration extends to column 142 (the limit is 80). The array content should be split up over multiple lines
 296 | ERROR | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/tests/src/Functional/LinkCheckerInterfaceTest.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------
 151 | ERROR | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
 189 | ERROR | The array declaration extends to column 159 (the limit is 80). The array content should be split up over multiple lines
---------------------------------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/tests/src/Functional/LinkCheckerLinkExtractionTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
  36 | ERROR   | Doc comment is empty
 200 | ERROR   | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
 254 | ERROR   | The array declaration extends to column 199 (the limit is 80). The array content should be split up over multiple lines
 266 | ERROR   | The array declaration extends to column 270 (the limit is 80). The array content should be split up over multiple lines
 277 | ERROR   | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
 305 | WARNING | Line exceeds 80 characters; contains 210 characters
 308 | WARNING | Line exceeds 80 characters; contains 105 characters
 315 | ERROR   | The array declaration extends to column 270 (the limit is 80). The array content should be split up over multiple lines
 349 | WARNING | Line exceeds 80 characters; contains 110 characters
 377 | WARNING | Line exceeds 80 characters; contains 126 characters
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/tests/src/Kernel/LinkcheckerLinkExtractorServiceTest.php
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
 166 | WARNING | Unused variable $relativeUrl.
----------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/LinkCleanUp.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 15 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/Form/LinkCheckerAdminSettingsForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 9 WARNINGS AFFECTING 9 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 176 | WARNING | #options values usually have to run through t() for translation
 177 | WARNING | #options values usually have to run through t() for translation
 294 | WARNING | #options values usually have to run through t() for translation
 295 | WARNING | #options values usually have to run through t() for translation
 296 | WARNING | #options values usually have to run through t() for translation
 297 | WARNING | #options values usually have to run through t() for translation
 298 | WARNING | #options values usually have to run through t() for translation
 371 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 371 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 372 | ERROR   | The array declaration extends to column 880 (the limit is 80). The array content should be split up over multiple lines
-----------------------------------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/Plugin/LinkExtractor/LinkLinkExtractor.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/Plugin/LinkExtractor/HtmlLinkExtractor.php
------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------
  20 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 105 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
------------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/Plugin/LinkStatusHandler/Repair301.php
--------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 276 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
--------------------------------------------------------------------------------------------


FILE: /linkchecker/src/LinkCheckerService.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 20 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /linkchecker/src/LinkCheckerLinkAccessControlHandler.php
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 53 | ERROR | Unnecessarily gendered language in a comment
---------------------------------------------------------------------------------------------


FILE: /linkchecker/src/Commands/LinkCheckerCommands.php
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------------
 149 | WARNING | Exceptions should not be translated
 153 | WARNING | Exceptions should not be translated
--------------------------------------------------------------------------------------

Time: 2.94 secs; Memory: 14MB


Feature request
Status

RTBC

Version

2.0

Component

Code

Created by

🇦🇺Australia VladimirAus Brisbane, Australia

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 @VladimirAus
  • @vladimiraus opened merge request.
  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    Added automatic fixed. More issues need fixing:

    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/linkchecker.module
    ------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 9 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------
      35 | ERROR | [ ] Missing parameter type
      38 | ERROR | [ ] Missing parameter type
      44 | ERROR | [ ] Missing parameter type
      48 | ERROR | [ ] Missing parameter type
      50 | ERROR | [ ] Missing parameter type
      53 | ERROR | [x] Tag value indented incorrectly; expected 1 space but found 3
      53 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
     130 | ERROR | [ ] Doc comment is empty
     136 | ERROR | [ ] The array declaration extends to column 142 (the limit is 80). The array content should be split up over multiple lines
     296 | ERROR | [ ] unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
    ------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/tests/src/Functional/LinkCheckerInterfaceTest.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------
     151 | ERROR | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
     189 | ERROR | The array declaration extends to column 159 (the limit is 80). The array content should be split up over multiple lines
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/tests/src/Functional/LinkCheckerLinkExtractionTest.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
      36 | ERROR   | Doc comment is empty
     200 | ERROR   | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
     254 | ERROR   | The array declaration extends to column 199 (the limit is 80). The array content should be split up over multiple lines
     266 | ERROR   | The array declaration extends to column 270 (the limit is 80). The array content should be split up over multiple lines
     277 | ERROR   | The array declaration extends to column 151 (the limit is 80). The array content should be split up over multiple lines
     305 | WARNING | Line exceeds 80 characters; contains 210 characters
     308 | WARNING | Line exceeds 80 characters; contains 105 characters
     315 | ERROR   | The array declaration extends to column 270 (the limit is 80). The array content should be split up over multiple lines
     349 | WARNING | Line exceeds 80 characters; contains 110 characters
     377 | WARNING | Line exceeds 80 characters; contains 126 characters
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/tests/src/Kernel/LinkcheckerLinkExtractorServiceTest.php
    ----------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------
     166 | WARNING | Unused variable $relativeUrl.
    ----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/LinkCleanUp.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     15 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/Form/LinkCheckerAdminSettingsForm.php
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 9 WARNINGS AFFECTING 9 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
     176 | WARNING | #options values usually have to run through t() for translation
     177 | WARNING | #options values usually have to run through t() for translation
     294 | WARNING | #options values usually have to run through t() for translation
     295 | WARNING | #options values usually have to run through t() for translation
     296 | WARNING | #options values usually have to run through t() for translation
     297 | WARNING | #options values usually have to run through t() for translation
     298 | WARNING | #options values usually have to run through t() for translation
     371 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     371 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     372 | ERROR   | The array declaration extends to column 880 (the limit is 80). The array content should be split up over multiple lines
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/Plugin/LinkExtractor/LinkLinkExtractor.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/Plugin/LinkExtractor/HtmlLinkExtractor.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------
      20 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
     105 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/Plugin/LinkStatusHandler/Repair301.php
    --------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------
     276 | WARNING | '@todo' should match the format '@todo Fix problem X here.'
    --------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/LinkCheckerService.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------
     20 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
    -----------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/LinkCheckerLinkAccessControlHandler.php
    ---------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------
     53 | ERROR | Unnecessarily gendered language in a comment
    ---------------------------------------------------------------------------------------------
    
    
    FILE: /Users/tesboss/_PROJECTS/drupal/linkchecker/src/Commands/LinkCheckerCommands.php
    --------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------
     149 | WARNING | Exceptions should not be translated
     153 | WARNING | Exceptions should not be translated
    --------------------------------------------------------------------------------------
    
    Time: 2.94 secs; Memory: 14MB
    
    
    
  • 🇦🇺Australia VladimirAus Brisbane, Australia
  • 🇦🇺Australia VladimirAus Brisbane, Australia
  • Assigned to spriya2896
  • 🇮🇳India spriya2896

    I will work on this issue.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Nayana Ramakrishnan

    Reviewed MR!39 and there was a warning message while applying the patch

    39.diff:189: trailing whitespace.
          $form['error']['#description'] = $this->t('If enabled, outdated links in content providing a status 
    ....
    warning: 1 line adds whitespace errors.

    Also, there is one more coding standard issue that needs to be fixed

    FILE: ../linkchecker/linkchecker.module
    --------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------
     299 | ERROR | unserialize() is insecure unless allowed classes are limited. Use a safe format like JSON or use the allowed_classes option.
    --------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 1.47 secs; Memory: 16MB
  • First commit to issue fork.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to RTBC over 1 year ago
  • 🇦🇺Australia VladimirAus Brisbane, Australia

    No phpcs warnings. Happy with that!
    Thank for your contributions! 🍻

Production build 0.69.0 2024