Fix the issues reported by phpcs

Created on 20 April 2023, over 1 year ago
Updated 24 April 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings.

FILE: /var/www/html/modules/contrib/anonymous_timezone/anonymous_timezone.module
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
8 | WARNING | [x] Unused use statement
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/anonymous_timezone/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
7 | WARNING | Line exceeds 80 characters; contains 83 characters
11 | WARNING | Line exceeds 80 characters; contains 92 characters
12 | WARNING | Line exceeds 80 characters; contains 101 characters
13 | WARNING | Line exceeds 80 characters; contains 93 characters
17 | WARNING | Line exceeds 80 characters; contains 98 characters
----------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/anonymous_timezone/anonymous_timezone.info.yml
----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------------------
1 | WARNING | "Description" property is missing in the info.yml file
----------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/anonymous_timezone/src/Form/AnonymousTimezoneSettingsForm.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
------------------------------------------------------------------------------------------------------------------------------------------
19 | ERROR | Missing short description in doc comment
24 | ERROR | Missing short description in doc comment
80 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
94 | ERROR | join() is a function name alias, use implode() instead
113 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/modules/contrib/anonymous_timezone/src/AnonymousTimezoneAccountProxy.php
--------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------
47 | ERROR | [ ] Parameter $cache is not described in comment
123 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------

Time: 1.2 secs; Memory: 6MB

Steps to reproduce

Run following command

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

Proposed resolution

Above error/warnings need to be fixed.

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

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

Comments & Activities

  • Issue created by @samit.310@gmail.com
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

    Above errors/warnings has been fixed.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi @samit.310@gmail.com

    I reviewed patch #2 and there are still remaining errors/warnings.

    FILE: ...udenttrainees/Drupal2/drupalsite/docroot/modules/contrib/anonymous_timezone/src/Form/AnonymousTimezoneSettingsForm.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES
    ----------------------------------------------------------------------------------------------------------------------------
    19 | ERROR | Missing short description in doc comment
    24 | ERROR | Missing short description in doc comment
    80 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
    | | $this->t() instead
    82 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
    | | $this->t() instead
    94 | ERROR | join() is a function name alias, use implode() instead
    113 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    ----------------------------------------------------------------------------------------------------------------------------

    FILE: ...rs/studenttrainees/Drupal2/drupalsite/docroot/modules/contrib/anonymous_timezone/src/AnonymousTimezoneAccountProxy.php
    ----------------------------------------------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------
    47 | ERROR | [ ] Parameter $cache is not described in comment
    123 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 7
    ----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------

    Please revise.
    Thank You.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chanderbhushan

    Added patch for fix

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    sahil.goyal โ†’ made their first commit to this issueโ€™s fork.

  • @sahilgoyal opened merge request.
  • Status changed to RTBC over 1 year ago
  • Status changed to Fixed over 1 year ago
  • ๐Ÿ‡ญ๐Ÿ‡บHungary aron novak Hungary, Budapest
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024