Fix the errors/warnings reported by Php_CodeSniffer

Created on 5 July 2023, 12 months ago
Updated 14 February 2024, 4 months ago

Problem/Motivation

Phpcs finds the following errors:

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig gdpr_compliance
FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Controller\PagePolicy.php
---------------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
---------------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 19 | ERROR | [ ] Missing member variable doc comment
 20 | ERROR | [ ] Missing member variable doc comment
 21 | ERROR | [ ] Missing member variable doc comment
 22 | ERROR | [ ] Missing member variable doc comment
 23 | ERROR | [ ] Missing member variable doc comment
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Form\SettingsFormWarning.php
------------------------------------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 9 LINES
------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  18 | ERROR   | [ ] Missing member variable doc comment
  19 | ERROR   | [ ] Missing member variable doc comment
  20 | ERROR   | [ ] Missing member variable doc comment
  21 | ERROR   | [ ] Missing member variable doc comment
  35 | ERROR   | [ ] Parameter $entityTypeBundle is not described in comment
  44 | ERROR   | [ ] Doc comment for parameter $entityTypeManager does not match actual variable name $entityTypeBundle
 134 | WARNING | [ ] #options values usually have to run through t() for translation
 136 | WARNING | [ ] #options values usually have to run through t() for translation
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Form\SettingsPopup.php
------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\FormContactMessageFormAlter.php
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\FormNodeFormAlter.php
----------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\FormUserLoginFormAlter.php
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\FormUserRegisterFormAlter.php
------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\FormWebformSubmissionFormAlter.php
-----------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
-----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Hook\PageBottom.php
---------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 23 | ERROR | [x] list(...) is forbidden, use [...] instead.
---------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------


FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\gdpr_compliance\src\Utility\FormWarning.php
---------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 13 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

Time: 2.14 secs; Memory: 6MB

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

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 @sidharth_soman
  • Merge request !3Fixed the phpcs issues. โ†’ (Open) created by sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

    All issues fixed. Please review the MR.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Hi have reviewed the MR its resolving the issue but still there are some errors found.
    Moving to need work.

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

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/gdpr_compliance/gdpr_compliance.module
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\gdpr_compliance\Hook\FormNodeFormAlter.
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/gdpr_compliance/assets/gulpfile.js
    -----------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------
    14 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
    -----------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/gdpr_compliance/src/Form/SettingsFormWarning.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Entity\EntityTypeBundleInfo.
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/gdpr_compliance/src/Controller/PagePolicy.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
    12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Symfony\Component\HttpFoundation\Request.
    -----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------

    Time: 264ms; Memory: 12MB

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mohd Sahzad

    Mohd Sahzad โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mohd Sahzad

    Hi @Ashutosh Ahirwal,

    i have fixed phpcs issue uisng this ./vendor/bin/phpcs --standard=Drupal,DrupalPractice extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/gdpr_compliance

  • Status changed to RTBC 4 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi

    I applied MR !3 after commit #5 and I confirmed that there are no PHPCS issues in the module.

    โžœ  gdpr_compliance git:(8.x-1.22) curl https://git.drupalcode.org/project/gdpr_compliance/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6483    0  6483    0     0  10805      0 --:--:-- --:--:-- --:--:-- 10951
    patching file 'assets/gulpfile.js'
    patching file gdpr_compliance.module
    patching file 'src/Controller/PagePolicy.php'
    patching file 'src/Form/SettingsFormWarning.php'
    patching file 'src/Hook/PageBottom.php'
    patching file 'src/Utility/FormWarning.php'
    โžœ  gdpr_compliance git:(8.x-1.22) โœ— ..
    โžœ  contrib git:(master) โœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml gdpr_compliance 
    โžœ  contrib git:(master) โœ— 
    
    
    
Production build 0.69.0 2024