Fix the issues reported by phpcs

Created on 3 February 2023, almost 2 years ago
Updated 25 August 2023, about 1 year ago

Problem/Motivation

Getting Following errors/warnings

$ phpcs --standard=Drupal amp_optimizer

FILE: ...min\Desktop\task\amp_optimizer\src\EventSubscriber\OptimizerSubscriber.php
--------------------------------------------------------------------------------
FOUND 9 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found
     |         |     "\r\n"
  20 | WARNING | [ ] The class short comment should describe what the class
     |         |     does and not simply repeat the class name
  56 | ERROR   | [ ] Missing short description in doc comment
  61 | ERROR   | [x] Missing function doc comment
 109 | ERROR   | [ ] Missing short description in doc comment
 110 | ERROR   | [ ] Missing parameter comment
 110 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 111 | ERROR   | [ ] Missing parameter comment
 111 | ERROR   | [x] Data types in @param tags need to be fully namespaced
 113 | ERROR   | [ ] Description for the @return value is missing
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\task\amp_optimizer\src\Form\Settings.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 1 | ERROR | [x] End of line character is invalid; expected "\n" but found
   |       |     "\r\n"
 9 | ERROR | [x] Missing class doc comment
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 447ms; Memory: 8MB

Proposed resolution

Fix the errors and warnings.

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Jay Jangid

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 @Jay Jangid
  • @jay-jangid opened merge request.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Jay Jangid

    Created MR , please review.

    Thank you.

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi Jay Jangid

    I applied your MR to the โ€œAMP Optimizerโ€ module and confirmed that the phpcs issues are resolved. Please see the screenshots attached.

    For your review.
    Thank you.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    /**
    - * Class OptimizerSubscriber.
    - *
    - * @package Drupal\amp_optimizer\EventSubscriber
    + * Summary of OptimizerSubscriber.
      */
       /**
    -   * @var \Drupal\Core\Session\AccountProxyInterface
    +   * Summary of currentUser.
    +   *
    +   * @var mixed
        */
       protected $currentUser;
    +  /**
    +   * Summary of __construct.
    +   *
    +   * @param \AmpProject\Optimizer\TransformationEngine $transformation_engine
    +   *   The transformation_engine.
    +   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    +   *   The config_factory.
    +   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_channel_factory
    +   *   The logger_channel_factory.
    +   * @param \Drupal\Core\Session\AccountProxyInterface $current_user
    +   *   The current_user.
    +   */
       public function __construct(TransformationEngine $transformation_engine, ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_channel_factory, AccountProxyInterface $current_user) {

    Summary of is not a description for a class, a method, or a parameter.

  • Assigned to imustakim
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia imustakim Ahmedabad

    Working on this.

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

    Patch added.
    Please review.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
    - * Class OptimizerSubscriber.
    + * An eventsubscriber of amp_optimizer.
      *

    eventsubscriber are two words.
    A class description must not include the module machine name; eventually, it should describe the class without using a generic description like An event subscriber.

    -   * @param Response $response
    -   * @param Request $request
    +   * Checks if the response format is html.

    As acronym, it is spelled HTML.

        * @return bool
    +   *   FALSE if the response is not instance of htmlresponse.
        */

    an is missing before instance of. If htmlresponse is the class name, it must be written using the same uppercase/lowercase characters.

  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India
  • @nitin_lama opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama India

    Created MR7. Please review.

  • First commit to issue fork.
  • Status changed to Fixed about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine voleger Ukraine, Rivne

    Oh, closing the issue. Thanks

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024