PHPCS issues in 2.0.x

Created on 7 July 2023, over 1 year ago
Updated 10 July 2024, 5 months ago

Problem/Motivation

C:\xampp\htdocs\backendassignment\web\modules\contrib>phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig taxonomy_machine_name

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_machine_name\modules\search_api_taxonomy_machine_name\search_api_taxonomy_machine_name.module
------------------------------------------------------------------------------------------------------------------------------------------------------------------
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\taxonomy_machine_name\modules\search_api_taxonomy_machine_name\search_api_taxonomy_machine_name.views.inc
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
21 | WARNING | [ ] Unused variable $field_alias.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_machine_name\modules\search_api_taxonomy_machine_name\src\Plugin\search_api\processor\AddHierarchy.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\taxonomy_machine_name\modules\search_api_taxonomy_machine_name\src\Plugin\views\filter\SearchApiTaxonomyMachineName.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
77 | WARNING | [ ] Line exceeds 80 characters; contains 111 characters
204 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_machine_name\src\Plugin\migrate\source\d7\TaxonomyMachineNameTerm.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\taxonomy_machine_name\src\Plugin\views\argument_validator\TermMachineName.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
74 | WARNING | [ ] Unused variable $operator.
78 | WARNING | [ ] Unused variable $operator.
-----------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_machine_name\src\Plugin\views\filter\TaxonomyIndexMachineName.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"
279 | WARNING | [ ] t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\taxonomy_machine_name\taxonomy_machine_name.api.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\taxonomy_machine_name\taxonomy_machine_name.deploy.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\taxonomy_machine_name\taxonomy_machine_name.install
---------------------------------------------------------------------------------------------------------------
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\taxonomy_machine_name\taxonomy_machine_name.module
--------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
15 | WARNING | [x] Unused use statement
41 | ERROR | [x] Expected 1 space after IF keyword; 0 found
46 | ERROR | [x] Expected 1 space after closing parenthesis; found 0
47 | ERROR | [x] Namespaced classes/interfaces/traits should be referenced with use statements
80 | WARNING | [ ] Line exceeds 80 characters; contains 100 characters
--------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

RTBC

Version

2.0

Component

Other

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 !10Fixed phpcs issues. ā†’ (Open) created by sidharth_soman
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India sidharth_soman Bangalore

    All issues fixed except for unused variables and warnings involving lines exceeding 80 characters. I'm leaving that up to the discretion of the maintainers.

    Please review the MR made against the 2.0.x branch.

  • Status changed to Needs work 7 months ago
  • Hi,

    Applied MR!10 #2 against the 2.0.x branch, confirmed remaining issues are unused variables and lines exceeding 80 characters.

    taxonomy_machine_name git:(2.0.x) curl https://git.drupalcode.org/project/taxonomy_machine_name/-/merge_requests/10.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4275    0  4275    0     0  10773      0 --:--:-- --:--:-- --:--:-- 10989
    patching file modules/search_api_taxonomy_machine_name/src/Plugin/views/filter/SearchApiTaxonomyMachineName.php
    patching file src/Plugin/views/filter/TaxonomyIndexMachineName.php
    patching file taxonomy_machine_name.module
    āžœ  taxonomy_machine_name git:(2.0.x) āœ— cd ..
    āžœ  contrib git:(main) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig taxonomy_machine_name
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/taxonomy_machine_name/taxonomy_machine_name.module
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------
     80 | WARNING | Line exceeds 80 characters; contains 100 characters
    ---------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/taxonomy_machine_name/modules/search_api_taxonomy_machine_name/search_api_taxonomy_machine_name.views.inc
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     21 | WARNING | Unused variable $field_alias.
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...etInterns/Demo-site/drupal-orgissue/web/modules/contrib/taxonomy_machine_name/modules/search_api_taxonomy_machine_name/src/Plugin/views/filter/SearchApiTaxonomyMachineName.php
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     79 | WARNING | Line exceeds 80 characters; contains 111 characters
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/taxonomy_machine_name/src/Plugin/views/argument_validator/TermMachineName.php
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------------
     74 | WARNING | Unused variable $operator.
     78 | WARNING | Unused variable $operator.
    ------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue/web/modules/contrib/taxonomy_machine_name/src/Plugin/views/filter/TaxonomyIndexMachineName.php
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------------------------------------------
     12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\views\Plugin\views\display\DisplayPluginBase.
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 669ms; Memory: 12MB

    Thank you.

  • First commit to issue fork.
  • Status changed to Needs review 7 months ago
  • šŸ‡®šŸ‡³India atul_ghate

    Added a merge request (MR) to fix PHPCS issues, but one still remains. See the image below.

  • Status changed to Needs work 5 months ago
  • šŸ‡®šŸ‡³India kalash-j jaipur

    @atul_ghate I have reviewed MR!10, there is only 1 phpcs error in the issue , as you already mentioned .
    what we can do here is , comment that line , if the maintainer required that variable later they can uncomment it and can use it .

  • Status changed to Needs review 5 months ago
  • šŸ‡®šŸ‡³India atul_ghate

    Hello @kalash-j, i have made the suggested change please review.

  • šŸ‡®šŸ‡³India kalash-j jaipur

    hello @atul_ghate i have reviewd your MR and there is no error present in it
    RTBC +1

  • Status changed to RTBC 5 months ago
  • šŸ‡®šŸ‡³India kalash-j jaipur
Production build 0.71.5 2024