Fix the issues reported by phpcs

Created on 18 May 2023, over 1 year ago
Updated 25 September 2023, about 1 year ago

Problem/Motivation

FILE: ...bution/drupal10/web/modules/contrib/paragraphs_sets/src/ParagraphsSets.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
154 | ERROR | The array declaration extends to column 81 (the limit is 80).
| | The array content should be split up over multiple lines
224 | ERROR | The array declaration extends to column 88 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...ution/drupal10/web/modules/contrib/paragraphs_sets/paragraphs_sets.api.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
70 | ERROR | [x] Parameter comment must end with a full stop
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...bution/drupal10/web/modules/contrib/paragraphs_sets/paragraphs_sets.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
24 | WARNING | Global constants should not be used, move it to a class or
| | interface
306 | ERROR | The array declaration extends to column 113 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

Time: 1.52 secs; Memory: 14MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig paragraphs_sets/

Proposed resolution

Fix all the issues and warnings for Drupal and DrupalPractice coding standards

Remaining tasks

Patch review.

📌 Task
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi urvashi_vora

    I applied your coding-standard-fixes.patch and after running the PHPCS command, it displayed the errors below

    contrib git:(master) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig paragraphs_sets/

    FILE: /Users/studenttrainees/Projects/drupalorgissues/docroot/modules/contrib/paragraphs_sets/paragraphs_sets.module
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    24 | WARNING | [ ] Global constants should not be used, move it to a class or interface
    123 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    180 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    228 | ERROR | [x] Use null coalesce operator instead of ternary operator.
    574 | ERROR | [ ] All functions defined in a module file must be prefixed with the module's name, found "paragraphs_set_load" but expected "paragraphs_sets_paragraphs_set_load"
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Time: 693ms; Memory: 14MB

    Please also look at the screenshot attached for your reference

    Thanks

  • First commit to issue fork.
  • @agunjan085 opened merge request.
  • 🇮🇳India agunjan085

    Resolved PHPCS issues reported for the module & raised MR https://git.drupalcode.org/project/paragraphs_sets/-/merge_requests/8

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India arpitk

    HI @agunjan085 I reviewed the MR in #5. It seems to resolve issues however still some errors are produced that need to be addressed.

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

    FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/paragraphs_sets-3361247/paragraphs_sets.module
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    24 | WARNING | Global constants should not be used, move it to a class or interface
    574 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "paragraphs_set_load" but expected "paragraphs_sets_paragraphs_set_load"
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

  • Assigned to agunjan085
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India agunjan085

    Hi @arpitk
    I have fixed the mentioned issues in https://git.drupalcode.org/project/paragraphs_sets/-/merge_requests/8 please review again

  • Status changed to RTBC over 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi agunjan085

    I applied your updated MR !8 to my local and I confirmed that it fixes all the PHPCS issues.

    Please look at the screenshot attached for your reference

    Thank you

    • agunjan085 authored 293f3a9e on 3.0.x
      Issue #3361247 by agunjan085, urvashi_vora, clarkssquared, arpitk: Fix...
  • Status changed to Fixed about 1 year ago
  • 🇩🇪Germany stborchert

    Thanks for your help.
    I've changed some minor parts of the merge request (e.g. leaving function paragraphs_set_load() but deprecating it so other modules using it won't break).

    • 6d4da7c7 committed on 3.0.x
      Issue #3361247: fix undefined constant error
      
  • Status changed to Fixed about 1 year ago
Production build 0.71.5 2024