Fix the issues reported by phpcs

Created on 22 February 2023, over 2 years ago

Problem/Motivation

Found these phpcs issues

FILE: /convert_bundles/convert_bundles.info.yml
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------------
 1 | WARNING | Remove "project" from the info file, it will be added by
   |         | drupal.org packaging automatically
 1 | WARNING | Remove "datestamp" from the info file, it will be added by
   |         | drupal.org packaging automatically
 1 | WARNING | Remove "version" from the info file, it will be added by
   |         | drupal.org packaging automatically
--------------------------------------------------------------------------------


FILE: /convert_bundles/convert_bundles.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 16 | WARNING | [x] 'TODO: tried to do this as suggested at
    |         |     https://www.drupal.org/node/2020549' should match the
    |         |     format '@todo Fix problem X here.'
 22 | WARNING | [x] 'TODO: a hook to utilize on entity type creation is not
    |         |     obvious.' should match the format '@todo Fix problem X
    |         |     here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /convert_bundles/src/ConvertBundles.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
  13 | WARNING | [ ] The class short comment should describe what the class
     |         |     does and not simply repeat the class name
  75 | ERROR   | [ ] The array declaration extends to column 83 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 105 | ERROR   | [ ] The array declaration extends to column 89 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 254 | WARNING | [x] 'TODO Need to get multiple values.' should match the
     |         |     format '@todo Fix problem X here.'
 261 | WARNING | [x] 'TODO date with time did not insert into date only fields'
     |         |     should match the format '@todo Fix problem X here.'
 331 | ERROR   | [ ] The array declaration extends to column 140 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /convert_bundles/src/Form/ConvertBundlesForm.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
  23 | WARNING | [ ] The class short comment should describe what the class
     |         |     does and not simply repeat the class name
 453 | ERROR   | [ ] The array declaration extends to column 84 (the limit is
     |         |     80). The array content should be split up over multiple
     |         |     lines
 481 | WARNING | [x] 'TODO - Date widgets are relative. Fix.' should match the
     |         |     format '@todo Fix problem X here.'
 539 | WARNING | [x] 'TODO - validate other steps.' should match the format
     |         |     '@todo Fix problem X here.'
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: /convert_bundles/src/Plugin/Derivative/ConvertBundlesLocalTask.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 37 | ERROR | Parameter $entity_type_bundle_info is not described in comment
--------------------------------------------------------------------------------


FILE: /convert_bundles/src/Controller/EntityController.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 83 | WARNING | \Drupal calls should be avoided in classes, use dependency
    |         | injection instead
--------------------------------------------------------------------------------


FILE: /convert_bundles/src/Routing/RouteSubscriber.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 39 | ERROR | Parameter tags must be grouped together in a doc comment
--------------------------------------------------------------------------------

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

2.0

Component

Code

Created by

🇮🇳India TanujJain-TJ

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

Merge Requests

