coding standards and best practices

Created on 30 January 2023, about 2 years ago
Updated 17 February 2023, about 2 years ago

Problem/Motivation

FILE: /var/www/html/dcontri/linked_field/linked_field.module
---------------------------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 10 WARNINGS AFFECTING 18 LINES
---------------------------------------------------------------------------------------------------------------------------
  21 | WARNING | [ ] Hook implementations should not duplicate @param documentation
  23 | WARNING | [ ] Hook implementations should not duplicate @param documentation
  42 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
  51 | WARNING | [x] '@TODO: How could we get bundle for base fields?' should match the format '@todo Fix problem X here.'
  98 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 100 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 102 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 104 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 106 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 149 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 277 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 284 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 347 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 349 | WARNING | [ ] Hook implementations should not duplicate @param documentation
 366 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 367 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 368 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
 391 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/dcontri/linked_field/src/LinkedFieldManager.php
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------------------------
 194 | WARNING | [x] '@TODO: We should add support for deltas.' should match the format '@todo Fix problem X here.'
 202 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
--------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/dcontri/linked_field/src/LinkedFieldManagerInterface.php
----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------------------------------------------------------------------------------
 13 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
 55 | ERROR   | The text '@deprecated No longer used by internal code and not recommended.' does not match the standard format: @deprecated
    |         | in %deprecation-version% and is removed from %removal-version%. %extra-info%.
 55 | ERROR   | Each @deprecated tag must have a @see tag immediately following it
----------------------------------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/dcontri/linked_field/src/Form/ConfigForm.php
-----------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------------------------
 17 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
-----------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/dcontri/linked_field/linked_field.install
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 20 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------

Steps to reproduce

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

Proposed resolution

Fixing the above issues.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India akshay.singh Noida

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @akshay.singh
  • Issue was unassigned.
  • Status changed to Needs work about 2 years ago
  • 🇮🇳India akshay.singh Noida

    I have fixed the rest of the issues.

    Remaining tasks

    FILE: /var/www/html/dcontri/linked_field/src/LinkedFieldManagerInterface.php
    ----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------------
     13 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
     55 | ERROR   | The text '@deprecated No longer used by internal code and not recommended.' does not match the standard format: @deprecated
        |         | in %deprecation-version% and is removed from %removal-version%. %extra-info%.
     55 | ERROR   | Each @deprecated tag must have a @see tag immediately following it
    ----------------------------------------------------------------------------------------------------------------------------------------------
    
  • Status changed to Needs review about 2 years ago
  • 🇮🇳India ashutosh ahirwal India

    Providing Patch with all fixes.
    Thanks

  • Status changed to RTBC about 2 years ago
  • 🇮🇳India arisen Goa

    The patch applies cleanly on 8.x-1.x branch.

    Checking patch linked_field.install...
    Checking patch linked_field.module...
    Checking patch src/Form/ConfigForm.php...
    Checking patch src/LinkedFieldManager.php...
    Checking patch src/LinkedFieldManagerInterface.php...
    Applied patch linked_field.install cleanly.
    Applied patch linked_field.module cleanly.
    Applied patch src/Form/ConfigForm.php cleanly.
    Applied patch src/LinkedFieldManager.php cleanly.
    Applied patch src/LinkedFieldManagerInterface.php cleanly.

    All the Phpcs errors and warnings fixed after applying the patch.

  • Status changed to Needs work about 2 years ago
  • 🇵🇹Portugal jcnventura

    Don't really want that @deprecatd tag to be removed.

  • Status changed to RTBC about 2 years ago
  • 🇵🇹Portugal jcnventura

    I'll commit @akshay.singh's patch from #1

    • akshay.singh authored 0135c2de on 8.x-1.x
      Issue #3337494 by akshay.singh, jcnventura, arisen: coding standards and...
  • Status changed to Fixed about 2 years ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024