Problem/Motivation

Found coding standard issues.

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml site_guardian
FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/tests/src/Unit/SiteGuardianServiceUnitTest.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------
10 | WARNING | Line exceeds 80 characters; contains 96 characters
10 | WARNING | There must be no blank line following an inline comment
101 | WARNING | Unused variable $projects.
------------------------------------------------------------------------------------------

FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/src/Controller/SiteGuardianController.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------
63 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
65 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
76 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
103 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
105 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
115 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------

FILE: /Users/projects/drupal-d10/modules/contrib/site_guardian/src/Services/SiteGuardianService.php
------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
------------------------------------------------------------------------------------------
60 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
67 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
93 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
99 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
100 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
131 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
136 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
147 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
154 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
182 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
190 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------

Time: 144ms; Memory: 10MB

Steps to reproduce

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

Proposed resolution

Fix the coding errors

Remaining tasks

Fix the coding errors and commit the fixes

User interface changes

None

API changes

None

Data model changes

None

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

the_g_bomb created an issue. See original summary.

arpitk’s picture

Assigned: Unassigned » arpitk
Status: Active » Needs work

Working on this

arpitk’s picture

Assigned: arpitk » Unassigned
Status: Needs work » Needs review
Issue tags: +Coding standards

Worked on the major coding standard issues. Created a MR. Please review.

Thanks!

the_g_bomb’s picture

Thanks @arpitk for the work so far, I have merged the latest changes in and added a change or two myself.

https://simplytest.me/project/site_guardian/1.0.x?patch[]=https://git.dr...

It seems the auto addition of patches isn't working on simplytest.me so you can follow the above link, but then add the patch back into the build using: https://git.drupalcode.org/project/site_guardian/-/merge_requests/2.diff

avpaderno’s picture

Title: Coding errors highlighted by PHPCS » Fix the issues reported by phpcs
Category: Bug report » Task
seeduardo’s picture

Code reviewed, spun up again on simplytest.me and then phpcs run on fork again, with success, thanks @the_g_bomb!

i-trokhanenko made their first commit to this issue’s fork.

seeduardo’s picture

Status: Needs review » Reviewed & tested by the community

Minor changes also checked, thanks @i-trokhanenko! Merging....

  • seeduardo committed f679559c on 1.0.x authored by arpitk
    Issue #3358426 by the_g_bomb, i-trokhanenko, arpitk, seeduardo, apaderno...
seeduardo’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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