Fix the warnings/errors reported by PHP_CodeSniffer

Created on 11 July 2023, over 1 year ago
Updated 30 July 2024, 5 months ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/mtcaptcha.module
-------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 131 ERRORS AND 13 WARNINGS AFFECTING 105 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
   1 | ERROR   | [x] Missing file doc comment
   3 | WARNING | [x] Unused use statement
   3 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
   4 | WARNING | [x] Unused use statement
   6 | WARNING | [x] Unused use statement
   7 | WARNING | [x] Unused use statement
  10 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
  11 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
  20 | ERROR   | [x] Whitespace found at end of line
  28 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
  29 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
  32 | ERROR   | [x] Short array syntax must be used to define arrays
  33 | ERROR   | [x] Short array syntax must be used to define arrays
  34 | ERROR   | [x] Short array syntax must be used to define arrays
  43 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
  44 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
  47 | ERROR   | [x] Short array syntax must be used to define arrays
  51 | ERROR   | [x] Short array syntax must be used to define arrays
  52 | ERROR   | [x] Short array syntax must be used to define arrays
  62 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
  65 | ERROR   | [x] Short array syntax must be used to define arrays
  66 | ERROR   | [x] Short array syntax must be used to define arrays
  74 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
  75 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
  82 | ERROR   | [x] Short array syntax must be used to define arrays
  85 | ERROR   | [x] Short array syntax must be used to define arrays
  86 | ERROR   | [x] Whitespace found at end of line
  87 | ERROR   | [x] Whitespace found at end of line
  88 | ERROR   | [x] Whitespace found at end of line
  90 | ERROR   | [x] Whitespace found at end of line
  92 | ERROR   | [x] Line indented incorrectly; expected 8 spaces, found 11
  92 | ERROR   | [x] Expected 1 space after "="; 2 found
  99 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  99 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
 100 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 100 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 101 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 102 | ERROR   | [ ] All functions defined in a module file must be prefixed with the module's name, found "mtcapcha_render" but expected
     |         |     "mtcaptcha_mtcapcha_render"
 107 | ERROR   | [x] Whitespace found at end of line
 110 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 111 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 112 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 112 | ERROR   | [x] Short array syntax must be used to define arrays
 116 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 117 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 117 | ERROR   | [x] Whitespace found at end of line
 118 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 119 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 6
 119 | ERROR   | [x] Short array syntax must be used to define arrays
 120 | WARNING | [x] A comma should follow the last multiline array item. Found: $markup
 122 | ERROR   | [x] Whitespace found at end of line
 124 | ERROR   | [x] Expected 1 space before ":"; 0 found
 128 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 129 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 129 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 129 | ERROR   | [ ] Missing parameter comment
 129 | ERROR   | [ ] Missing parameter name
 130 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 134 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 135 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 135 | ERROR   | [x] Expected 1 space after "="; 2 found
 136 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 136 | ERROR   | [x] Expected 1 space after "="; 2 found
 148 | WARNING | [x] A comma should follow the last multiline array item. Found: 'mtcaptcha-custom-config'
 149 | ERROR   | [x] Whitespace found at end of line
 150 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 150 | ERROR   | [x] Whitespace found at end of line
 151 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 1
 151 | ERROR   | [x] Closing brace indented incorrectly; expected 2 spaces, found 1
 151 | ERROR   | [x] Expected newline after closing brace
 151 | ERROR   | [x] Whitespace found at end of line
 152 | ERROR   | [x] Short array syntax must be used to define arrays
 154 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 154 | ERROR   | [x] Whitespace found at end of line
 161 | ERROR   | [x] Whitespace found at end of line
 163 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 1
 167 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 167 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         |     hook_foo_BAR_ID_bar() for block templates."
 168 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 168 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 169 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
 170 | ERROR   | [x] Whitespace found at end of line
 171 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 173 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 174 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 174 | ERROR   | [x] Closing brace indented incorrectly; expected 2 spaces, found 3
 178 | ERROR   | [x] Expected 1 space(s) before asterisk; 2 found
 178 | ERROR   | [x] Doc comment short description must end with a full stop
 179 | ERROR   | [x] Expected 1 space(s) before asterisk; 2 found
 179 | ERROR   | [x] There must be exactly one blank line before the tags in a doc comment
 179 | ERROR   | [ ] Missing parameter comment
 179 | ERROR   | [ ] Missing parameter name
 180 | ERROR   | [x] Expected 1 space(s) before asterisk; 2 found
 180 | ERROR   | [ ] Missing parameter comment
 180 | ERROR   | [ ] Missing parameter name
 181 | ERROR   | [x] Whitespace found at end of line
 182 | ERROR   | [x] Whitespace found at end of line
 184 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
 185 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
 186 | ERROR   | [x] Equals sign not aligned with surrounding assignments; expected 1 space but found 2 spaces
 187 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 190 | ERROR   | [x] Expected one space after the comma, 0 found
 191 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 192 | ERROR   | [x] Expected newline after closing brace
 192 | ERROR   | [x] Use "elseif" in place of "else if"
 192 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 192 | ERROR   | [x] There should be no white space before a closing ")"
 194 | ERROR   | [x] Whitespace found at end of line
 196 | ERROR   | [x] Whitespace found at end of line
 197 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 199 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 205 | ERROR   | [x] Multi-line function declarations must define one parameter per line
 205 | ERROR   | [x] Whitespace found at end of line
 206 | ERROR   | [x] Multi-line function declarations must define one parameter per line
 206 | ERROR   | [x] Whitespace found at end of line
 207 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 208 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 209 | ERROR   | [ ] The $_POST super global must not be accessed directly; inject the request_stack service and use
     |         |     $stack->getCurrentRequest()->request->get('mtcaptcha-verifiedtoken') instead
 209 | ERROR   | [x] Whitespace found at end of line
 214 | ERROR   | [x] Whitespace found at end of line
 217 | ERROR   | [x] Whitespace found at end of line
 218 | ERROR   | [x] Whitespace found at end of line
 219 | ERROR   | [ ] The $_POST super global must not be accessed directly; inject the request_stack service and use
     |         |     $stack->getCurrentRequest()->request->get('mtcaptcha-verifiedtoken') instead
 219 | ERROR   | [x] Whitespace found at end of line
 226 | ERROR   | [x] Short array syntax must be used to define arrays
 231 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 236 | ERROR   | [x] Expected 1 space before "=>"; 0 found
 243 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 244 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 7
 244 | ERROR   | [x] Expected one space after the comma, 0 found
 245 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 7
 245 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 246 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 7
 250 | ERROR   | [x] Expected 1 blank line after function; 2 found
 253 | ERROR   | [x] Missing function doc comment
 254 | ERROR   | [x] Whitespace found at end of line
 256 | ERROR   | [x] Short array syntax must be used to define arrays
 256 | ERROR   | [x] Short array syntax must be used to define arrays
 256 | ERROR   | [x] There should be no white space before a closing ")"
 257 | ERROR   | [x] Whitespace found at end of line
 268 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 5
 271 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 271 | ERROR   | [x] A closing tag is not permitted at the end of a PHP file
