Fix the warnings/errors reported by PHP_CodeSniffer

Created on 11 July 2023, over 1 year ago
Updated 30 September 2023, about 1 year ago

Problem/Motivation

FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/passwordless.module
-----------------------------------------------------------------------------------------------------------------------------------
FOUND 15 ERRORS AND 1 WARNING AFFECTING 15 LINES
-----------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] The PHP open tag must be followed by exactly one blank line
  1 | ERROR   | [x] Missing file doc comment
  4 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Block\BlockPluginInterface.
 35 | ERROR   | [x] There must be no space before the colon in a CASE statement
 36 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 46 | WARNING | [x] A comma should follow the last multiline array item. Found: FALSE
 48 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
 50 | ERROR   | [x] There must be no space before the colon in a CASE statement
 53 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
 55 | ERROR   | [x] There must be no space before the colon in a CASE statement
 60 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 63 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
 65 | ERROR   | [x] There must be no space before the colon in a CASE statement
 73 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
 82 | ERROR   | [x] There must be no space before the colon in a CASE statement
 84 | ERROR   | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 4
-----------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/passwordless.links.menu.yml
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 5 | 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/passwordless/passwordless.links.task.yml
-------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------
 4 | 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/passwordless/config/schema/passwordless.schema.yml
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 36 | 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/passwordless/src/Routing/RouteSubscriber.php
-----------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
 32 | ERROR | [x] Expected 1 newline at end of file; 0 found
 32 | 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: /home/lenovo/d7to9/web/modules/contrib/passwordless/src/Form/PasswordlessLoginForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   5 | WARNING | [x] Unused use statement
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
  36 | WARNING | [ ] Only string literals should be passed to t() where possible
 111 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 116 | ERROR   | [x] Expected 1 blank line after function; 0 found
 117 | ERROR   | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/src/Form/PasswordlessSettingsForm.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 15 WARNINGS AFFECTING 17 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\ConfigFormBase.
  35 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  36 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  42 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  43 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  49 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  50 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  56 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  57 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  64 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  65 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  65 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  71 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  72 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  78 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
  79 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 107 | ERROR   | [x] Expected 1 blank line after function; 0 found
 108 | ERROR   | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/src/Controller/PasswordlessController.php
--------------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------------------------------------------------------
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\UrlHelper.
  41 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
  51 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 8
  64 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
  90 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 102 | ERROR   | [x] Missing function doc comment
 111 | ERROR   | [x] Expected 1 blank line after function; 0 found
 112 | ERROR   | [x] The closing brace for the class must have an empty line before it
--------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/src/Controller/PasswordlessUserController.php
-----------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------
 54 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
 65 | WARNING | [ ] Unused variable $expiration_date.
 67 | ERROR   | [ ] Inline doc block comments are not allowed; use "/* Comment */" or "// Comment" instead
 94 | ERROR   | [x] Expected 1 newline at end of file; 0 found
 94 | ERROR   | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/css/passwordless.login.css
------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------
 1 | WARNING | File appears to be minified and cannot be processed
------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/passwordless.services.yml
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
 5 | 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/passwordless/README.txt
-----------------------------------------------------------------------
FOUND 1 ERROR AND 15 WARNINGS AFFECTING 16 LINES
-----------------------------------------------------------------------
  9 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 11 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 13 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 21 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
 24 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
 25 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
 27 | WARNING | [ ] Line exceeds 80 characters; contains 83 characters
 28 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 29 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
 34 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 38 | WARNING | [ ] Line exceeds 80 characters; contains 88 characters
 44 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
 54 | WARNING | [ ] Line exceeds 80 characters; contains 85 characters
 57 | WARNING | [ ] Line exceeds 80 characters; contains 90 characters
 58 | WARNING | [ ] Line exceeds 80 characters; contains 81 characters
 63 | 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/passwordless/passwordless.routing.yml
----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------
 25 | 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/passwordless/passwordless.permissions.yml
--------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------
 2 | 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/passwordless/passwordless.install
------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------
 15 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
 15 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------


FILE: /home/lenovo/d7to9/web/modules/contrib/passwordless/passwordless.config_translation.yml
---------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------
 5 | 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/passwordless/passwordless.api.php
------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
 10 | ERROR | [ ] Missing parameter comment
 11 | ERROR | [ ] Missing parameter comment
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 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 passwordless/

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: works as designed

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
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India roshni27

    Some issues which are better know to maintainer are pending, for reading purpose character limits issues remain and all remaining issues solve by me. Please review the patch.

  • Status changed to Needs work over 1 year ago
  • Hii @roshnichordiya
    I have Review your patch.

    These are the steps I followed:

    1. Took clone from git version 8.x-1.x in drupal 10.1.x

    2. Applied patch and 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/passwordless/

    3. Applied your patch and again ran phpcs command

    found errors.

    4. I created a patch and fixed some issues but still one warning is there.

    Needs Work.

  • 🇮🇳India nitin_lama India

    The warning is related to css file. We can ignore this.

  • Status changed to Closed: works as designed about 1 year ago
Production build 0.71.5 2024