Fix the issues reported by phpcs

Created on 13 March 2023, almost 2 years ago
Updated 26 June 2024, 6 months ago

Problem/Motivation

Getting following errors.

FILE: /var/www/html/modules/contrib/pathauto_preview/pathauto_preview.module
----------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------------------------
68 | ERROR | [ ] Missing parameter comment
69 | ERROR | [ ] Missing parameter comment
71 | ERROR | [ ] Description for the @return value is missing
90 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------

Time: 9.86 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/pathauto_preview/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

RTBC

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

Merge Requests

Comments & Activities

  • Issue created by @samit.310@gmail.com
  • 🇮🇳India samit.310@gmail.com

    Above errors has been fixed.

  • Issue was unassigned.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    * @param array $form
    + * The Form array.
    * @param \Drupal\Core\Form\FormStateInterface $form_state
    + * The For state.

    Form does not need to be capitalized since it is not a proper noun nor at the beginning of the sentence. The same is true for For, which is also a typo.

    + * The Form's pathauto_preview value.

    That is another word that is not a proper noun nor at the beginning of the sentence. That description does not make clear what the returned value is.

    I didn't find much AJAX callbacks that are implemented as functions, but the following has a different documentation comment, probably because, like form submission and validation handlers, their parameters are known.

    /**
     * Ajax callback that returns the form element.
     */
    function form_test_tableselect_ajax_callback($form, FormStateInterface $form_state) {
      return $form['tableselect'];
    }
  • 🇮🇳India kkalashnikov Ghaziabad, India

    Improve the typo and grammar in this patch.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
      * Ajax callback that generates the URL-alias for an entity.
      *
      * @param array $form
    + *   The form array.
      * @param \Drupal\Core\Form\FormStateInterface $form_state
    + *   The form state.
      *
      * @return mixed
    + *   The pathauto_preview value of the form.
      */

    An AJAX callback does not need its parameters nor its return value described.

    -  // moment and the pathauto generator requires that the entity has an ID>
    +  // moment and the pathauto generator requires that the entity has an ID>.

    The > after ID is a typo. It needs to be removed.

  • Status changed to Needs review almost 2 years ago
  • 🇮🇳India rassoni Bangalore

    Addressed #5feedback.

    1. An AJAX callback does not need its parameters nor its return value described : Fixed
    2. The > after ID is a typo. It needs to be removed. : Fixed
  • Hi, reviewed the patch #6, applied cleanly , fixes all the reported phpcs errors and addresses the comments in #5.

  • Status changed to RTBC 6 months ago
  • 🇮🇳India dev16.addweb

    I've applied MR !1 and no phpcs issues found.

Production build 0.71.5 2024