Fix the issues reported by phpcs

Created on 21 July 2023, over 1 year ago
Updated 11 March 2024, 9 months ago

GitLAb CI shows a list of PHP_CodeSniffer warnings/errors that should be fixed.

📌 Task
Status

Needs review

Component

Code

Created by

🇮🇳India swatichouhan012

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 @swatichouhan012
  • Issue was unassigned.
  • 🇮🇳India swatichouhan012

    Fixed some PHPCS issues.

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

    Please review.

  • Status changed to Needs work about 1 year ago
  • Hii, @sakthi_dev
    I have Review your patch.

    These are the steps I followed:

    1. Took clone in drupal 10.1.x

    2. Applied patch and ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/leap_ai/

    3. Applied your patch and again ran phpcs command

    found error.

    Needs work.

  • Status changed to Needs review about 1 year ago
  • 🇮🇳India chaitanyadessai Goa

    Please review patch, addressed #4.

  • 🇮🇳India chaitanyadessai Goa

    Please review patch, addressed #4.

  • Status changed to RTBC about 1 year ago
  • 🇵🇭Philippines clarkssquared

    Hi chaitanyadessai,

    I cloned the module, and applied your patch #6 and I confirmed that all PHPCS issues were fixed after applying patch #6.

    Please look at the screenshot I attached for your reference.

    Thank you.

  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * @file leap_ai.module.
    + * @file
    + * Leap_ai.module.
      */

    A .module description is Hook implementations for the [module name] module. where [module name] is the module name given in the .info.yml file.

     /**
    - * Implements hook_form_alter().
    + * Implements hook_form_FORM_ID_alter().
      */
    -function leap_ai_form_media_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

    The correct description is Implements hook_form_FORM_ID_alter() for media_form.

       /**
    -   * @var \Drupal\leap_ai\LeapApi $leapApi
    +   * The leap api plugin manager.
    +   *
    +   * @var \Drupal\leap_ai\LeapApi
        */

    api is misspelled, since it is an acronym. The description is probably not correct; it does not seem a class name for a plugin manager.

        * @param \Drupal\leap_ai\LeapApi $leap_api
    +   *   The leap api.

    api is still misspelled.
    The description is merely repeating the variable name without some characters. It is too generic, and it is contradicts the previous description for the same class.

    + // @todo webhookUrl: "https://your-api-endpoint.com/webhook"

    What follows @todo is a sentence that should describe what need to be done.

  • 🇮🇳India sakthi_dev

    Please review.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -    $model = $media->getSource()->getConfiguration()['model_id'];
    -    // TODO:   webhookUrl: "https://your-api-endpoint.com/webhook"
    -
    +    $model = $media->getSource()->getConfiguration()['model_id']; 
    +    // webhookUrl: "https://your-api-endpoint.com/webhook"

    The last comment was a @todo comment, which should also made clearer. Probably the comment meant Add webhookUrl: "https://your-api-endpoint.com/webhook".

    +   * @param int $model
        *   String model id.

    Either the parameter type hinting is not correct or the description is not correct because an integer is not a string.
    Also, id is misspelled.

        * @return array
        *   Decoded json response.

    json is misspelled and a definite article is missing at the beginning of the description.

        * @param \Drupal\media\MediaInterface $media
    -   *  Media entity to update.
    +   *   Media entity to update.

    A definite article is missing.

       public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    -    parent::submitConfigurationForm($form, $form_state);
       }

    if the call to the parent method is removed, that method can be removed too.

  • Assigned to nitin_lama
  • 🇮🇳India nitin_lama India

    Providing updated patch. Please review.

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

    Hi,
    The changes made in patch #13 have addressed the concerns raised in the comments made in #11.

  • Assigned to apaderno
  • Status changed to Needs work 9 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    @@ -128,9 +130,9 @@ function leap_ai_form_media_form_alter(&$form, \Drupal\Core\Form\FormStateInterf
         $form['leap_image_results'] = [
           '#type' => 'details',
           '#title' => 'Leap AI Image Results',
    -      '#description' => 'These fields are generated by Leap AI and can not be edited.',
    +      '#description' => $this->t('These fields are generated by Leap AI and can not be edited.'),
    

    In a function, $this is not defined.

  • Issue was unassigned.
  • Status changed to Needs review 9 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Pipeline finished with Success
    9 months ago
    Total: 140s
    #116326
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs work 9 months ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    This is not yet ready to be reviewed.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Pipeline finished with Success
    9 months ago
    Total: 140s
    #116348
  • Pipeline finished with Success
    9 months ago
    Total: 138s
    #116364
  • Status changed to Needs review 9 months ago
Production build 0.71.5 2024