Fix the issues reported by phpcs

Created on 3 August 2022, over 2 years ago
Updated 28 August 2024, 5 months ago

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

FILE: /var/www/html/vb/drupal-2821827/modules/contrib/sticky/src/Manager/StickyManager.php
---------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AND 1 WARNING AFFECTING 5 LINES
---------------------------------------------------------------------------------------------------------------------
8 | ERROR | [x] Doc comment short description must end with a full stop
11 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
14 | ERROR | [ ] Missing member variable doc comment
16 | ERROR | [x] Missing function doc comment
22 | ERROR | [x] There must be exactly one blank line before the tags in a doc comment
22 | ERROR | [ ] Description for the @return value is missing
---------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/vb/drupal-2821827/modules/contrib/sticky/sticky.module
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
18 | ERROR | [x] Case breaking statements must be followed by a single blank line
-----------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------

FILE: /var/www/html/vb/drupal-2821827/modules/contrib/sticky/README.txt
-----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------
18 | WARNING | Line exceeds 80 characters; contains 81 characters
-----------------------------------------------------------------------

Time: 130ms; Memory: 10MB

📌 Task
Status

RTBC

Version

2.0

Component

Code

Created by

🇮🇳India Munavijayalakshmi

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class StickyManager
    + * The class StickyManager.
      *

    The description must describe what the class does, not repeat the class name.

    +  /**
    +   * {@inheritdoc}
    +   */
       protected $config;

    cannot be used in a class without parent classes nor that does not implement interfaces.

    +  /**
    +   * Construct sticky configuration.
    +   */
       public function __construct(ConfigFactoryInterface $config) {

    The description for a constructor must start with Constructs a new followed by the class name (including its namespace), and end with object. It must also describe the parameters and the return value, if the method has any of them.

        * @return array
    +   *   Return settings of JS.
        */
       public function getJsSettings() {

    The return value description must not start with Return nor Returns.

  • Assigned to arpitk
  • 🇮🇳India arpitk

    looking into this.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arpitk

    Updated the patch with reference from #7. Please review.

    Thanks!

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class StickyManager
    + * The class provides Js settings.

    I am not sure that description is accurate.

    +  /**
    +   * The config factory service.
    +   *
    +   * @var \Drupal\Core\Config\ConfigFactoryInterface
    +   */
       protected $config;

    The config factory. is sufficient.

    +  /**
    +   * Constructs a new StickyManager object.
    +   *

    The class name is missing its namespace.

        * @return array
    +   *   The array with Settings of JS.
        */
       public function getJsSettings() {

    The return value description repeats what the method description already says.
    with Settings should be both spelled with lowercase letters.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India sakthi_dev

    Created a patch based on #10. Please review.

  • Status changed to Needs work over 1 year ago
  • 🇵🇭Philippines roberttabigue

    Hi,

    I'm still seeing PHPCS error after applying Patch #11 to the Sticky module with version 2.0.x-dev and with Drupal core version 9.5.8.

    Moving this to Needs work for now.
    Kindly refer to the attached screenshots, please.

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Updated patch #11 by addressing #12, please review it.

    Thanks!

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Class StickyManager
    + * The Class for returning array of Js Settings.
      *

    I am not still sure that is a correct description.
    There are misspelled words that needs to be corrected: The only capitalized word must be the first.
    It is also not necessary to add The Class for in a class description.

    +   *
        * @return array
    +   *   The array with Settings of JS.

    Settings is misspelled, since it is not the first word in the description, a proper noun, nor an acronym.
    Instead of Settings of JS, it should be JavaScript settings.

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama India

    Addressed #14. Please review.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -2. Download the Sticky library (version 1.0.4: https://github.com/garand/sticky),
    -rename the folder to sticky and place it in /libraries/
    -in your drupal root.
    +2. Download the Sticky library
    +(version 1.0.4: https://github.com/garand/sticky),
    +rename the folder to sticky and place it in /libraries/ in your drupal root.
    

    Since that text is part of a list, the second and the third line need to be indented.
    The second line is 50 characters; the text can be reformatted to have lines that reach 80 characters.
    drupal is misspelled; as proper noun, it should be capitalized.

     /**
    - * Class StickyManager
    + * Provides a method to return array of js settings.

    Assuming that description explains the class purpose, there must an undefined article before array and js should be replaced by the full language name.

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama India

    Addressed #19

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Hi, Reviewed the patch at #21, applied cleanly and fixes all the phpcs errors/warnings and also addresses the comments mentioned at #19.
    Thank you!

  • 🇧🇪Belgium f0ns

    Thank you, i'll review this patch.

  • Status changed to RTBC 5 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The changes introduced from the patch are correct.

  • Assigned to f0ns
  • 🇧🇪Belgium f0ns
Production build 0.71.5 2024