Fix the issues reported by phpcs

Created on 4 April 2023, about 1 year ago
Updated 5 June 2024, 18 days ago

Problem/Motivation

Fix the issues reported by PHPCS for Drupal and DrupalPractice standards in branch 2.0.x

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig news_zymphonies_theme/

Proposed resolution

Fix all the issues listed after executing the command

Remaining tasks

Fixed few issues, the remaining issues are listed below:

FILE: ...pal8/web/modules/contrib/news_zymphonies_theme/news_zymphonies_theme.theme
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 5 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
123 | ERROR | Doc comment short description must be on a single line,
| | further text should be a separate paragraph
243 | WARNING | Translatable strings must not begin or end with white spaces,
| | use placeholders with t() for variables
243 | ERROR | Concatenating translatable strings is not allowed, use
| | placeholders instead and only one string literal
249 | WARNING | Translatable strings must not begin or end with white spaces,
| | use placeholders with t() for variables
249 | ERROR | Concatenating translatable strings is not allowed, use
| | placeholders instead and only one string literal
255 | WARNING | Translatable strings must not begin or end with white spaces,
| | use placeholders with t() for variables
255 | ERROR | Concatenating translatable strings is not allowed, use
| | placeholders instead and only one string literal
260 | WARNING | Translatable strings must not begin or end with white spaces,
| | use placeholders with t() for variables
260 | ERROR | Concatenating translatable strings is not allowed, use
| | placeholders instead and only one string literal
265 | WARNING | Translatable strings must not begin or end with white spaces,
| | use placeholders with t() for variables
265 | ERROR | Concatenating translatable strings is not allowed, use
| | placeholders instead and only one string literal
--------------------------------------------------------------------------------

FILE: ...es/contrib/news_zymphonies_theme/includes/fontawesome/css/font-awesome.css
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
121 | ERROR | Style definitions must end with a semicolon
127 | ERROR | Style definitions must end with a semicolon
133 | ERROR | Style definitions must end with a semicolon
139 | ERROR | Style definitions must end with a semicolon
145 | ERROR | Style definitions must end with a semicolon
--------------------------------------------------------------------------------

FILE: ...contrib/news_zymphonies_theme/includes/smartmenus/jquery.smartmenus.min.js
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...dules/contrib/news_zymphonies_theme/includes/bootstrap/js/bootstrap.min.js
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...les/contrib/news_zymphonies_theme/includes/bootstrap/css/bootstrap.min.css
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...ntrib/news_zymphonies_theme/includes/bootstrap/css/bootstrap-theme.min.css
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...trib/news_zymphonies_theme/includes/flexslider/js/jquery.flexslider-min.js
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...ontrib/news_zymphonies_theme/includes/owl/assets/owl.theme.default.min.css
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...web/modules/contrib/news_zymphonies_theme/includes/owl/owl.carousel.min.js
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...ntribution/drupal8/web/modules/contrib/news_zymphonies_theme/css/media.css
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

FILE: ...tribution/drupal8/web/modules/contrib/news_zymphonies_theme/css/global.css
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
1 | WARNING | File appears to be minified and cannot be processed
--------------------------------------------------------------------------------

Time: 1.92 secs; Memory: 28MB

Please review the patch for fixing few errors and warnings.

📌 Task
Status

Needs work

Version

2.0

Component

Code

Created by

