Fix issues reported by phpcs

Created on 7 June 2024, 6 months ago
Updated 12 July 2024, 4 months ago

Problem/Motivation

FILE: .../custom/flysystem_sftp-3453298/src/Tests/ModuleInstallUninstallWebTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
| | with a file doc comment
| | (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...p-3453298/web/modules/custom/flysystem_sftp-3453298/src/Flysystem/Sftp.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
| | with a file doc comment
| | (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
73 | ERROR | [x] Use null coalesce operator instead of ternary operator.
| | (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
75 | ERROR | [x] Closing parenthesis of array declaration must be on a new
| | line (Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine)
85 | ERROR | [x] Use null coalesce operator instead of ternary operator.
| | (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
87 | ERROR | [x] Closing parenthesis of array declaration must be on a new
| | line (Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 123ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE ERRORS WARNINGS
--------------------------------------------------------------------------------
...odules/custom/flysystem_sftp-3453298/src/Flysystem/Sftp.php 5 0
...em_sftp-3453298/src/Tests/ModuleInstallUninstallWebTest.php 1 0
--------------------------------------------------------------------------------
A TOTAL OF 6 ERRORS AND 0 WARNINGS WERE FOUND IN 2 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 6 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
SOURCE COUNT
--------------------------------------------------------------------------------
[x] Drupal.Commenting.FileComment.NamespaceNoFileDoc 2
[x] SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator. 2
[x] Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine 2
--------------------------------------------------------------------------------
A TOTAL OF 6 SNIFF VIOLATIONS WERE FOUND IN 3 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SOURCES AUTOMATICALLY (6 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cbfannin

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

Merge Requests

Comments & Activities

  • Issue created by @cbfannin
  • πŸ‡ΊπŸ‡ΈUnited States cbfannin
  • Merge request !5fix: phpcbf auto fixes β†’ (Merged) created by cbfannin
  • Pipeline finished with Success
    6 months ago
    Total: 144s
    #194082
  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States cbfannin

    Ran phpcbf and committed changes. phpcs is passing now.

  • πŸ‡΅πŸ‡­Philippines clarkssquared

    Hi

    I applied the MR !5 and I confirmed that most of the PHPCS issues were fixed. However, there is 1 phpcs issue that remains in the module

    ➜  flysystem_sftp git:(8.x-1.x) curl https://git.drupalcode.org/project/flysystem_sftp/-/merge_requests/5.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1832    0  1832    0     0   3670      0 --:--:-- --:--:-- --:--:--  3716
    patching file 'src/Flysystem/Sftp.php'
    patching file 'src/Tests/ModuleInstallUninstallWebTest.php'
    ➜  flysystem_sftp git:(8.x-1.x) βœ— ..
    ➜  contrib git:(master) βœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml flysystem_sftp
    
    FILE: ...-subing/Projects/d9/d9-local/web/modules/contrib/flysystem_sftp/README.txt
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     16 | WARNING | Line exceeds 80 characters; contains 84 characters
    --------------------------------------------------------------------------------
    
    Time: 247ms; Memory: 10MB
    
    ➜  contrib git:(master) βœ— 

    Retaining the status to needs review for other to replicate the same PHPCS issue I reported.

  • Status changed to RTBC 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    @clarkssquared,

    So, as a heads up, This module is using the default Gitlab CI for Drupal template. You can see it's installation as part of the repository, and the instructions used to install it can be found here: https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... β†’ .

    That said, the phpcs.xml.dist used by the default CI is located here: https://git.drupalcode.org/project/gitlab_templates/-/blob/main/assets/p...

    The command you used to check coding standards would not be equivalent to what was checked by CI, but goes above and beyond adding the DrupalPractice standards and additional file types.

    While I appreciate any contributions that correct coding standards, Charles has satisfied my criteria for marking this task as complete. I'll leave the issue open for a few more days, as if you wish to receive credit for this issue, you will make the code changes you suggest need to be made as a Merge Request. If you wish, you may even add a custom phpcs.xml.dist that holds this module to the higher standards as a value add and ensure that Gitlab CI passes.

    Thanks

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck

    clarkssquared,
    I'm going to go ahead an merge the changes from cbfannin. If you by any chance wish to contribute fixes in the future for coding standards, feel free to open a new issue

  • Pipeline finished with Skipped
    5 months ago
    #210873
  • Status changed to Fixed 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024