Comments & Activities

  • Issue created by @TanujJain-TJ
  • 🇮🇳India TanujJain-TJ

    Fixed the above mentioned phpcs issues, please review.

  • Issue was unassigned.
  • Status changed to Needs review over 2 years ago
  • 🇮🇳India sahil.goyal

    Thanx @TanujJain-TJ for resolve phpcs issues, but there are some issues are errors/warning left, so applying a new patch with interdiff file.

  • Status changed to RTBC over 2 years ago
  • 🇮🇳India Ranjit1032002

    I had Reviewed the patch and it's working as expected mentioned in comment #4

  • First commit to issue fork.
  • @urvashi_vora opened merge request.
  • Status changed to Needs work over 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -  // TODO: tried to do this as suggested at https://www.drupal.org/node/2020549
    +  // @todo tried to do this as suggested at https://www.drupal.org/node/2020549
    

    What follows @todo is a sentence.

    -    _create_action($entity_type_machine_name, $entity_type->getLabel());
    +    convert_bundles_create_action($entity_type_machine_name, $entity_type->getLabel());

    While function names should be prefixed by the module machine name, starting a function name with an underscore is possible. It is usually used to mean the function should not be considered part of the public API. That is reported in the Drupal coding standards, if I recall correctly.

    /**
    - * ConvertBundles.
    + * {@inheritdoc}
      */
     class ConvertBundles {

    {@inheritdoc} is not used for class documentation comments.

    • el1_1el committed 7e04862b on 2.0.x
      Revert "Issue #3343785: Fix the issues reported by phpcs"
      
  • Igor Mashevskyi made their first commit to this issue’s fork.

  • @igor-mashevskyi opened merge request.
  • Status changed to Needs review about 2 years ago
  • 🇨🇦Canada joseph.olstad

    Great work above, however the merge request is now blocked.

    Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.

    please resolve this and I'll review and then merge.

  • Status changed to Needs work over 1 year ago
  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama India

    I've rebased and fixed the conflicts. MR is ready for review. Thanks.

  • Status changed to Needs review over 1 year ago
  • Issue was unassigned.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3343785-fix-the-issues to hidden.

  • Status changed to Needs work about 1 year ago
  • 🇵🇭Philippines paraderojether

    Hi

    I reviewed MR!18, it is applied cleanly however there are still remaining phpcs 2 errors shown below:

    convert_bundles git:(2.0.x) curl https://git.drupalcode.org/project/convert_bundles/-/merge_requests/18.diff | git apply -v
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 37895    0 37895    0     0  76538      0 --:--:-- --:--:-- --:--:-- 77336
    Checking patch convert_bundles.api.php...
    Checking patch convert_bundles.install...
    Checking patch convert_bundles.module...
    Checking patch src/Controller/EntityController.php...
    Checking patch src/ConvertBundles.php...
    Checking patch src/Form/ConvertBundlesForm.php...
    Checking patch src/Plugin/Action/ConvertBundlesActionBase.php...
    Checking patch src/Plugin/Derivative/ConvertBundlesLocalTask.php...
    Checking patch src/Routing/RouteSubscriber.php...
    Applied patch convert_bundles.api.php cleanly.
    Applied patch convert_bundles.install cleanly.
    Applied patch convert_bundles.module cleanly.
    Applied patch src/Controller/EntityController.php cleanly.
    Applied patch src/ConvertBundles.php cleanly.
    Applied patch src/Form/ConvertBundlesForm.php cleanly.
    Applied patch src/Plugin/Action/ConvertBundlesActionBase.php cleanly.
    Applied patch src/Plugin/Derivative/ConvertBundlesLocalTask.php cleanly.
    Applied patch src/Routing/RouteSubscriber.php cleanly.
    ➜  convert_bundles 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 convert_bundles
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/convert_bundles/convert_bundles.module
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Database\Database.
    -----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/d_o/drupal-issues/web/modules/contrib/convert_bundles/src/Form/ConvertBundlesForm.php
    ------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------
     14 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Routing\RouteBuilderInterface.
    ------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 375ms; Memory: 12MB

    Please check and advise.
    Thank you.

  • Status changed to Needs review about 1 year ago
  • 🇵🇭Philippines paraderojether

    I fix the remaining issues, please review.
    Thank you.

  • Status changed to Needs work about 1 year ago
  • Hi @paraderojether,

    Applied MR !18 successfully, however it still resulted one error.

    convert_bundles git:(2.0.x) curl https://git.drupalcode.org/project/convert_bundles/-/merge_requests/18.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 38131    0 38131    0     0  62794      0 --:--:-- --:--:-- --:--:-- 63657
    patching file convert_bundles.api.php
    patching file convert_bundles.install
    patching file convert_bundles.module
    patching file src/Controller/EntityController.php
    patching file src/ConvertBundles.php
    patching file src/Form/ConvertBundlesForm.php
    patching file src/Plugin/Action/ConvertBundlesActionBase.php
    patching file src/Plugin/Derivative/ConvertBundlesLocalTask.php
    patching file src/Routing/RouteSubscriber.php
    ➜  convert_bundles 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 convert_bundles
    
    FILE: ...ue/web/modules/contrib/convert_bundles/src/Controller/EntityController.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     54 | ERROR | [x] Multi-line function declarations must have a trailing comma
        |       |     after the last parameter
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
    Time: 523ms; Memory: 12MB

    Kindly check.

    Thanks,
    Jake

  • 🇵🇭Philippines paraderojether

    Hello a.aaronjake, I can't replicate the issue on my end.

  • Pipeline finished with Success
    about 1 year ago
    Total: 187s
    #185944
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs review about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Pipeline finished with Success
    about 1 year ago
    Total: 209s
    #185956
  • Status changed to RTBC 11 months ago
  • 🇮🇳India dev16.addweb

    I tested the MR !18 and it's working fine. I found no errors or warnings after applying the patch even though I have added a screenshot for the same. please check.

  • Status changed to Fixed 9 days ago
  • 🇺🇸United States el1_1el

    Merged in 3.x branch. Alpha release shortly

Production build 0.71.5 2024