Fix the issue reported by phpcs.

Created on 28 June 2023, over 1 year ago

Problem/Motivation

Getting following error/warnings:
FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\site24x7\js\site24x7.js
------------------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
1 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
1 | ERROR | [x] Expected 1 space before opening brace; found 0
4 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
8 | ERROR | [x] Expected 1 space before "="; 0 found
8 | ERROR | [x] Expected 1 space after "="; 0 found
8 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\site24x7\README.md
----------------------------------------------------------------------
FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
----------------------------------------------------------------------
5 | WARNING | Line exceeds 80 characters; contains 119 characters
6 | WARNING | Line exceeds 80 characters; contains 112 characters
9 | WARNING | Line exceeds 80 characters; contains 116 characters
10 | WARNING | Line exceeds 80 characters; contains 119 characters
19 | WARNING | Line exceeds 80 characters; contains 100 characters
----------------------------------------------------------------------

FILE: D:\xampp\htdocs\drupal_10\web\modules\contrib\site24x7\site24x7.module
----------------------------------------------------------------------------------
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: D:\xampp\htdocs\drupal_10\web\modules\contrib\site24x7\src\Form\SettingsForm.php
--------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
23 | ERROR | [x] Expected 1 blank line after function; 2 found
34 | ERROR | [x] @inheritDoc found. Did you mean {@inheritDoc}?
80 | ERROR | [x] @inheritDoc found. Did you mean {@inheritDoc}?
--------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------

Steps to reproduce

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

Proposed resolution

Above error/warnings need to be fixed:

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Closed: won't fix

Component

Code

Created by

🇮🇳India arti_parmar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @arti_parmar
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Status changed to Closed: won't fix over 1 year ago
  • 🇬🇧United Kingdom pobster

    Uhhhh thanks, but you seem to have your CS set up weirdly - the only genuine ones on here are;

    FILE: ...w/html/app/web/modules/custom/site24x7/src/Form/SettingsForm.php
    ----------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    ----------------------------------------------------------------------
     23 | ERROR | [x] Expected 1 blank line after function; 2 found
     34 | ERROR | [x] @inheritDoc found. Did you mean {@inheritDoc}?
     80 | ERROR | [x] @inheritDoc found. Did you mean {@inheritDoc}?
    ----------------------------------------------------------------------
    PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------
    

    The bottom two are because PHPStorm oddly defaults to that when making method stubs :(

    I'm afraid I can't merge your patch as-is, as I'm going to change the JS today more than likely. And ... also you have some mistakes here, namely all the javascript ones: https://www.drupal.org/forum/support/module-development-and-code-questio...

    Looking specifically at 2. there:

    > 2. TRUE, FALSE, NULL are not valid in JavaScript and their lower-case equivalents must be used instead.

    I'm going to close this as this is a development version for a reason. I only pushed it late last night, I mean - I haven't even tested it at all yet.

Production build 0.71.5 2024