Problem/Motivation

The Gitlab CI pipeline identified several coding standards issues: https://git.drupalcode.org/issue/jsonapi_links-3437151/-/jobs/1197339

Let's fix these.

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

Status: Active » Needs review

This fixes all of the coding standards issues identified except 2:

---------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------
 33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
---------------------------------------------------------------------------------------------

I think dependency injection can be a separate issue than other coding standard fixes because DI can sometimes cause problems, so it should be a separate commit.

cleavinjosh’s picture

Status: Needs review » Needs work

Hi @ptmkenny,

I applied MR!8, it was applied smoothly and fixed most of the issues.

However, I encountered more issues than you mentioned in comment #3 after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

➜  jsonapi_links git:(1.0.x) curl https://git.drupalcode.org/project/jsonapi_links/-/merge_requests/8.diff | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3822    0  3822    0     0   9055      0 --:--:-- --:--:-- --:--:--  9078
patching file README.md
patching file src/EventSubscriber/ResponseSubscriber.php
patching file src/Form/SettingsForm.php
➜  jsonapi_links git:(1.0.x) ✗ ..
➜  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml jsonapi_links

FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/jsonapi_links/jsonapi_links.routing.yml
------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
 7 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------


FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/jsonapi_links/jsonapi_links.services.yml
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 2 found
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------


FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/jsonapi_links/jsonapi_links.links.task.yml
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
 12 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------


FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/jsonapi_links/src/EventSubscriber/ResponseSubscriber.php
-----------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------
 33 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 39 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
-----------------------------------------------------------------------------------------------------------------------------

Time: 113ms; Memory: 10MB

➜  contrib

Please check and advise.
Thank you.

ptmkenny’s picture

  • ptmkenny committed 468cf007 on 1.0.x
    Issue #3437153 by ptmkenny: Fix coding standards
    
ptmkenny’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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