Fix the issues reported by phpcs

Created on 24 April 2023, over 1 year ago
Updated 3 July 2023, over 1 year ago

Problem/Motivation

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\media_twig_tools.module
----------------------------------------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
----------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
20 | ERROR | [x] Line indented incorrectly; expected 0 spaces, found 1
21 | ERROR | [x] Expected 2 space(s) before asterisk; 1 found
22 | ERROR | [x] Expected 2 space(s) before asterisk; 1 found
132 | ERROR | [x] list(...) is forbidden, use [...] instead.
134 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\readme.md
--------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------------
59 | WARNING | Line exceeds 80 characters; contains 109 characters
65 | WARNING | Line exceeds 80 characters; contains 85 characters
75 | WARNING | Line exceeds 80 characters; contains 86 characters
85 | WARNING | Line exceeds 80 characters; contains 171 characters
151 | WARNING | Line exceeds 80 characters; contains 199 characters
154 | WARNING | Line exceeds 80 characters; contains 204 characters
--------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Config\MediaTwigToolsConfig.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: ...:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Config\MediaTwigToolsConfigInterface.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
75 | ERROR | [x] Expected 1 blank line after function; 2 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\EventSubscribers\ImageBuilderEventSubscriber.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: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Form\SettingsForm.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"
187 | WARNING | [ ] Only string literals should be passed to t() where possible
------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Generators\ImageGenerator.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: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Services\ImageBuilder.php
----------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
83 | ERROR | [x] Use null coalesce operator instead of ternary operator.
84 | ERROR | [x] Use null coalesce operator instead of ternary operator.
323 | ERROR | [x] Use null coalesce operator instead of ternary operator.
----------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\src\Services\MediaTwigTools.php
------------------------------------------------------------------------------------------------------------
FOUND 25 ERRORS AND 2 WARNINGS AFFECTING 20 LINES
------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
203 | ERROR | [x] Use null coalesce operator instead of ternary operator.
210 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
211 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
211 | ERROR | [x] Use null coalesce operator instead of ternary operator.
212 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
212 | ERROR | [x] Use null coalesce operator instead of ternary operator.
213 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
213 | ERROR | [x] Use null coalesce operator instead of ternary operator.
214 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
215 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
215 | ERROR | [x] Use null coalesce operator instead of ternary operator.
216 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
216 | ERROR | [x] Use null coalesce operator instead of ternary operator.
217 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
217 | ERROR | [x] Use null coalesce operator instead of ternary operator.
218 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
218 | ERROR | [x] Use null coalesce operator instead of ternary operator.
219 | ERROR | [x] Array closing indentation error, expected 4 spaces but found 6
369 | ERROR | [x] list(...) is forbidden, use [...] instead.
447 | ERROR | [x] Use null coalesce operator instead of ternary operator.
488 | ERROR | [x] Use null coalesce operator instead of ternary operator.
642 | ERROR | [x] Use null coalesce operator instead of ternary operator.
668 | ERROR | [x] Use null coalesce operator instead of ternary operator.
669 | ERROR | [x] Use null coalesce operator instead of ternary operator.
699 | WARNING | [ ] Unused variable $dirsList.
715 | WARNING | [ ] Unused variable $a.
------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------

FILE: C:\xampp\htdocs\backendassignment\web\modules\contrib\media_twig_tools\tests\src\Unit\ImageBuilderTest.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
----------------------------------------------------------------------------------------------------------------

Time: 4.57 secs; Memory: 8MB

Steps to reproduce

Fix the issues reported by phpcs.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.1

Component

Code

Created by

🇮🇳India sidharth_soman Bangalore

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 @sidharth_soman
  • Status changed to Needs review over 1 year ago
  • 🇫🇷France tsecher

    Fixed in 2.1.0-rc1

  • 🇮🇳India arpitk

    I reviewed verision 2.1.0rc1. Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .

    All errors and warning are gone expect following.

    arpitkayare@Arpitk:~/drupal_9.5/web/modules/contrib/media_twig_tools$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml .

    FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/media_twig_tools/src/Form/SettingsForm.php
    -------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------
    211 | WARNING | Only string literals should be passed to t() where possible
    -------------------------------------------------------------------------------------------------

    FILE: /home/arpitkayare/drupal_9.5/web/modules/contrib/media_twig_tools/readme.md
    ---------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
    ---------------------------------------------------------------------------------
    59 | WARNING | Line exceeds 80 characters; contains 109 characters
    65 | WARNING | Line exceeds 80 characters; contains 85 characters
    75 | WARNING | Line exceeds 80 characters; contains 86 characters
    85 | WARNING | Line exceeds 80 characters; contains 171 characters
    151 | WARNING | Line exceeds 80 characters; contains 171 characters
    154 | WARNING | Line exceeds 80 characters; contains 176 characters
    ---------------------------------------------------------------------------------

    Thanks!

  • 🇫🇷France tsecher

    Thank you for the review. Fixed in 2.1.0-rc2

  • Issue was unassigned.
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇳India Akshay kashyap

    Added a patch to fix the warning message mentioned in #3

  • 🇮🇹Italy apaderno Brescia, 🇮🇹

    Just a note: $title = $this->t('@type', ['@type' => $type]); does not return the translation for $type. Translators will just see @type as text to translate, and they will translate it to @type.

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024