Fix the issues reported by phpcs

Created on 4 May 2023, over 1 year ago
Updated 22 February 2024, 10 months ago

Problem/Motivation

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/self_evaluation.routing.yml
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
15 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
23 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
31 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
39 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
124 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
137 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
150 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
163 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
176 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
191 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
203 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
220 | WARNING | Open page callback found, please add a comment before the line why there is no access restriction
232 | WARNING | The administration page callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is
| | about viewing but not changing configurations.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/self_evaluation.install
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------------------------------------------------------------------------
23 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
37 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
389 | ERROR | The array declaration extends to column 81 (the limit is 80). The array content should be split up over multiple lines
----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/js/unique-choice.js
------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------
46 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/tests/src/Functional/SelfEvaluationCreateValidationTest.php
----------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------------------
75 | ERROR | Missing member variable doc comment
----------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/README.md
--------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------------------------
3 | WARNING | [ ] Line exceeds 80 characters; contains 101 characters
10 | WARNING | [ ] Line exceeds 80 characters; contains 93 characters
13 | WARNING | [ ] Line exceeds 80 characters; contains 157 characters
13 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Form/SelfEvaluationVisibilityUpdate.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
179 | WARNING | Exceptions should not be translated
179 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Form/SelfEvaluationDeleteForm.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
90 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
97 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Form/SelfEvaluationCloseForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
378 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
447 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Entity/SelfEvaluation.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
710 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
753 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
753 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Controller/SelfEvaluationAdminController.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------------------------
280 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
282 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Controller/SelfEvaluationResultController.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------
197 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
202 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
207 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/self_evaluation/src/Controller/SelfEvaluationAnswersController.php
-------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------
266 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
266 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-------------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Use the below command with arguments:-
/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/self_evaluation

Proposed resolution

Use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
Fix the issue found by phpcs

๐Ÿ“Œ Task
Status

Needs work

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia sidharth_soman Bangalore

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @sidharth_soman
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Ashutosh Ahirwal โ†’ made their first commit to this issueโ€™s fork.

  • Assigned to ashutosh ahirwal
  • Status changed to Active over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Hi
    I have raised MR.
    Please review it.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Mahima_Mathur23

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

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Update the issue summary.
    Please review.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    This issue is for the 2.0.x branch, but the MR changes the 8.x-1.x branch.

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • @nitin_lama opened merge request.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    5 pass
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Created MR3 for 2.0.x, please review.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi nitin_lama

    I reviewed MR!3, applied against Self evaluation 2.0.x-dev, and there are still remaining issues reported by phpcs shown below:

    FILE: ...es/Drupal/drupalorg-issues-site/docroot/modules/contrib/self_evaluation/self_evaluation.routing.yml
    ---------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 14 LINES
    ---------------------------------------------------------------------------------------------------------
       7 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
      15 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
      23 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
      31 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
      39 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     124 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     137 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     150 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     163 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     176 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
     191 | WARNING | Open page callback found, please add a comment before the line why there is no access
         |         | restriction
     203 | WARNING | Open page callback found, please add a comment before the line why there is no access
         |         | restriction
     220 | WARNING | Open page callback found, please add a comment before the line why there is no access
         |         | restriction
     232 | WARNING | The administration page callback should probably use "administer site configuration" -
         |         | which implies the user can change something - rather than "access administration pages"
         |         | which is about viewing but not changing configurations.
    ---------------------------------------------------------------------------------------------------------
    
    
    FILE: ...nttrainees/Drupal/drupalorg-issues-site/docroot/modules/contrib/self_evaluation/js/unique-choice.js
    ---------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------
     46 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    ---------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------
    
    Time: 4.04 secs; Memory: 18MB

    Please check.
    Thank you.

  • First commit to issue fork.
Production build 0.71.5 2024