Coding standards and best practices

Created on 27 January 2023, almost 2 years ago
Updated 24 April 2023, over 1 year ago

Problem/Motivation

FILE: ~/projects/drupal-d10/modules/contrib/s3fs/tests/fixtures/S3fsCssOptimizerMock.php
-------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------
 15 | WARNING | Unused variable $base_url.
-------------------------------------------------

FILE: ~/projects/drupal-d10/modules/contrib/s3fs/tests/src/Functional/S3fsTest.php
-------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
-------------------------------------------------
 152 | WARNING | Unused variable $s3_file_utf84b.
 161 | WARNING | Unused variable $s3_file_utf84b.
-------------------------------------------------

FILE: ~/projects/drupal-d10/modules/contrib/s3fs/tests/src/Functional/S3fsTestBase.php
-------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------
 126 | WARNING | Unused variable $result.
-------------------------------------------------

FILE: ~/projects/drupal-d10/modules/contrib/s3fs/README.txt
-------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------
 104 | WARNING | Line exceeds 80 characters; contains 81 characters
-------------------------------------------------

FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/S3fsService.php
-------------------------------------------------
FOUND 1 ERROR AND 15 WARNINGS AFFECTING 16 LINES
-------------------------------------------------
 272 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 281 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 451 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 476 | ERROR   | [x] No space found before comment text; expected "// record individually and report failures. We keep the existing record" but found
     |         |     "//record individually and report failures. We keep the existing record"
 480 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 577 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 597 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 598 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 605 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 614 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 615 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 616 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 677 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 686 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 691 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
 693 | WARNING | [ ] \Drupal calls should be avoided in classes, use dependency injection instead
-------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/Form/SettingsForm.php
---------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
---------------------------------------------------------------------------------------------------
 299 | WARNING | #options values usually have to run through t() for translation
 300 | WARNING | #options values usually have to run through t() for translation
 301 | WARNING | #options values usually have to run through t() for translation
---------------------------------------------------------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/Form/ActionsForm.php
--------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 10 WARNINGS AFFECTING 10 LINES
--------------------------------------------------------------------------------------------------
 151 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 193 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 194 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 229 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 245 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 259 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 278 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 328 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 341 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 351 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
--------------------------------------------------------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/Traits/S3fsPathsTrait.php
-------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------
  34 | ERROR | [x] Expected newline after closing brace
 123 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/PathProcessor/S3fsPathProcessorImageStyles.php
----------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------
 40 | ERROR | [x] list(...) is forbidden, use [...] instead.
----------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php
----------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 21 WARNINGS AFFECTING 21 LINES
----------------------------------------------------------------------------------------------------------
  155 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  178 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  180 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  193 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  217 | WARNING | Exceptions should not be translated
  396 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  404 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  459 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  701 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  741 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
  770 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1141 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1389 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1395 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1410 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1484 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1492 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1495 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1521 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1530 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
 1694 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
----------------------------------------------------------------------------------------------------------


FILE: ~/projects/drupal-d10/modules/contrib/s3fs/s3fs.module
-------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
-------------------------------------------------------------------------------------
 11 | WARNING | Global constants should not be used, move it to a class or interface
 12 | WARNING | Global constants should not be used, move it to a class or interface
 13 | WARNING | Global constants should not be used, move it to a class or interface
-------------------------------------------------------------------------------------

Time: 1.03 secs; Memory: 20MB


Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Closed: won't fix

Version

3.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Raghavendra A M

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

  • Issue created by @Raghavendra A M
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Raghavendra A M

    Hi, Uploading a patch for the fix.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cmlara
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cmlara
  • First commit to issue fork.
  • Assigned to vishaljd
  • @vishaljd opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    The issue summary should always describe what the issue is trying to fix and, in the case, of coding standards issues, report which command has been used, which arguments have been used, and which report that command shown.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rassoni Bangalore

    Reviewed MR below issues still pending

    FILE: ~/projects/drupal-d10/modules/contrib/s3fs/modules/s3fs_streamwrapper/tests/src/Kernel/S3fsBucketStreamWrapperTest.php
    ---------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------
     28 | WARNING | Unused variable $type.
    -------------------------------------------------------------------------
    
    
    FILE: ~/projects/drupal-d10/modules/contrib/s3fs/src/Form/ActionsForm.php
    --------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------
     239 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     290 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     373 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------
    
    Time: 1.66 secs; Memory: 18MB
    
    --------------------------------------------------------------------------
    ~/projects/drupal-d10/modules/contrib (10.1.x*) ยป phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml s3fs
    
    FILE:~/projects/drupal-d10/modules/contrib/s3fs/src/Form/ActionsForm.php
    --------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    --------------------------------------------------------------------------------------------------
     239 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     290 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
     373 | WARNING | \Drupal calls should be avoided in classes, use dependency injection instead
    --------------------------------------------------------------------------------------------------
    
    Time: 1.65 secs; Memory: 18MB
    
  • First commit to issue fork.
  • First commit to issue fork.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    134 pass, 21 fail
  • Assigned to akshaydalvi212
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia akshaydalvi212

    Removed the remaining issues reported with Phpcs,
    kindly review the MR.

  • Issue was unassigned.
  • Status changed to Closed: won't fix over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cmlara

    Closing as won't fix as this issue continues to bring patches that do not pass tests and do not take into consideration the current development status of the branch.

    Large parts of this are automated and as such can easily be done by the maintainer when they see fit. The remaining parts will largely be solved as more of the 4.x branch is fully implemented and phpstan levels on the code base are increased.

Production build 0.71.5 2024