Fix the issue reported by phpcs

Created on 29 September 2023, about 1 year ago
Updated 3 October 2023, about 1 year ago

Problem/Motivation

Getting following error/warnings:

FILE: D:\xampp\htdocs\test\web\modules\contrib\labour_code_widgets\labour_code_widgets.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\test\web\modules\contrib\labour_code_widgets\README.md
----------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------
27 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------

FILE: D:\xampp\htdocs\test\web\modules\contrib\labour_code_widgets\src\Form\LabourCodeWidgetsSettingsForm.php
-------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
75 | WARNING | [x] A comma should follow the last multiline array item. Found: )
-------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\test\web\modules\contrib\labour_code_widgets\src\Helper\LabourCodeWidgetsHelper.php
---------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
88 | WARNING | [ ] Only string literals should be passed to t() where possible
108 | WARNING | [ ] Only string literals should be passed to t() where possible
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------

FILE: D:\xampp\htdocs\test\web\modules\contrib\labour_code_widgets\src\Helper\LabourCodeWidgetsHelperInterface.php
------------------------------------------------------------------------------------------------------------------
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\test\web\modules\contrib\labour_code_widgets\src\Plugin\Field\FieldFormatter\LabourCodeWidgetsFieldFormatter.php
--------------------------------------------------------------------------------------------------------------------------------------
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\test\web\modules\contrib\labour_code_widgets\src\Plugin\Field\FieldType\LabourCodeWidgetsItem.php
-----------------------------------------------------------------------------------------------------------------------
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
-----------------------------------------------------------------------------------------------------------------------

Steps to reproduce

Run following command:

phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml labour_code_widgets/

Proposed resolution

Above error/warnings need to be fixed.

📌 Task
Status

Fixed

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 about 1 year ago
  • 🇮🇳India arti_parmar

    Kindly review patch.

  • Status changed to RTBC about 1 year ago
  • Hello, @arti_parmar thanks for the patch

    These are the steps I followed:

    1. Took clone from git version 1.0.x in drupal 10.1.x

    2. Ran this command:

    ./vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig modules/contrib/labour_code_widgets/

    3. Applied your patch and, again ran phpcs command

    found no errors.

    Moving RTBC.

  • Hello, thank you for your review.

    I've run linters and I can't reproduce this error :
    ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"

    Files seems to have correct end of line (LF : \n)

    I've push a new commit which fix others errors like :

    1. A comma should follow the last multiline array item. Found: )
    2. Only string literals should be passed to t() where possible
    3. Expected 1 newline at end of file; 2 found
  • Hello, thanks you for the review.
    I've run linter and i can reproduce this error :
    ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"

    Files seems to have correct end of line (LF : \n)

    I've commit some changes which fix these errors :

    1. Only string literals should be passed to t() where possible
    2. Only string literals should be passed to t() where possible
    3. Expected 1 newline at end of file; 2 found
  • Status changed to Fixed about 1 year ago
  • Hello, thank you for the review.
    I've run linter and i can reproduce this error :
    ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"

    Files seems to have correct end of line (LF : \n)

    I've commit some changes which fix these errors :

    1. Only string literals should be passed to t() where possible
    2. Only string literals should be passed to t() where possible
    3. Expected 1 newline at end of file; 2 found
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024