Fix the issues reported by phpcs

Created on 11 July 2023, over 1 year ago
Updated 9 November 2023, about 1 year ago

Problem/Motivation

FILE: /var/www/html/vb/d_cont/partial_page_print/README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 89 characters
4 | WARNING | Line exceeds 80 characters; contains 117 characters
15 | WARNING | Line exceeds 80 characters; contains 91 characters
19 | WARNING | Line exceeds 80 characters; contains 111 characters
20 | WARNING | Line exceeds 80 characters; contains 119 characters
32 | WARNING | Line exceeds 80 characters; contains 87 characters
----------------------------------------------------------------------

Time: 89ms; Memory: 10MB

Steps to reproduce

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

Remaining tasks

Patch review

📌 Task
Status

Fixed

Version

1.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

Comments & Activities

  • Issue created by @urvashi_vora
  • 🇮🇳India Ashutosh Ahirwal India

    Provided patch get applied but still showing errors

    Used command
    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/partial_page_print

    Remaining issue
    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/partial_page_print/js/printButton.js
    -------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 2 LINES
    -------------------------------------------------------------------------------------------------------------
    9 | ERROR | [x] Expected 1 space before "-"; 0 found
    9 | ERROR | [x] Expected 1 space after "-"; 0 found
    34 | ERROR | [x] Expected 1 space before "="; 0 found
    -------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------

    FILE: /Users/ashutoshahirwal/Sites/lando/contribution/web/modules/custom/partial_page_print/js/printDocument.js
    ---------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ---------------------------------------------------------------------------------------------------------------
    12 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
    ---------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------

    Time: 139ms; Memory: 10MB

    Providing updated patch with all the fixes.

  • 🇮🇳India rudrakumar188

    Hello,
    I was able to reproduce the errors with given command

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,css,js,yml web/modules/custom/partial_page_print

    and the given patch #2 fixes all the errors.

  • 🇺🇸United States chrissnyder Maryland

    PHPCS and PHPCBF should not be run against Javascript because they can break their functionality as they are not PHP. In general, the PHPCS tools should only run against PHP files. Patch #2 breaks the the JS provided by this module.

    See https://www.drupal.org/docs/contributed-modules/code-review-module/php-codesniffer-command-line-usage

  • @chrissnyder opened merge request.
  • 🇺🇸United States chrissnyder Maryland
    • ChrisSnyder committed d53c602a on 1.0.x
      Issue #3373753 by ChrisSnyder, urvashi_vora, Ashutosh Ahirwal: Fix the...
  • Status changed to Fixed about 1 year ago
  • 🇺🇸United States chrissnyder Maryland
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024