Fix the issues reported by phpcs

Created on 18 June 2017, over 7 years ago
Updated 6 March 2024, 9 months ago

Running phpcs --standard=โ€œDrupal,DrupalPracticeโ€ --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js returns the following warnings/errors, which should be fixed.

FILE: ...drupal_modules/download_count/includes/download_count.export.inc
----------------------------------------------------------------------
FOUND 32 ERRORS AND 3 WARNINGS AFFECTING 34 LINES
----------------------------------------------------------------------
  17 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
  24 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  25 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  26 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  27 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  27 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
  28 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  29 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  30 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  31 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  32 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  33 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  34 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  35 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  36 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  37 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  38 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  52 | WARNING | [ ] Avoid backslash escaping in translatable strings
     |         |     when possible, use "" quotes instead
  57 | WARNING | [ ] Avoid backslash escaping in translatable strings
     |         |     when possible, use "" quotes instead
  82 | ERROR   | [x] Expected 1 space after "="; 2 found
  88 | WARNING | [ ] Empty return statement not required here
  91 | ERROR   | [x] Missing function doc comment
  98 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 122 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 123 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 124 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 125 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 126 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 127 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 128 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 129 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 130 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 131 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 132 | ERROR   | [ ] String concat is not required here; use a single
     |         |     string instead
 138 | ERROR   | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...modules/download_count/includes/download_count.views_default.inc
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
  14 | ERROR | [x] Calling class constructors must always include
     |       |     parentheses
 470 | ERROR | [x] Calling class constructors must always include
     |       |     parentheses
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...upal_modules/download_count/includes/download_count.settings.inc
----------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
----------------------------------------------------------------------
 11 | ERROR   | [ ] Return type missing for @return tag in function
    |         |     comment
 12 | ERROR   | [x] Return comment indentation must be 3 spaces,
    |         |     found 1 spaces
 26 | WARNING | [ ] Avoid backslash escaping in translatable strings
    |         |     when possible, use "" quotes instead
 71 | ERROR   | [x] Array indentation error, expected 4 spaces but
    |         |     found 6
 72 | ERROR   | [x] Array indentation error, expected 4 spaces but
    |         |     found 6
 73 | ERROR   | [x] Array indentation error, expected 4 spaces but
    |         |     found 6
 74 | ERROR   | [x] Array indentation error, expected 4 spaces but
    |         |     found 6
 75 | ERROR   | [x] Array closing indentation error, expected 2
    |         |     spaces but found 4
----------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../drupal_modules/download_count/includes/download_count.drush.inc
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
 49 | ERROR | [x] Expected 1 space before "=="; 2 found
 53 | ERROR | [x] Expected 1 space before "=="; 2 found
 88 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../drupal_modules/download_count/includes/download_count.views.inc
----------------------------------------------------------------------
FOUND 27 ERRORS AND 1 WARNING AFFECTING 18 LINES
----------------------------------------------------------------------
  13 | ERROR   | [x] Inline comments must start with a capital letter
  13 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  21 | ERROR   | [x] Inline comments must start with a capital letter
  21 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  23 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  24 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
  27 | WARNING | [x] There must be no blank line following an inline
     |         |     comment
  27 | ERROR   | [x] Inline comments must start with a capital letter
  27 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  29 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  48 | ERROR   | [x] Inline comments must start with a capital letter
  48 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  60 | ERROR   | [x] Inline comments must start with a capital letter
  60 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  72 | ERROR   | [x] Inline comments must start with a capital letter
  91 | ERROR   | [x] Line indented incorrectly; expected 2 spaces,
     |         |     found 4
  91 | ERROR   | [x] Inline comments must start with a capital letter
 110 | ERROR   | [x] Inline comments must start with a capital letter
 110 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 126 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 145 | ERROR   | [x] Inline comments must start with a capital letter
 145 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 162 | ERROR   | [x] Expected 1 blank line after function; 2 found
 165 | ERROR   | [x] Missing function doc comment
 166 | ERROR   | [x] Inline comments must start with a capital letter
 166 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 168 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
 169 | ERROR   | [x] Array indentation error, expected 4 spaces but
     |         |     found 6