🇮🇳India urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work about 1 year ago
  • 🇮🇳India saket-001

    Hi @urvashi_vora patch is good but its not fixes all the standard issues so moving status to Needs Work.
    Sharing the SS .

  • Assigned to akshaydalvi212
  • Issue was unassigned.
  • 🇮🇳India akshaydalvi212

    providing the #4 patch which eliminates almost all the issues reported by PHPCS.

    only below error are remaining
    FILE: .../news_zymphonies_theme/includes/fontawesome/css/font-awesome.css
    ----------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ----------------------------------------------------------------------
    121 | ERROR | Style definitions must end with a semicolon
    127 | ERROR | Style definitions must end with a semicolon
    133 | ERROR | Style definitions must end with a semicolon
    139 | ERROR | Style definitions must end with a semicolon
    145 | ERROR | Style definitions must end with a semicolon
    ----------------------------------------------------------------------

    kindly review the patch.

  • 🇮🇳India Akram Khan Cuttack, Odisha

    checked patch #5 it remove all PHPCS issues

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -+function ($) {
    ++ function ($) {
       'use strict';

    Probably the patch is malformed.

    -    var called = false, $el = this
    -    $(this).one($.support.transition.end, function () { called = true })
    -    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
    +    var called = FALSE, $el = this

    The Drupal coding standards for JavaScript says:

    Each variable assignment SHOULD be declared on a separate line - including variables that are only declared but do not get a value assigned.

    +      if (!data) { $this.data('bs.alert', (data = new Alert(this)))
    +      if (typeof option == 'string') { data[option].call($this)
    +    }
    +      }

    The code indentation is not correct.

    -    if (e.isDefaultPrevented()) return
    +    if (e.isDefaultPrevented()) { return

    That code is not formatted as the Drupal coding standards show.

    if (condition1 || condition2) {
      action1();
    }
    else if (condition3 && condition4) {
      action2();
    }
    else {
      defaultAction();
    }
    
  • Assigned to akshaydalvi212
  • 🇮🇳India akshaydalvi212

    I will work on it and provide updated patch file.

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

    kindly review the patch.
    fixed all the indention issues.

  • 🇮🇳India Anmol_Specbee

    The patch file 3352113-coding-standard-9.patch didn't apply successfully. Adding a screenshot for reference.

  • Status changed to Needs work about 1 year ago
  • 🇮🇳India mrinalini9 New Delhi

    Rerolled patch #9, please review it.

    Thanks!

  • Status changed to Needs review about 1 year ago
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    diff --git a/includes/bootstrap/js/bootstrap.js b/includes/bootstrap/js/bootstrap.js
    index 8ae571b..a5dc5e3 100644
    --- a/includes/bootstrap/js/bootstrap.js
    +++ b/includes/bootstrap/js/bootstrap.js

    The report shown in the issue summary does not show warnings nor errors for the includes/bootstrap/js/bootstrap.js file.

  • Hi, patch #12 applied cleanly but it not fixes all the phpcs issues.

    $ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml news_zymphonies_theme/
    
    FILE: ...isha\news_zymphonies_theme\config\optional\block.block.news_zymphonies_theme_page_title.yml
    -------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------
     17 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\css\global.css
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ----------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\css\media.css
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ----------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\includes\flexslider\css\flexslider.css
    ----------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------
     1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
    ----------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\includes\fontawesome\css\font-awesome.css
    ------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 6 LINES
    ------------------------------------------------------------------------------------
       1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
     121 | ERROR | [ ] Style definitions must end with a semicolon
     127 | ERROR | [ ] Style definitions must end with a semicolon
     133 | ERROR | [ ] Style definitions must end with a semicolon
     139 | ERROR | [ ] Style definitions must end with a semicolon
     145 | ERROR | [ ] Style definitions must end with a semicolon
    ------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\includes\owl\assets\owl.carousel.css
    ------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 5 LINES
    ------------------------------------------------------------------------------------
       1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
       1 | ERROR | [x] Whitespace found at end of line
      40 | ERROR | [x] Whitespace found at end of line
      51 | ERROR | [x] Whitespace found at end of line
     146 | ERROR | [x] Whitespace found at end of line
     161 | ERROR | [x] Whitespace found at end of line
    ------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\includes\smartmenus\sm-core-css.css
    ------------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------
       1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
     179 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 4
    ------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------
    
    
    FILE: C:\Users\Nisha\news_zymphonies_theme\news_zymphonies_theme.theme
    ------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------
       1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
     114 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 6
     115 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 6
    ------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------
    
    Time: 2.51 secs; Memory: 18MB
    
    
  • 🇮🇳India Yashaswi18

    bootstrap.js file changes not included in this patch.

  • 🇮🇳India Preethy_ray

    Hi,
    Reviewed the above patch. Patch applied cleanly, but found few errors and warnings that need to be addressed.

  • Status changed to Needs work 18 days ago
  • 🇮🇳India dev16.addweb
    FILE: /home/addweb/Drupal8-vagrant/web/web/patches/news_zymphonies_theme/includes/fontawesome/css/font-awesome.css
    ------------------------------------------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    ------------------------------------------------------------------------------------------------------------------
     121 | ERROR | Style definitions must end with a semicolon
     127 | ERROR | Style definitions must end with a semicolon
     133 | ERROR | Style definitions must end with a semicolon
     139 | ERROR | Style definitions must end with a semicolon
     145 | ERROR | Style definitions must end with a semicolon
    ------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/patches/news_zymphonies_theme/css/global.css
    ---------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    ---------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/patches/news_zymphonies_theme/css/media.css
    --------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------------
     1 | WARNING | File appears to be minified and cannot be processed
    --------------------------------------------------------------------------------------
    
    
    FILE: /home/addweb/Drupal8-vagrant/web/web/patches/news_zymphonies_theme/news_zymphonies_theme.info.yml
    -------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------
     1 | WARNING | "core_version_requirement" property is missing in the info.yml file
    -------------------------------------------------------------------------------------------------------
    
  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    apaderno changed the visibility of the branch 3352113-fix-phpcs-issues to hidden.

  • Pipeline finished with Success
    18 days ago
    Total: 3692s
    #191929
  • Pipeline finished with Success
    18 days ago
    Total: 3692s
    #191932
Production build 0.69.0 2024