Fix the warnings/errors reported by PHP_CodeSniffer

Created on 6 July 2023, over 1 year ago
Updated 21 August 2024, 3 months ago

Problem/Motivation

FILE: /home/lenovo/druapl7to9/web/modules/contrib/hidden_language/hidden_language.module
--------------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 4 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] Missing file doc comment
  15 | ERROR   | [ ] The array declaration extends to column 102 (the limit is 80). The array content should be split up over
     |         |     multiple lines
  15 | WARNING | [ ] The use of function fnmatch() is discouraged
  38 | WARNING | [x] A comma should follow the last multiline array item. Found: )
  85 | ERROR   | [ ] The array declaration extends to column 160 (the limit is 80). The array content should be split up over
     |         |     multiple lines
  91 | WARNING | [ ] Unused variable $id.
 105 | ERROR   | [ ] The array declaration extends to column 92 (the limit is 80). The array content should be split up over
     |         |     multiple lines
 116 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
 138 | ERROR   | [x] Additional blank lines found at end of doc comment
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/hidden_language/views/hidden_language.views.inc
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------
 1 | ERROR   | [x] Missing file doc comment
 6 | WARNING | [x] '@todo: add relationships' should match the format '@todo Fix problem X here.'
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/hidden_language/hidden_language.install
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 1 | ERROR | [x] Missing file doc comment
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------


FILE: /home/lenovo/druapl7to9/web/modules/contrib/hidden_language/hidden_language.test
--------------------------------------------------------------------------------------------------------------------------------
FOUND 14 ERRORS AND 1 WARNING AFFECTING 13 LINES
--------------------------------------------------------------------------------------------------------------------------------
  12 | ERROR   | [ ] Class property $admin_user should use lowerCamel naming without underscores
  12 | ERROR   | [ ] Missing member variable doc comment
  14 | ERROR   | [ ] Class property $admin_user_permissions should use lowerCamel naming without underscores
  14 | ERROR   | [ ] Missing member variable doc comment
  21 | ERROR   | [x] Missing function doc comment
  46 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
  62 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
  64 | ERROR   | [ ] Missing parameter type
  83 | ERROR   | [ ] The array declaration extends to column 261 (the limit is 80). The array content should be split up over
     |         |     multiple lines
 114 | ERROR   | [ ] The array declaration extends to column 91 (the limit is 80). The array content should be split up over
     |         |     multiple lines
 152 | ERROR   | [ ] Missing parameter type
 164 | ERROR   | [x] Missing class doc comment
 166 | ERROR   | [x] Missing function doc comment
 174 | ERROR   | [x] Missing function doc comment
 186 | ERROR   | [x] Missing function doc comment
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India roshni27

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

  • Issue created by @roshni27
  • Merge request !2fixes issues reported by phpcs ā†’ (Open) created by roshni27
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India roshni27

    Please review MR

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs work 3 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @roshni27,

    I applied MR!2, it was applied smoothly and fixed most of the phpcs issues.

    These are the remaining issues After I ran

    </code>.
    
    <code>āžœ  hidden_language git:(2.0.0-beta3) curl https://git.drupalcode.org/project/hidden_language/-/merge_requests/2.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 12954    0 12954    0     0  28826      0 --:--:-- --:--:-- --:--:-- 28786
    patching file Form/HiddenLanguageForm.php
    patching file hidden_language.links.menu.yml
    patching file hidden_language.module
    patching file src/EventSubscriber/HiddenLanguageSubscriber.php
    patching file src/Form/HiddenLanguageForm.php
    patching file src/HiddenLanguageManager.php
    patching file src/HiddenLanguagePermissions.php
    āžœ  hidden_language git:(2.0.0-beta3) āœ— ..
    āžœ  contrib phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js hidden_language
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/hidden_language/hidden_language.module
    -----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
     3 | ERROR | Missing short description in doc comment
    -----------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/hidden_language/src/HiddenLanguagePermissions.php
    ----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------
     45 | ERROR | Description for the @return value is missing
    ----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/hidden_language/src/HiddenLanguageManager.php
    ------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------
     39 | ERROR | Missing @var tag in member variable comment
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/hidden_language/src/EventSubscriber/HiddenLanguageSubscriber.php
    -------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------------------------------
     101 | WARNING | Line exceeds 80 characters; contains 84 characters
     108 | WARNING | ConfigurableLanguage::load calls should be avoided in classes, use dependency injection instead
    -------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 194ms; Memory: 10MB
    
    āžœ  contrib

    Thank you.

  • Pipeline finished with Success
    3 months ago
    Total: 121s
    #260240
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review MR!2. Thank you.

  • Status changed to Needs review 3 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh
Production build 0.71.5 2024