-------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 126 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/mtcaptcha.links.menu.yml
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/config/schema/mtcaptcha.schema.yml
-----------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 31 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/config/install/mtcaptcha.settings.yml
--------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------
 8 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/src/Admin/MTCaptchaSettings.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 32 ERRORS AND 20 WARNINGS AFFECTING 35 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   7 | WARNING | [x] Unused use statement
  14 | ERROR   | [x] Scope keyword "private" must be followed by a single space; found 2
  14 | ERROR   | [ ] Missing member variable doc comment
  16 | ERROR   | [x] Missing function doc comment
  17 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  19 | ERROR   | [x] Whitespace found at end of line
  39 | ERROR   | [x] Whitespace found at end of line
  43 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
  43 | ERROR   | [x] Whitespace found at end of line
  52 | ERROR   | [x] Whitespace found at end of line
  56 | WARNING | [ ] Do not pass empty strings to t()
  60 | WARNING | [x] A comma should follow the last multiline array item. Found: 'textfield'
  60 | ERROR   | [x] Whitespace found at end of line
  65 | WARNING | [ ] Do not pass empty strings to t()
  69 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
  71 | WARNING | [x] A comma should follow the last multiline array item. Found: 'select'
  73 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines
  78 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
  78 | ERROR   | [x] Whitespace found at end of line
  86 | ERROR   | [x] Whitespace found at end of line
  90 | WARNING | [ ] Do not pass empty strings to t()
  94 | WARNING | [x] A comma should follow the last multiline array item. Found: 'textfield'
 111 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 113 | WARNING | [x] A comma should follow the last multiline array item. Found: 'select'
 113 | ERROR   | [x] Whitespace found at end of line
 183 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 183 | ERROR   | [x] There should be no white space before a closing "]"
 183 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 185 | WARNING | [x] A comma should follow the last multiline array item. Found: 'select'
 186 | ERROR   | [x] Whitespace found at end of line
 194 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 196 | WARNING | [x] A comma should follow the last multiline array item. Found: 'select'
 202 | WARNING | [x] A comma should follow the last multiline array item. Found: TRUE
 202 | ERROR   | [x] Whitespace found at end of line
 206 | ERROR   | [x] Expected 1 space after "=>"; 2 found
 206 | WARNING | [ ] Translatable strings must not begin or end with white spaces, use placeholders with t() for variables
 209 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 225 | ERROR   | [x] Short array syntax must be used to define arrays
 226 | ERROR   | [x] Array indentation error, expected 8 spaces but found 12
 226 | ERROR   | [x] Short array syntax must be used to define arrays
 226 | ERROR   | [x] Whitespace found at end of line
 227 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 227 | ERROR   | [x] Whitespace found at end of line
 234 | ERROR   | [x] Short array syntax must be used to define arrays
 234 | ERROR   | [x] The first index in a multi-value array must be on a new line
 234 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 253 | WARNING | [x] A comma should follow the last multiline array item. Found: )
 253 | ERROR   | [x] Closing parenthesis of array declaration must be on a new line
 253 | ERROR   | [x] Whitespace found at end of line
 272 | ERROR   | [x] Whitespace found at end of line
 277 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 277 | ERROR   | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 44 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/mtcaptcha.libraries.yml
