Problem/Motivation

After adding the GitLab CI template, several coding standards issues are identified:

FILE: ...de-3438012/web/modules/custom/jsonapi_include-3438012/src/JsonapiParse.php
--------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
  36 | ERROR | The trigger_error message 'Parsing strings is deprecated
     |       | deprecated in jsonapi_include:8.x-1.7 and is removed from
     |       | jsonapi_include:8.x-2.0. Pass the full Response object instead.
     |       | See
     |       | https://www.drupal.org/project/jsonapi_include/issues/3374410'
     |       | does not match the relaxed standard format: %thing% is
     |       | deprecated in %deprecation-version% any free text
     |       | %removal-version%. %extra-info%. See %cr-link%
     |       | (Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed)
  98 | ERROR | Parameter $key is not described in comment
     |       | (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
 127 | ERROR | Parameter tags must be grouped together in a doc comment
     |       | (Drupal.Commenting.DocComment.ParamGroup)
 147 | ERROR | Parameter tags must be grouped together in a doc comment
     |       | (Drupal.Commenting.DocComment.ParamGroup)
 168 | ERROR | Parameter tags must be grouped together in a doc comment
     |       | (Drupal.Commenting.DocComment.ParamGroup)
 196 | ERROR | Parameter tags must be grouped together in a doc comment
     |       | (Drupal.Commenting.DocComment.ParamGroup)
--------------------------------------------------------------------------------
FILE: .../custom/jsonapi_include-3438012/src/EventSubscriber/ResponseSubscriber.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Cache\CacheableResponseInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 164ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
...modules/custom/jsonapi_include-3438012/src/JsonapiParse.php  6       0
..._include-3438012/src/EventSubscriber/ResponseSubscriber.php  1       0
--------------------------------------------------------------------------------
A TOTAL OF 7 ERRORS AND 0 WARNINGS WERE FOUND IN 6 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 1 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
    SOURCE                                                                 COUNT
--------------------------------------------------------------------------------
[ ] Drupal.Commenting.DocComment.ParamGroup                                4
[ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition               1
[ ] Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed    1
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.Incorrectl  1
--------------------------------------------------------------------------------
A TOTAL OF 7 SNIFF VIOLATIONS WERE FOUND IN 4 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SOURCES AUTOMATICALLY (1 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Assigned: ptmkenny » Unassigned
Status: Active » Needs review
a.aaronjake’s picture

Hi @ptmkenny,

Reviewed MR !8, all phpcs issues mentioned above were fixed however one issue existed.

FILE: ...e/drupal-orgissue/web/modules/contrib/jsonapi_include/src/JsonapiParse.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 258 | WARNING | \Drupal calls should be avoided in classes, use dependency
     |         | injection instead
--------------------------------------------------------------------------------

Time: 339ms; Memory: 10MB

Will leave this as "needs review" so others will also give their opinion.
Thank you.

ptmkenny’s picture

@a.aaronjake As noted in my original post, these are the coding standards issues identified by the GitLab CI template.

The GitLab CI template coding standards test classifies dependency injection issues as phpstan issues, not coding standards issues. So the DI issue is fixed here: #3438021: Fix phpstan issues

ptmkenny’s picture

  • ptmkenny committed 8ec8dbb6 on 8.x-1.x
    Issue #3438018 by ptmkenny: Fix coding standards
    
ptmkenny’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.