Coding Standard phpcs

Created on 21 November 2022, over 2 years ago
Updated 15 February 2023, about 2 years ago

Problem/Motivation

FILE: ...ar/www/html/drupal8/web/modules/field_permissions/field_permissions.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
151 | ERROR | All functions defined in a module file must be prefixed with the
| | module's name, found
| | "field_permission_field_config_edit_form_submit" but expected
| | "field_permissions_field_permission_field_config_edit_form_submit"
--------------------------------------------------------------------------------

FILE: ...eb/modules/field_permissions/src/Controller/FieldPermissionsController.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
99 | WARNING | Unused variable $permission_type.
100 | ERROR | The array declaration extends to column 95 (the limit is 80).
| | The array content should be split up over multiple lines
119 | WARNING | Unused variable $key.
172 | ERROR | The array declaration extends to column 138 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...8/web/modules/field_permissions/src/Plugin/FieldPermissionType/Manager.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
56 | WARNING | \Drupal calls should be avoided in classes, use dependency
| | injection instead
--------------------------------------------------------------------------------

FILE: ...html/drupal8/web/modules/field_permissions/src/FieldPermissionsService.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
105 | WARNING | Unused variable $key.
122 | WARNING | Unused variable $key.
--------------------------------------------------------------------------------

FILE: .../www/html/drupal8/web/modules/field_permissions/field_permissions.info.yml
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
8 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...b/modules/field_permissions/tests/src/Unit/FieldPermissionsServiceTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
144 | ERROR | The array declaration extends to column 95 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...les/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
194 | ERROR | The array declaration extends to column 98 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...odules/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
74 | ERROR | The array declaration extends to column 98 (the limit is 80).
| | The array content should be split up over multiple lines
91 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait and
| | $this->t() instead
212 | ERROR | The array declaration extends to column 104 (the limit is 80).
| | The array content should be split up over multiple lines
238 | ERROR | The array declaration extends to column 94 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: /var/www/html/drupal8/web/modules/field_permissions/CHANGELOG.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
33 | WARNING | Line exceeds 80 characters; contains 93 characters
58 | WARNING | Line exceeds 80 characters; contains 140 characters
----------------------------------------------------------------------

šŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • šŸ‡®šŸ‡³India Akram Khan Cuttack, Odisha

    Fixed all Coding standard PHPCS issue

  • šŸ‡®šŸ‡³India Akram Khan Cuttack, Odisha
  • First commit to issue fork.
  • Assigned to vishaljd
  • Status changed to Needs work about 2 years ago
  • @vishaljd opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • Status changed to Needs work about 2 years ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The tests failed, so the correct status is Needs work.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, report which command has been used, which arguments have been used, and which report that command shown.

  • Status changed to Needs review about 2 years ago
  • šŸ‡®šŸ‡³India nikhilmahala11

    Fixed all Coding standard PHPCS issues

  • Status changed to Needs work about 2 years ago
  • šŸ‡®šŸ‡³India sagartiwari

    Hello @nikhilmahala11 tested the patch you provided, it still have few errors.

    ../vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/field_permissions

    FILE: ...tions/MAMP/htdocs/drupal_contrib/drupal-9.5-dev/web/modules/contrib/field_permissions/CHANGELOG.md
    --------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    --------------------------------------------------------------------------------------------------------
    33 | WARNING | Line exceeds 80 characters; contains 93 characters
    58 | WARNING | Line exceeds 80 characters; contains 140 characters
    --------------------------------------------------------------------------------------------------------

    FILE: ...tdocs/drupal_contrib/drupal-9.5-dev/web/modules/contrib/field_permissions/field_permissions.module
    --------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------
    145 | ERROR | All functions defined in a module file must be prefixed with the module's name, found
    | | "field_permission_field_config_edit_form_submit" but expected
    | | "field_permissions_field_permission_field_config_edit_form_submit"
    --------------------------------------------------------------------------------------------------------

    Time: 305ms; Memory: 12MB

  • Assigned to hardikpandya
  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • šŸ‡®šŸ‡³India nayana_mvr

    Verified the patch #17 on Drupal version 10.1.x and Field Permission version 8.x-1.x. The patch applied cleanly and except the following errors, all other coding standard issues are fixed.

    FILE: .../contrib/field_permissions/field_permissions.module
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
     151 | ERROR | All functions defined in a module file must be prefixed with the module's name, found "field_permission_field_config_edit_form_submit" but
         |       | expected "field_permissions_field_permission_field_config_edit_form_submit"
    --------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: .../contrib/field_permissions/src/Plugin/FieldPermissionType/Manager.php
    --------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------------------------------------
     56 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------------------------------------
    
    Time: 796ms; Memory: 12MB
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡³India pray_12

    Hi,
    Addressed the error and warning mentioned in #18.
    Please Review.
    Thankyou!!

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    about 1 year ago
    Total: 169s
    #98435
  • First commit to issue fork.
  • Pipeline finished with Success
    about 1 year ago
    Total: 170s
    #123337
  • Status changed to RTBC about 1 year ago
  • šŸ‡«šŸ‡®Finland sokru

    Fixed few remaining CS issues, since the phpcs job succeeds on CI, I set the status to RTBC.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch coding_standard to hidden.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    apaderno ā†’ changed the visibility of the branch 3322809-coding-standard-phpcs to hidden.

  • Status changed to Needs review 11 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    The MR still needs to be reviewed, even if GitLab CI says there are no PHP_CodeSniffer warnings/errors.

  • Pipeline finished with Success
    11 months ago
    Total: 233s
    #161364
  • Pipeline finished with Success
    11 months ago
    Total: 195s
    #161369
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied the updated MR !24 and I can still see PHPCS issues

    āžœ  field_permissions git:(a5aee30) curl https://git.drupalcode.org/project/field_permissions/-/merge_requests/24.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 19437    0 19437    0     0  33991      0 --:--:-- --:--:-- --:--:-- 34462
    patching file CHANGELOG.md
    patching file field_permissions.info.yml
    patching file field_permissions.module
    patching file 'src/Controller/FieldPermissionsController.php'
    patching file 'src/FieldPermissionsService.php'
    patching file 'src/Plugin/migrate/process/FieldPermissionSettings.php'
    patching file 'tests/modules/field_permissions_test/src/Plugin/FieldPermissionType/TestAccess.php'
    patching file 'tests/src/Unit/FieldPermissionsServiceTest.php'
    patching file 'tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php'
    patching file 'tests/src/Unit/Plugin/FieldPermissionType/PrivateAccessTest.php'
    āžœ  field_permissions git:(a5aee30) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml field_permissions 
    
    FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/field_permissions/CHANGELOG.md
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------
     15 | WARNING | Line exceeds 80 characters; contains 84 characters
     50 | WARNING | Line exceeds 80 characters; contains 88 characters
    -------------------------------------------------------------------------------------------------------
    
    
    FILE: ...-subing/Projects/d9/d9-local/web/modules/contrib/field_permissions/tests/src/Unit/FieldPermissionsServiceTest.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     144 | ERROR | The array declaration extends to column 95 (the limit is 80). The array content should be split up over
         |       | multiple lines
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...g/Projects/d9/d9-local/web/modules/contrib/field_permissions/tests/src/Functional/FieldPermissionsCommentTest.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     194 | ERROR | The array declaration extends to column 98 (the limit is 80). The array content should be split up over
         |       | multiple lines
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...bing/Projects/d9/d9-local/web/modules/contrib/field_permissions/tests/src/Functional/FieldPermissionsNodeTest.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
    -----------------------------------------------------------------------------------------------------------------------
      74 | ERROR   | The array declaration extends to column 98 (the limit is 80). The array content should be split up
         |         | over multiple lines
      91 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
     212 | ERROR   | The array declaration extends to column 104 (the limit is 80). The array content should be split up
         |         | over multiple lines
     238 | ERROR   | The array declaration extends to column 94 (the limit is 80). The array content should be split up
         |         | over multiple lines
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...bing-subing/Projects/d9/d9-local/web/modules/contrib/field_permissions/src/Plugin/FieldPermissionType/Manager.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     56 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    -----------------------------------------------------------------------------------------------------------------------
    
    
    FILE: ...g-subing/Projects/d9/d9-local/web/modules/contrib/field_permissions/src/Controller/FieldPermissionsController.php
    -----------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------
     100 | ERROR | The array declaration extends to column 95 (the limit is 80). The array content should be split up over
         |       | multiple lines
    -----------------------------------------------------------------------------------------------------------------------
    
    Time: 877ms; Memory: 12MB
    

    retaining the status to needs review so that others can give their feedback

  • First commit to issue fork.
  • šŸ‡ŗšŸ‡øUnited States bluegeek9

    I updated the description with the current issues reported by phpcs.

  • šŸ‡ŗšŸ‡øUnited States bluegeek9

    bluegeek9 ā†’ changed the visibility of the branch 8.x-1.x to hidden.

  • Pipeline finished with Success
    3 months ago
    Total: 228s
    #401055
  • Pipeline finished with Success
    3 months ago
    Total: 200s
    #401059
  • šŸ‡ŗšŸ‡øUnited States bluegeek9

    bluegeek9 ā†’ changed the visibility of the branch 3322809-8.x-1.x to hidden.

  • šŸ‡ŗšŸ‡øUnited States bluegeek9

    All tests including phpcs are passing.

Production build 0.71.5 2024