------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------
 37 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/css/mtcaptcha-admin.css
------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------
 2 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 5 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/mtcaptcha/mtcaptcha.routing.yml
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
 7 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------

Time: 118ms; Memory: 12MB

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Needs work

Version

1.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

Comments & Activities

  • Issue created by @roshni27
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India roshni27

    Some issues which are better know to maintainer are pending and all remaining issues solve by me. Please review the patch.

  • šŸ‡®šŸ‡³India ashutosh ahirwal India

    Patch provided in #2 get applied cleanly but still there are so many error found

    Providing updated patch with fixes

    Used command with arguments:-
    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/mtcaptcha

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/mtcaptcha/js/mtcaptcha-common.js
    ---------------------------------------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 8 LINES
    ---------------------------------------------------------------------------------------------------------
    1 | ERROR | [x] Additional whitespace found at start of file
    4 | ERROR | [x] Whitespace found at end of line
    7 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    8 | ERROR | [x] Whitespace found at end of line
    12 | ERROR | [x] Whitespace found at end of line
    14 | ERROR | [x] Whitespace found at end of line
    18 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
    18 | ERROR | [x] Expected 1 space before opening brace; found 0
    18 | ERROR | [x] Expected 1 newline at end of file; 2 found
    19 | ERROR | [x] Additional whitespace found at end of file
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/mtcaptcha/js/mtcaptcha-admin.js
    --------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    --------------------------------------------------------------------------------------------------------
    1 | ERROR | [x] Additional whitespace found at start of file
    2 | ERROR | [x] Whitespace found at end of line
    11 | ERROR | [x] Whitespace found at end of line
    31 | ERROR | [x] Expected 1 newline at end of file; 0 found
    --------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/mtcaptcha/js/mtcaptcha.js
    --------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------
    3 | ERROR | [x] Whitespace found at end of line
    --------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/mtcaptcha/mtcaptcha.module
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 12 ERRORS AFFECTING 10 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    107 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
    109 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found "mtcapcha_render" but expected "mtcaptcha_mtcapcha_render"
    137 | ERROR | [ ] Missing parameter name
    138 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
    157 | ERROR | [x] Array indentation error, expected 6 spaces but found 7
    178 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
    190 | ERROR | [ ] Missing parameter comment
    190 | ERROR | [ ] Missing parameter name
    191 | ERROR | [ ] Missing parameter comment
    191 | ERROR | [ ] Missing parameter name
    223 | ERROR | [ ] The $_POST super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->request->get('mtcaptcha-verifiedtoken') instead
    233 | ERROR | [ ] The $_POST super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->request->get('mtcaptcha-verifiedtoken') instead
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Time: 331ms; Memory: 12MB

  • Status changed to Needs work 5 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @Ashutosh Ahirwal,

    I applied your patch but encountered an error.

    āžœ  mtcaptcha git:(8.x-1.0) āœ— curl https://www.drupal.org/files/issues/2024-01-25/phpcs-issue-fixes.patch | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 27023  100 27023    0     0   144k      0 --:--:-- --:--:-- --:--:--  144k
    <stdin>:732: trailing whitespace.
          '#description' => $this->t('Provides the custom configuration to render the
    Checking patch config/install/mtcaptcha.settings.yml...
    error: while searching for:
    widgetsize: 'standard'
    enablecaptcha: 'all'
    custom_config_enable: false
    custom_config_setting: ''
    error: patch failed: config/install/mtcaptcha.settings.yml:5
    error: config/install/mtcaptcha.settings.yml: patch does not apply
    Checking patch config/schema/mtcaptcha.schema.yml...
    error: while searching for:
        widgetsize:
          type: string
          label: 'Captcha Widget Size'
    
    error: patch failed: config/schema/mtcaptcha.schema.yml:28
    error: config/schema/mtcaptcha.schema.yml: patch does not apply
    Checking patch css/mtcaptcha-admin.css...
    error: css/mtcaptcha-admin.css: No such file or directory
    Checking patch js/mtcaptcha-admin.js...
    error: js/mtcaptcha-admin.js: No such file or directory
    Checking patch js/mtcaptcha-common.js...
    error: js/mtcaptcha-common.js: No such file or directory
    Checking patch js/mtcaptcha.js...
    error: while searching for:
    (function ($, Drupal, drupalSettings) {
        if(!mtcaptchaConfig){
            var mtcaptchaConfig;
            if (typeof drupalSettings.config != "undefined") {
                mtcaptchaConfig = JSON.parse(drupalSettings.config)
           }
    
    error: patch failed: js/mtcaptcha.js:1
    error: js/mtcaptcha.js: patch does not apply
    Checking patch mtcaptcha.libraries.yml...
    Hunk #1 succeeded at 7 (offset -27 lines).
    Checking patch mtcaptcha.links.menu.yml...
    Checking patch mtcaptcha.module...
    error: while searching for:
    <?php
    use Drupal\Core\Render\Markup;
    use Drupal\Component\Utility\Html;
    use Drupal\Core\Form\FormInterface;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\Url;
    use Drupal\Core\Template\Attribute;
    
    /**
     * Implements hook_help().
     * @see hook_help()
     */
    function mtcaptcha_help($path, $arg) {
    
    error: patch failed: mtcaptcha.module:1
    error: mtcaptcha.module: patch does not apply
    Checking patch mtcaptcha.routing.yml...
    Checking patch src/Admin/MTCaptchaSettings.php...
    error: while searching for:
    
    namespace Drupal\mtcaptcha\Admin;
    
    use Drupal\Core\Form\ConfigFormBase;
    use Drupal\Core\Form\FormStateInterface;
    use Drupal\Core\Url;
    
    /**
     * Configure mtcaptcha settings for this site.
     */
    class MTCaptchaSettings extends ConfigFormBase {
    
      private  $config;
    
      public function __construct() {
        $this->config = \Drupal::config('mtcaptcha.settings');
      }
    
      /**
       * {@inheritdoc}
       */
    
    error: patch failed: src/Admin/MTCaptchaSettings.php:2
    error: src/Admin/MTCaptchaSettings.php: patch does not apply
    āžœ  mtcaptcha git:(8.x-1.0) āœ—

    Please check and advise.
    Thank you.

Production build 0.71.5 2024