Created on 1 May 2024, 8 months ago
Updated 20 June 2024, 6 months ago

Problem/Motivation

There are some minor PHPCS errors in the module

Steps to reproduce

Just run the command

phpcs {module path} --standard=Drupal,DrupalPractice --extensions=php,install,module,theme,inc
and got the following errors,

FILE: ...s/custom/upload_node_pictures/src/Form/UploadNodePictureForm.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 14 WARNINGS AFFECTING 12 LINES
----------------------------------------------------------------------
 125 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait
     |         | and $this->t() instead
 189 | WARNING | #options values usually have to run through t() for
     |         | translation
 198 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait
     |         | and $this->t() instead
 205 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 205 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 209 | WARNING | t() calls should be avoided in classes, use
     |         | \Drupal\Core\StringTranslation\StringTranslationTrait
     |         | and $this->t() instead
 229 | WARNING | Unused variable $inputFileType.
 264 | WARNING | File::load calls should be avoided in classes, use
     |         | dependency injection instead
 320 | WARNING | Unused variable $i.
 324 | WARNING | Unused variable $nids.
 324 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 336 | WARNING | Unused variable $i.
 339 | WARNING | \Drupal calls should be avoided in classes, use
     |         | dependency injection instead
 350 | WARNING | Node::load calls should be avoided in classes, use
     |         | dependency injection instead
----------------------------------------------------------------------
๐Ÿ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

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

Merge Requests

Comments & Activities

  • Issue created by @abhishek_virasat
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    Vishal Prasad โ†’ made their first commit to this issueโ€™s fork.

  • Assigned to vishal prasad
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    I will be solving this issue so assigning to myself.

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    @abhishek_gupta1 I have Raised the MR fixing the PHPCS issues, can you please review it
    MR Link

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines clarkssquared

    Hi,

    When reporting a PHPCS issues, please look at Apaderno's comment. ๐Ÿ› Fix the warnings/errors reported by PHP_CodeSniffer RTBC , Apaderno said in the comment:

    Since the issue is showing what PHP_CodeSniffer shows, let us rescope it to fix all the warnings/errors reported by PHP_CodeSniffer.
    
    The issue summary should always describe what the issue is trying to fix and, in the case of coding standards issues, show which command and arguments have been used and which report that command shown. In this way, project maintainers can verify the patch/MR fixes all the warnings/errors.

    I will move transition the issue to needs work so that the reporter can update it.

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    @clarkssquared i have updated the issue summary as per suggestion,
    please review

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines paraderojether

    Hi

    I reviewed MR!2, and confirmed phpcs issues listed on the description are fixed, however there are still phpcs issues remaining after running this command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig upload_node_pictures

    contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig upload_node_pictures
    
    FILE: /Users/jetherparadero/Q2_DO/q2_issues/web/modules/contrib/upload_node_pictures/README.md
    ----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 24 WARNINGS AFFECTING 24 LINES
    ----------------------------------------------------------------------------------------------
      1 | WARNING | [ ] Line exceeds 80 characters; contains 234 characters
      3 | WARNING | [ ] Line exceeds 80 characters; contains 117 characters
      5 | WARNING | [ ] Line exceeds 80 characters; contains 121 characters
      7 | WARNING | [ ] Line exceeds 80 characters; contains 127 characters
      9 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
     13 | WARNING | [ ] Line exceeds 80 characters; contains 109 characters
     14 | WARNING | [ ] Line exceeds 80 characters; contains 153 characters
     15 | WARNING | [ ] Line exceeds 80 characters; contains 128 characters
     16 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
     17 | WARNING | [ ] Line exceeds 80 characters; contains 105 characters
     18 | WARNING | [ ] Line exceeds 80 characters; contains 111 characters
     19 | WARNING | [ ] Line exceeds 80 characters; contains 86 characters
     20 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
     24 | WARNING | [ ] Line exceeds 80 characters; contains 135 characters
     28 | WARNING | [ ] Line exceeds 80 characters; contains 128 characters
     31 | WARNING | [ ] Line exceeds 80 characters; contains 132 characters
     34 | WARNING | [ ] Line exceeds 80 characters; contains 211 characters
     37 | WARNING | [ ] Line exceeds 80 characters; contains 221 characters
     40 | WARNING | [ ] Line exceeds 80 characters; contains 148 characters
     43 | WARNING | [ ] Line exceeds 80 characters; contains 211 characters
     46 | WARNING | [ ] Line exceeds 80 characters; contains 167 characters
     49 | WARNING | [ ] Line exceeds 80 characters; contains 169 characters
     52 | WARNING | [ ] Line exceeds 80 characters; contains 181 characters
     55 | WARNING | [ ] Line exceeds 80 characters; contains 215 characters
     55 | ERROR   | [x] Expected 1 newline at end of file; 0 found
    ----------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------
    
    Time: 218ms; Memory: 12MB

    Moving this needs work.

  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    Hello @paraderojether I have made the requested changes in the Readme file,
    i thought Readme file standards are not the Phpcs concern so i never added this extension for PHPCS check,

    well i added this extension too and made the required changes. Can you please review it

    Thanks!

  • Status changed to RTBC 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dev16.addweb

    Hi, I have tested phpcs issue, all issue are resolved. And also Node picture upload form working fine.

    addweb@addweb-HP-ZBook-15-G2:~$ .config/composer/vendor/squizlabs/php_codesniffer/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css Drupal8-vagrant/web/web/contribution/drupal-10-3/web/modules/custom/upload_node_picture/
    addweb@addweb-HP-ZBook-15-G2:~$
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    @paraderojether Can we review and merge it on priority?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal prasad

    status was set to priority by mistake

Production build 0.71.5 2024