Issues found by phpcs

Created on 30 October 2023, 8 months ago

Problem/Motivation

Steps to reproduce

Proposed resolution

$ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
FILE: ...les/custom/message_digest-3397836/tests/src/Kernel/TokenTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 62 | ERROR | The array declaration extends to column 126 (the limit
    |       | is 120). The array content should be split up over
    |       | multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
----------------------------------------------------------------------
FILE: ...om/message_digest-3397836/src/Form/MessageDigestIntervalForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 68 | ERROR | The array declaration extends to column 296 (the limit
    |       | is 120). The array content should be split up over
    |       | multiple lines
    |       | (Drupal.Arrays.Array.LongLineDeclaration)
----------------------------------------------------------------------
FILE: ...stom/message_digest-3397836/src/Entity/MessageDigestInterval.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 37 | WARNING | Line exceeds 80 characters; contains 92
    |         | characters (Drupal.Files.LineLength.TooLong)
----------------------------------------------------------------------
FILE: ...essage_digest-3397836/message_digest_ui/message_digest_ui.module
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 16 | ERROR | All functions defined in a module file must be prefixed
    |       | with the module's name, found
    |       | "message_digest_allowed_values_callback" but expected
    |       | "message_digest_ui_message_digest_allowed_values_callback"
    |       | (Drupal.NamingConventions.ValidFunctionName.InvalidPrefix)
 36 | ERROR | All functions defined in a module file must be prefixed
    |       | with the module's name, found
    |       | "message_digest_default_value_callback" but expected
    |       | "message_digest_ui_message_digest_default_value_callback"
    |       | (Drupal.NamingConventions.ValidFunctionName.InvalidPrefix)
----------------------------------------------------------------------
Time: 619ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE                                                  ERRORS  WARNINGS
----------------------------------------------------------------------
...397836/message_digest_ui/message_digest_ui.module  2       0
...gest-3397836/src/Entity/MessageDigestInterval.php  0       1
...st-3397836/src/Form/MessageDigestIntervalForm.php  1       0
...age_digest-3397836/tests/src/Kernel/TokenTest.php  1       0
----------------------------------------------------------------------
A TOTAL OF 4 ERRORS AND 1 WARNING WERE FOUND IN 40 FILES
----------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
----------------------------------------------------------------------
SOURCE                                                           COUNT
----------------------------------------------------------------------
Drupal.Arrays.Array.LongLineDeclaration                          2
Drupal.NamingConventions.ValidFunctionName.InvalidPrefix         2
Drupal.Files.LineLength.TooLong                                  1
----------------------------------------------------------------------
A TOTAL OF 5 SNIFF VIOLATIONS WERE FOUND IN 3 SOURCES
----------------------------------------------------------------------

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bluegeek9

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

Comments & Activities

  • Issue created by @bluegeek9
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update 8 months ago
    37 pass
  • @bluegeek9 opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    The 92 character line is part of the entity annotation. I am not sure why it is listed.

    I am not sure how I should handle the two InvalidPrefix. We could move the functions to message_digest.module. Or, we could rename the functions and use a hook_update_N to update the fields. I prefer the first option as it does not require a hook_update_N; there is less chance of something going wrong.

    $ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
    FILE: ...stom/message_digest-3397844/src/Entity/MessageDigestInterval.php
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     37 | WARNING | Line exceeds 80 characters; contains 92
        |         | characters (Drupal.Files.LineLength.TooLong)
    ----------------------------------------------------------------------
    FILE: ...essage_digest-3397844/message_digest_ui/message_digest_ui.module
    ----------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------
     16 | ERROR | All functions defined in a module file must be prefixed
        |       | with the module's name, found
        |       | "message_digest_allowed_values_callback" but expected
        |       | "message_digest_ui_message_digest_allowed_values_callback"
        |       | (Drupal.NamingConventions.ValidFunctionName.InvalidPrefix)
     36 | ERROR | All functions defined in a module file must be prefixed
        |       | with the module's name, found
        |       | "message_digest_default_value_callback" but expected
        |       | "message_digest_ui_message_digest_default_value_callback"
        |       | (Drupal.NamingConventions.ValidFunctionName.InvalidPrefix)
    ----------------------------------------------------------------------
    
Production build 0.69.0 2024