Fix the issues reported by phpcs

Created on 4 July 2023, over 1 year ago

Problem/Motivation

Phpcs throws errors for two files:

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\popup_message\popup_message.module
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------
  1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
 10 | WARNING | [ ] Global constants should not be used, move it to a class or interface
 11 | WARNING | [ ] Global constants should not be used, move it to a class or interface
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\popup_message\src\Form\PopupMessageSettingsForm.php
---------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 1 WARNING AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  13 | WARNING | [x] Unused use statement
  49 | ERROR   | [x] Data types in @var tags need to be fully namespaced
  56 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  58 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  60 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  62 | ERROR   | [x] Data types in @param tags need to be fully namespaced
  65 | ERROR   | [x] Additional blank lines found at end of doc comment
 355 | ERROR   | [x] Data types in @var tags need to be fully namespaced
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run the phpcs command on the module.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Needs work

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India sidharth_soman Bangalore

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sidharth_soman
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary should always describe what the issue is trying to fix and, in the case of coding standards issues, show which command and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.

  • Merge request !9Fixed phpcs issues. ā†’ (Open) created by sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India sidharth_soman Bangalore

    I have solved all the issues and issued an MR as above. Please review.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The status is also for the issue summary, which does not show the command and the arguments used to get the report quoted in the issue summary.

  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India sidharth_soman Bangalore

    Updated.

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

    Hi @sidharth_soman,

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

    These are the remaining issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml:

    āžœ  popup_message git:(2.0.2) curl https://git.drupalcode.org/project/popup_message/-/merge_requests/9.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5659    0  5659    0     0   8149      0 --:--:-- --:--:-- --:--:--  8154
    patching file popup_message.module
    patching file src/EventSubscriber/PopupMessageSubscriber.php
    patching file src/Form/PopupMessageSettingsForm.php
    patching file src/GlobalConstantsInterface.php
    āžœ  popup_message git:(2.0.2) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig popup_message
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/popup_message/src/Form/PopupMessageSettingsForm.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Html.
    ------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/popup_message/src/EventSubscriber/PopupMessageSubscriber.php
    ---------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Component\Utility\Xss.
    ---------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------
    
    Time: 290ms; Memory: 12MB
    
    āžœ  contrib

    Moreover, MR!9 is 2 commits behind the target branch.

    Thank you.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The 2.0.x branch is no longer supported.

  • Pipeline finished with Success
    13 days ago
    Total: 141s
    #383916
Production build 0.71.5 2024