Fix the issues reported by phpcs

Created on 21 March 2016, almost 9 years ago
Updated 9 January 2024, about 1 year ago

Problem/Motivation

FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\jiraconnect\jiraconnect.info
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------
 1 | WARNING | [ ] Remove "project" from the info file, it will be added by drupal.org packaging automatically
 6 | ERROR   | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------


FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\jiraconnect\jiraconnect.module
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 44 ERRORS AND 4 WARNINGS AFFECTING 38 LINES
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 | ERROR   | [x] Missing file doc comment
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
   4 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
     |         |     xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
   6 | ERROR   | [ ] Description for the @return value must be on the next line
  13 | ERROR   | [x] Expected 1 space after "=>"; 2 found
  23 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
     |         |     xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
  25 | ERROR   | [ ] Missing parameter comment
  26 | ERROR   | [ ] Missing parameter comment
  27 | ERROR   | [ ] Missing parameter comment
  28 | ERROR   | [ ] Missing parameter comment
  31 | ERROR   | [ ] global variables should start with a single underscore followed by the module and another underscore
  31 | ERROR   | [ ] global variables should start with a single underscore followed by the module and another underscore
  33 | ERROR   | [x] Expected 1 space after SWITCH keyword; 0 found
  35 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  35 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
  45 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for
     |         |     xyz-bar.html.twig.", "* Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
  49 | ERROR   | [ ] Missing parameter comment
  50 | ERROR   | [ ] Missing parameter comment
  51 | ERROR   | [ ] Missing parameter comment
  55 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  59 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  60 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
  60 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
  66 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
  88 | ERROR   | [ ] Description for the @return value must be on the next line
 104 | ERROR   | [ ] Missing parameter comment
 105 | ERROR   | [ ] Missing parameter comment
 108 | ERROR   | [ ] global variables should start with a single underscore followed by the module and another underscore
 118 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
 118 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 3
 125 | ERROR   | [x] Parameter comment must be on the next line
 126 | ERROR   | [x] Parameter comment must be on the next line
 127 | ERROR   | [x] Separate the @param and @return sections by a blank line.
 127 | ERROR   | [ ] Description for the @return value must be on the next line
 130 | ERROR   | [ ] global variables should start with a single underscore followed by the module and another underscore
 132 | ERROR   | [x] Concat operator must be surrounded by a single space
 132 | ERROR   | [x] Concat operator must be surrounded by a single space
 139 | ERROR   | [x] Concat operator must be surrounded by a single space
 144 | ERROR   | [x] Expected newline after closing brace
 144 | ERROR   | [x] Expected 1 space after CATCH keyword; 0 found
 153 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
 153 | ERROR   | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
 155 | ERROR   | [ ] Missing parameter comment
 156 | ERROR   | [ ] Missing parameter comment
 159 | ERROR   | [x] Concat operator must be surrounded by a single space
 161 | ERROR   | [x] Concat operator must be surrounded by a single space
 161 | ERROR   | [x] Concat operator must be surrounded by a single space
 169 | ERROR   | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 4.6 secs; Memory: 10MB

Steps to reproduce

Run following command

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml jiraconnect/
📌 Task
Status

Needs work

Component

Code

Created by

🇧🇷Brazil larruda

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.

  • 🇮🇳India Kaustab_Roy

    Verified the patch at #5

    before patch apply:

    After patch apply:

    One error is remaining:
    1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ( As attached in screenshot )

  • 🇮🇳India Kaustab_Roy

    Created updated patch:
    patch-7

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, show which command has been used, which arguments have been used, and which report that command shown.

  • 🇮🇳India zkhan.aamir

    Issue summary updated

  • Status changed to Needs review about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇳India zkhan.aamir

    Hi,

    Patch #7 is applying cleanly.
    All the errors resolved.
    Please check screenshot.

  • Status changed to Needs work about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
     /**
    - * Implementation of hook_menu()
    + * @file
    + * All type of data for the jira content.
    + */

    The usual description for a .module file is Hook implementations for the [module name] module. where [module name] is the name of the module given in its .info.yml file.

     /**
    - * Implementation of hook_menu()
    + * @file
    + * All type of data for the jira content.
    + */
    +
    +/**
    + * Implementation of hook menu()
      *
    - * @return array The menu items.
    + * @return array
    + *   The menu items.
      */
     function jiraconnect_menu() {

    The hook description is already correct, except it misses the period at the end of the description.

     /**
    - * Implementation of hook_user()
    + * Implementation of hook user()
      *
      * @param string $op
    + *   Output of the given content.
      * @param array $edit
    + *   Edit for the user.
      * @param array $account
    + *   Account of the current user.
      * @param string $category
    + *   Category of all types.
      */
    -function jiraconnect_user($op, &$edit, &$account, $category = NULL) {
    

    The description is already correct, period apart.
    For hooks, parameter and return value descriptions are not given.

     /**
    - * Implementation of hook_form_later().
    + * Implementation of hook form later().
      *
      * Overrides validation for the login form.
    - *
    - * @param unknown_type $form
    - * @param unknown_type $form_state
    - * @param unknown_type $form_id
      */
     function jiraconnect_form_alter(&$form, $form_state, $form_id) {
    

    The hook is hook_form_alter().

     /**
      * Renders the JIRAConnect settings form.
      *
    - * @return array The settings form.
    + * @return array
    + *   The settings form.
      */
     function jiraconnect_admin_settings() {
    
      * @param string $form
    + *   The form.
      * @param array $form_state
    + *   The current state of the form.
      */
    -function jiraconnect_login_validate($form, &$form_state) {
    

    The documentation comments for form builders, validation handlers, and submission handlers are different.

Production build 0.71.5 2024