----------------------------------------------------------------------
PHPCBF CAN FIX THE 28 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../drupal_modules/download_count/includes/download_count.pages.inc
----------------------------------------------------------------------
FOUND 34 ERRORS AND 2 WARNINGS AFFECTING 28 LINES
----------------------------------------------------------------------
 109 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 110 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 111 | ERROR   | [x] Array closing indentation error, expected 4
     |         |     spaces but found 6
 111 | ERROR   | [x] Closing parenthesis of array declaration must be
     |         |     on a new line
 117 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 117 | WARNING | [ ] Do not concatenate strings to translatable
     |         |     strings, they should be part of the t() argument
     |         |     and you should use placeholders
 118 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 119 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 120 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 121 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 131 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 172 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 225 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 226 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 229 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 230 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 246 | ERROR   | [x] Expected 1 space after "="; 2 found
 249 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 250 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 252 | ERROR   | [x] Functions must not contain multiple empty lines
     |         |     in a row; found 2 empty lines
 263 | ERROR   | [x] Inline comments must start with a capital letter
 273 | ERROR   | [x] No space found before comment text; expected "//
     |         |     base query for all files for all intervals" but
     |         |     found "//base query for all files for all
     |         |     intervals"
 273 | ERROR   | [x] Inline comments must start with a capital letter
 273 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 288 | ERROR   | [x] Inline comments must start with a capital letter
 288 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 292 | ERROR   | [x] Expected 1 space after "="; 2 found
 298 | ERROR   | [x] Functions must not contain multiple empty lines
     |         |     in a row; found 2 empty lines
 300 | ERROR   | [x] Inline comments must start with a capital letter
 300 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 311 | ERROR   | [x] Inline comments must start with a capital letter
 311 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 322 | ERROR   | [x] Inline comments must start with a capital letter
 322 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 360 | WARNING | [ ] Only string literals should be passed to t()
     |         |     where possible
 380 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../drupal_modules/download_count/includes/download_count.field.inc
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
  1 | ERROR | [x] The PHP open tag must be followed by exactly one
    |       |     blank line
 31 | ERROR | [ ] If the line declaring an array spans longer than 80
    |       |     characters, each element should be broken into its
    |       |     own line
 44 | ERROR | [ ] Doc comment short description must be on a single
    |       |     line, further text should be a separate paragraph
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../projects/drupal_modules/download_count/download_count.rules.inc
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 26 | ERROR | [x] Array indentation error, expected 8 spaces but
    |       |     found 7
 29 | ERROR | [x] Array closing indentation error, expected 7 spaces
    |       |     but found 8
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ay/projects/drupal_modules/download_count/download_count.install
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
  86 | ERROR | [ ] Do not use t() in hook_schema(), this will only
     |       |     generate overhead for translators
 107 | ERROR | [ ] Do not use t() in hook_schema(), this will only
     |       |     generate overhead for translators
 114 | ERROR | [ ] Do not use t() in hook_schema(), this will only
     |       |     generate overhead for translators
 157 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...way/projects/drupal_modules/download_count/download_count.module
----------------------------------------------------------------------
FOUND 23 ERRORS AND 2 WARNINGS AFFECTING 19 LINES
----------------------------------------------------------------------
   5 | WARNING | [ ] Line exceeds 80 characters; contains 128
     |         |     characters
  31 | WARNING | [ ] Avoid backslash escaping in translatable strings
     |         |     when possible, use "" quotes instead
 150 | ERROR   | [x] Expected 1 space after "="; 2 found
 152 | ERROR   | [x] No space found before comment text; expected "//
     |         |     if role should be skipped, return." but found
     |         |     "//if role should be skipped, return."
 152 | ERROR   | [x] Inline comments must start with a capital letter
 157 | ERROR   | [x] No space found before comment text; expected "//
     |         |     if no access, simply return." but found "//if no
     |         |     access, simply return."
 157 | ERROR   | [x] Inline comments must start with a capital letter
 162 | ERROR   | [x] No space found before comment text; expected "//
     |         |     check flood control" but found "//check flood
     |         |     control"
 162 | ERROR   | [x] Inline comments must start with a capital letter
 162 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 171 | ERROR   | [x] No space found before comment text; expected "//
     |         |     validate file has extension that should be
     |         |     counted, if not return." but found "//validate
     |         |     file has extension that should be counted, if
     |         |     not return."
 171 | ERROR   | [x] Inline comments must start with a capital letter
 187 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 2
 196 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 2
 198 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 234 | ERROR   | [x] Expected 1 space after comma in function call; 2
     |         |     found
 234 | ERROR   | [x] Expected one space after the comma, 2 found
 242 | ERROR   | [ ] Missing parameter type
 247 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 249 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 8
 250 | ERROR   | [x] Array closing indentation error, expected 4
     |         |     spaces but found 6
 339 | ERROR   | [ ] If the line declaring an array spans longer than
     |         |     80 characters, each element should be broken
     |         |     into its own line
 347 | ERROR   | [x] Expected 1 space before "="; 0 found
 349 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 4
 350 | ERROR   | [x] Array indentation error, expected 6 spaces but
     |         |     found 4
----------------------------------------------------------------------
PHPCBF CAN FIX THE 19 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 517ms; Memory: 18Mb
๐Ÿ“Œ Task
Status

