Fix the warnings/errors reported by PHP_CodeSniffer

Created on 20 June 2023, over 1 year ago
Updated 21 August 2024, 3 months ago
šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India arti_parmar

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 @arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India arti_parmar

    Kindly review patch.

  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India Anmol_Specbee

    The patch is applying cleanly and issues mentioned are getting resolved by it. Moving it to RTBC.

  • šŸ‡®šŸ‡³India yashaswini Bangalore

    Let me check on it.

  • šŸ‡®šŸ‡³India yashaswini Bangalore
  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    +2. Place the module directory in the "modules" folder of your Drupal 
    +installation.
    -7. The custom links will be associated with the corresponding user roles and used when rendering the menu.
    +7. The custom links will be associated with the corresponding user roles
    +and used when rendering the menu.
    +- The "menu_link_by_role_form_alter" function alters the menu link content form
    +and adds custom link fields for each role.

    Since that text is part of a list, the second line must be indented.

    +This module is licensed under the [GNU General Public License version 2
    +or later](https://www.gnu.org/licenses/gpl-2.0.html).

    A link markup cannot be split in two lines.

  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India

    Addressed #6. Updated patch.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India Anmol_Specbee

    Patch seems to be applying cleanly, moving to RTBC.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    -        // Fetch the stored custom link and set as the default value if it exists.
    +        // Fetch the stored custom link and set as the default
    +        // value if it exists.

    Since that comment is changed, and set as needs to be corrected (and set it as).

     /**
    - *
    + * Form submission handler for menu_link_by_role form.
      */

    A definite article is missing before menu_link_by_role.

  • Assigned to nitin_lama
  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India Harshita mehra

    Hello arti_parmar,
    Your patch #2 is working fine.

  • Issue was unassigned.
  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India

    Addressed #11.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
     /**
    - *
    + * Implements hook_link_by_role_load_custom_link().
      */
    -function menu_link_by_role_loadCustomLink($menu_link_plugin_id, $user_role) {

    Looking at the module code, I gather that is not a hook implementation; otherwise, it would not be called directly.

    -      // Assume loadCustomLink is a function that fetches the custom links based on the menu link and role.
    -      $custom_link = menu_link_by_role_loadCustomLink($item['original_link']->getPluginId(), $user_role);
    +      // Assume loadCustomLink is a function that fetches the custom links
    +      // based on the menu link and role.
    +      $custom_link = menu_link_by_role_load_custom_link($item['original_link']->getPluginId(), $user_role);

    I would rather remove that comment, simply because it does not make sense. Assume loadCustomLink is a function is referring to a function this very module implements. There is no need to assume that function exists: The module knows it exists.

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

    Changes suggested in #19 have been fixed in this patch.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
     /**
    - *
    + * Function fetches the custom links based on the menu link and role.
      */
    -function menu_link_by_role_loadCustomLink($menu_link_plugin_id, $user_role) {
    +function menu_link_by_role_load_custom_link($menu_link_plugin_id, $user_role) {

    Without Function at the beginning, that description would be fine.
    The parameter and the return value descriptions are missing.

    For the rest, the patch would be good to go.

  • First commit to issue fork.
  • Assigned to Neha-Verma
  • šŸ‡®šŸ‡³India Neha-Verma

    I am working on it.

  • Issue was unassigned.
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India bharath-kondeti Hyderabad

    Updated the MR with fixes commit and addressed #21. Please review

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Status changed to Needs work 3 months ago
  • Hi @bharath-kondeti,

    Applied the changes you committed on MR!4 and these are the reported errors. Please see below:

    āžœ  menu_link_by_role git:(1.0.x) curl https://git.drupalcode.org/project/menu_link_by_role/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6574    0  6574    0     0  17814      0 --:--:-- --:--:-- --:--:-- 18261
    patching file README.txt
    patching file menu_link_by_role.module
    āžœ  menu_link_by_role git:(1.0.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig menu_link_by_role
    
    FILE: /Users/PrometInterns/Demo-site/drupal-orgissue-v9/web/modules/contrib/menu_link_by_role/menu_link_by_role.module
    ----------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ----------------------------------------------------------------------------------------------------------------------
     116 | ERROR | [x] Whitespace found at end of line
     121 | ERROR | [x] Whitespace found at end of line
     122 | ERROR | [x] Return type must not contain variable name "$result"
    ----------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------
    
    Time: 146ms; Memory: 10MB

    Kindly check

    Thanks,
    Jake

  • Pipeline finished with Success
    3 months ago
    Total: 135s
    #260066
  • Assigned to apaderno
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    3 months ago
    Total: 133s
    #260090
  • Pipeline finished with Success
    3 months ago
    Total: 131s
    #260098
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    avpaderno ā†’ changed the visibility of the branch 3367850-gitlab-ci-reports to hidden.

Production build 0.71.5 2024