Fix the issues reported by phpcs

Created on 11 April 2023, over 1 year ago
Updated 11 July 2024, 5 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 work

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 over 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 10 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 10 months ago
  • Status changed to Needs work 5 months ago
  • Hi @__i.am.prashant__,

    Your changes on the MR !1 applied unsuccessfully. Please see below:

    time_spent git:(master) โœ— curl https://git.drupalcode.org/project/time_spent/-/merge_requests/1.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8273    0  8273    0     0  18962      0 --:--:-- --:--:-- --:--:-- 19465
    patching file config/install/time_spent.settings.yml
    patching file js/time_spent.js
    patching file src/Controller/timeSpentController.php
    Hunk #1 FAILED at 3.
    Hunk #2 FAILED at 446.
    2 out of 2 hunks FAILED -- saving rejects to file src/Controller/timeSpentController.php.rej
    patching file src/Form/TimeSpentUserReportForm.php
    Hunk #1 succeeded at 7 (offset 5 lines).
    Hunk #2 succeeded at 15 with fuzz 1 (offset 5 lines).
    Hunk #3 succeeded at 81 with fuzz 1 (offset -16 lines).
    patching file src/Plugin/views/field/Timespent.php
    Hunk #1 succeeded at 7 (offset 5 lines).
    Hunk #2 succeeded at 72 (offset 5 lines).
    patching file time_spent.libraries.yml
    patching file time_spent.links.menu.yml
    patching file time_spent.links.task.yml
    Hunk #1 FAILED at 9.
    1 out of 1 hunk FAILED -- saving rejects to file time_spent.links.task.yml.rej
    patching file time_spent.module
    Hunk #1 FAILED at 20.
    1 out of 1 hunk FAILED -- saving rejects to file time_spent.module.rej
    patching file time_spent.permissions.yml
    Hunk #1 FAILED at 3.
    1 out of 1 hunk FAILED -- saving rejects to file time_spent.permissions.yml.rej

    Kindly check

    Thanks,
    Jake

Production build 0.71.5 2024