Needs review

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ฆUkraine Sardis

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.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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, ๐Ÿ‡ฎ๐Ÿ‡น

    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.

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

    Issue summary updated.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
      * @file
    - * Tracks file downloads for files stored in the drupal files table using the private files setting or custom private filefield.
    + * Tracks file downloads for files stored in the drupal files table.
    + *
    + * File download uses private files setting or custom private filefield.
      */

    The usual module description is Hook implementations for the [module name] module. where [module name] is replaced by the module name.

         return confirm_form(
           $form,
    -      t('Are you sure you want to reset the download count for %filename on %entity #%id?', array('%filename' => $dc_entry->filename, '%entity' => $dc_entry->type, '%id' => $dc_entry->id)),
    +      t(
    +        'Are you sure you want to reset the download count for %filename on %entity #%id?',
    +        array(
    +          '%filename' => $dc_entry->filename,
    +          '%entity' => $dc_entry->type,
    +          '%id' => $dc_entry->id,
    +        )
    +      ),
         return confirm_form(
           $form,
    -      t('Are you sure you want to reset the download count for %filename on %entity #%id?', array('%filename' => $dc_entry->filename, '%entity' => $dc_entry->type, '%id' => $dc_entry->id)),
    +      t(
    +        'Are you sure you want to reset the download count for %filename on %entity #%id?',
    +        array(
    +          '%filename' => $dc_entry->filename,
    +          '%entity' => $dc_entry->type,
    +          '%id' => $dc_entry->id,
    +        )
    +      ),

    Function calls are allowed to exceed the 80 characters, when they are more readable. I am not sure the changed code is more readable.

     /**
      * Download count administration settings.
      *
    - * @return
    - * Form for download_count configuration options.
    + * @return array
    + *   Form for download_count configuration options.
      */

    The documentation comment for form builder functions must not document the parameters nor the return value. Instead, it needs to make clear which form is built.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Preethy_ray โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    Patch #8 applied successfully

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/download_count (7.x-3.x)
    $ curl https://www.drupal.org/files/issues/2023-11-30/phpcs-fix-2887123.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 40736  100 40736    0     0  67855      0 --:--:-- --:--:-- --:--:-- 68006
    patching file download_count.install
    patching file download_count.module
    patching file download_count.rules.inc
    patching file includes/download_count.drush.inc
    patching file includes/download_count.export.inc
    patching file includes/download_count.field.inc
    patching file includes/download_count.pages.inc
    patching file includes/download_count.settings.inc
    patching file includes/download_count.views.inc
    patching file includes/download_count.views_default.inc
    

    Still there is 1 error left

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml download_count/
    
    FILE: C:\Users\Admin\Desktop\projects\drupal\web\modules\contrib\download_count\download_count.css
    --------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------------------------
     11 | ERROR | Style definitions must end with a semicolon
    --------------------------------------------------------------------------------------------------
    
    Time: 925ms; Memory: 20MB
    
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    /**
      * @file
    - * Tracks file downloads for files stored in the drupal files table using the private files setting or custom private filefield.
    + * Tracks file downloads for files stored in the drupal files table using the.
    + *
    + * Private files setting or custom private filefield.
      */

    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.

    -      'title' => t('view download counts'),
    +      'title' => t("view download counts"),
    

    This change is not required from the report shown in the issue summary, nor is it necessary.

    +  // $id = db_insert('download_count')
    +    ->fields(array(
    +      'fid' => $file['fid'],
    +      'uid' => $user->uid,
    +      'type' => $entity_type,
    +      'id' => $entity->{$entity_info['entity keys']['id']},
    +      'ip_address' => $ip,
    +      'referrer' => $referrer,
    +      'timestamp' => $time,
    +    ))
    +    ->execute();

    This is a wrong change and it would produce a syntax error. (Hint: The first line is commented out, but the other lines are not.)

    -  watchdog('download_count', '%file was downloaded by user #%uid from %ip', array('%file' => $file['filename'], '%uid' => $user->uid, '%ip' => $ip), WATCHDOG_NOTICE);
    +  watchdog(
    +  'download_count',
    +  '%file was downloaded by user #%uid from %ip',
    +  [
    +    '%file' => $file['filename'],
    +    '%uid' => $user->uid,
    +    '%ip' => $ip,
    +  ],
    +  WATCHDOG_NOTICE
    +  );

    The new code is wrongly indented.

       $time = REQUEST_TIME;
    -  $status = 0;
    +  // $status = 0;

    If a variable is not used, it is not necessary to comment out the line that initializes it. That line must be removed.

  • Fixed the addressed changes.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sourabhjain

    @nisha_j Could you please add the interdiff file too.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

    Patch #14 applied successfully.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/download_count (7.x-3.x)
    $ curl https://www.drupal.org/files/issues/2024-01-30/phpcs-fix-2887123-14.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 42853  100 42853    0     0  84199      0 --:--:-- --:--:-- --:--:-- 84356
    patching file download_count.css
    patching file download_count.info
    patching file download_count.install
    patching file download_count.module
    patching file download_count.rules.inc
    patching file includes/download_count.drush.inc
    patching file includes/download_count.export.inc
    patching file includes/download_count.field.inc
    patching file includes/download_count.pages.inc
    patching file includes/download_count.settings.inc
    patching file includes/download_count.views.inc
    patching file includes/download_count.views_default.inc
    patching file js/download_count.js
    patching file js/download_count_sparklines.js
    

    No issues remaining.

    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/download_count (7.x-3.x)
    $ cd ../
    
    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
    $ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml download_count/
    
    Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules
    $
    
    
  • Status changed to Needs review 9 months ago
Production build 0.71.5 2024