Fix the issues reported by phpcs

Created on 11 April 2023, about 1 year ago
Updated 1 March 2024, 4 months ago

Problem/Motivation

Getting the following errors/warnings.

FILE: /time_spent/time_spent.links.menu.yml
-----------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------
 11 | ERROR | [x] Expected 1 newline at end of file; 0 found
-----------------------------------------------------------


FILE: /time_spent/config/install/time_spent.settings.yml
------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------
 6 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------


FILE: /time_spent/time_spent.permissions.yml
------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------
 5 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------


FILE: /time_spent/time_spent.module
--------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------
 23 | WARNING | Unused variable $variables.
--------------------------------------------------------------


FILE: /time_spent/time_spent.libraries.yml
---------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------
 4 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------


FILE: /time_spent/time_spent.links.task.yml
---------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------
 11 | ERROR | [x] Expected 1 newline at end of file; 2 found
---------------------------------------------------------------


FILE: /time_spent/src/Form/TimeSpentUserReportForm.php
----------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------
  99 | ERROR | [x] Expected 1 blank line after function; 0 found
 100 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------


FILE: /time_spent/src/Plugin/views/field/Timespent.php
-----------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------
 70 | ERROR | [x] Use null coalesce operator instead of ternary operator.
-----------------------------------------------------------------

FILE: /time_spent/src/Controller/timeSpentController.php
-----------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------
  20 | ERROR | Class name doesn't match filename; expected "class timeSpentController"
 449 | ERROR | The array declaration extends to column 87 (the limit is 80). The array content should be split up over multiple lines
-----------------------------------------------------------------

Steps to reproduce

Run the following command

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

Proposed resolution

The above errors/warnings needs to be fixed.

๐Ÿ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar_yewale Mumbai

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 @omkar_yewale
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar_yewale Mumbai

    All warnings and issues have been fixed in the !1MR.
    Except for

    Unused variable $variables.

    This should be decided by the maintainer.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

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

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Hi I have update the MR with some remaining fixes of PHPcs issues.

    There are one remaining issue need maintainer comment on it
    Moving to Need work to get notice this issue for remaining task

    Used command:- ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/time_spent

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/time_spent/time_spent.module
    -----------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------
    23 | WARNING | Unused variable $variables.
    -----------------------------------------------------------------------------------------------------

    Time: 299ms; Memory: 14MB

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia __i.am.prashant__

    __i.am.prashant__ โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs review 4 months ago
Production build 0.69.0 2024