Fix the issues reported by phpcs

Created on 23 March 2023, over 1 year ago
Updated 25 March 2023, over 1 year ago

Problem/Motivation

Getting following warnings.

FILE: /var/www/html/modules/contrib/ptoc/ptoc.info.yml
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 13 WARNINGS AFFECTING 13 LINES
-----------------------------------------------------------------------------------------------
8 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
9 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
10 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
11 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
12 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
13 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
14 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
15 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
16 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
17 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
18 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
19 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
20 | WARNING | All dependencies must be prefixed with the project name, for example "drupal:"
-----------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/ptoc/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
54 | WARNING | Line exceeds 80 characters; contains 81 characters
----------------------------------------------------------------------

Time: 3.98 secs; Memory: 6MB

Steps to reproduce

Run following command

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

Proposed resolution

Above warnings need to be fixed.

📌 Task
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India samit.310@gmail.com

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

    Above warnings has been fixed.

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India Adil_Siddiqui

    Patch applied successfully and solved the issues specified...Marking as RTBC

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +  - drupal:block
    +  - drupal:entity_reference_revisions
    +  - drupal:field
    +  - drupal:file
    +  - drupal:image
    +  - drupal:link
    +  - drupal:menu_ui
    +  - drupal:node
    +  - drupal:paragraphs
    +  - drupal:path
    +  - drupal:text
    +  - drupal:user
    +  - drupal:views
     

    phpcs does not say the dependencies must start with drupal:, but that the dependencies must be namespaced. The change is not using the correct namespaces for some of those modules.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India samit.310@gmail.com

    Hi @apaderno,

    Patch updated.

    interdiff with #2 📌 Fix the issues reported by phpcs Needs review

  • Status changed to RTBC over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The last patch applies all the suggested changes.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States benjifisher Boston area

    @apaderno: Thanks for providing guidance on this issue and +1 for changing the priority to Minor.

    Reviewing the comments, I do not see any mention of testing (the "T" in RTBC). I am setting the status back to NR.

    Looking at the patch, I wondered why there were so many dependencies. I think the answer is that I used the Features module to generate the first draft of this module. (I split it up into several commits because I believe in having atomic commits.)

    That made me wonder whether the list is complete, so I tested with an installation using the Minimal profile. I got an error message when visiting the config page, /admin/structure/paragraphs_type/ptoc. I fixed it by enabling the field_ui module. I considered adding that as a dependency, but some sites do not enable field_ui nor views_ui on production, so that is not a good idea.

    Following up on Comment #4: drupal: is used for core modules. For most contrib modules, the namespace is the package name on d.o. For example, if this module required the Paragraphs Type Permissions submodule from the Paragraphs module, the dependency would be paragraphs:paragraphs_type_permissions.

    Reference: Let Drupal know about your module with an .info.yml file .

  • 🇺🇸United States benjifisher Boston area

    I added 🐛 WSOD on config page if field_ui is not enabled Active to deal with the WSOD I mentioned in #7.

Production build 0.71.5 2024