Fix the issues reported by phpcs

Created on 9 March 2023, almost 2 years ago
Updated 15 May 2023, over 1 year ago

Problem/Motivation

Resolve the PHP Coding standard issue.

FILE: /var/www/html/web/modules/custom/menus_attribute/menus_attribute.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
 75 | WARNING | #options values usually have to run through t() for translation
 76 | WARNING | #options values usually have to run through t() for translation
 77 | WARNING | #options values usually have to run through t() for translation
 78 | WARNING | #options values usually have to run through t() for translation
 79 | WARNING | #options values usually have to run through t() for translation
--------------------------------------------------------------------------------


FILE: /var/www/html/web/modules/custom/menus_attribute/menus_attribute.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: /var/www/html/web/modules/custom/menus_attribute/src/StorageHelper.php
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
 12 | ERROR | Missing member variable doc comment
----------------------------------------------------------------------------

Steps to reproduce

Run the Code sniffer

Run the phpcs --standard="DrupalPractice,DrupalStandard" menus_attribute

Proposed resolution

Resolve the PHPCS issues.

Remaining tasks

Testing

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India arunkumark Coimbatore

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 @arunkumark
  • @arunkumark opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India kkalashnikov Ghaziabad, India

    PHPCS issues are resolved in MR of #2.

  • Status changed to RTBC almost 2 years ago
  • 🇮🇳India Adil_Siddiqui

    MR reviewed and it is. working fine...Marking as RTBC.

  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +        '' => t('None(ie.same window)'),
    +        '_blank' => t('New window (_blank)'),
    +        '_top' => t('Top window (_top)'),
    +        '_self' => t('Same window (_self)'),
    

    Since those lines are changed, a space is missing before the opening parenthesis. ie.same is not the correct spelling, and i.e. would not even be necessary.

    +  /**
    +   * Drupal\Core\Database\Database definition.
    +   *
    +   * @var Drupal\Core\Database\Database
    +   */
       public $db;

    That is not the comment used for properties. The namespace includes the \ at the beginning.

  • @kkalashnikov opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India kkalashnikov Ghaziabad, India
  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +        '' => t('None(ie.same window)'),
    +        '_blank' => t('New window(_blank)'),
    

    See my previous comment.

    +  /**
    +   * Database definition.
    +   *
    +   * @var Drupal\Core\Database\Database
    +   */

    The description is missing an article. Also, the usual description for that property does not say it is a definition.

  • 🇮🇳India kkalashnikov Ghaziabad, India

    Hello @apaderno thanks for reviewing.

    Done all the changes you have mentioned in the comment.
    Please review and let me know if anything is missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +        '' => t('None(i.e.same window)'),
    +        '_blank' => t('New window(_blank)'),
    +        '_top' => t('Top window(_top)'),
    +        '_self' => t('Same window(_self)'),
    +        '_parent' => t('Parent window(_parent)'),

    A space is missing before the opening parenthesis in the translated strings, in all those lines. Remove i.e. which is not necessary.

  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India arunkumark Coimbatore

    Updated the MR 8!

  • Status changed to Needs work almost 2 years ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +  /**
    +   * Database Service Object.
    +   *
    +   * @var \Drupal\Core\Database\Database
    +   */
       public $db;

    The comment on the previous commit was better, although an article was missing. This comment still misses an article, it uses Object when it is not necessary, and wrongly capitalizes the words that are not at the beginning of the phrase.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India kkalashnikov Ghaziabad, India
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    +        '' => t('None (i.e.same window)'),
    +        '_blank' => t('New window (_blank)'),
    +        '_top' => t('Top window (_top)'),
    +        '_self' => t('Same window (_self)'),
    +        '_parent' => t('Parent window (_parent)'),

    I have already commented on these change on comment #5; on comment #8 also said the changes reported on comment #5 were not done. There is still a line that has not been correctly changed.

    +  /**
    +   * The Database service.
    +   *
    +   * @var \Drupal\Core\Database\Database
    +   */
       public $db;

    Words that are not at the beginning of a sentence are not written capitalized, if they are not acronyms nor proper nouns. Database is neither a proper noun nor an acronym.

  • 🇩🇪Germany Anybody Porta Westfalica

    @kkalashnikov are you planning to work on this again?

  • Status changed to Fixed over 1 year ago
  • 🇺🇸United States themodularlab

    This has been merged into the dev branch. It will be included in the next release. Thanks for everyone's help.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024