Fix coding standards

Created on 2 August 2024, 5 months ago
Updated 1 September 2024, 4 months ago

Problem/Motivation

We have the following issues.

eslint:

/builds/issue/videojs-3380089/web/modules/custom/videojs-3380089/config/schema/videojs.schema.yml
  2:1  error  Expected indentation of 2 spaces but found 4 spaces  yml/indent
  3:1  error  Expected indentation of 2 spaces but found 4 spaces  yml/indent
  4:1  error  Expected indentation of 4 spaces but found 6 spaces  yml/indent
  5:1  error  Expected indentation of 6 spaces but found 8 spaces  yml/indent
  6:1  error  Expected indentation of 6 spaces but found 8 spaces  yml/indent
  7:1  error  Expected indentation of 4 spaces but found 6 spaces  yml/indent
  8:1  error  Expected indentation of 6 spaces but found 8 spaces  yml/indent
  9:1  error  Expected indentation of 6 spaces but found 8 spaces  yml/indent
βœ– 8 problems (8 errors, 0 warnings)

phpstan:

  Line   src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php                    
 ------ ------------------------------------------------------------------------------ 
  77     Unsafe usage of new static().                                                 
         πŸ’‘ See:                                                                       
            https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ------------------------------------------------------------------------------ 
 [ERROR] Found 1 error

phpcs:

FILE: ...ojs-3380089/src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Field\FieldDefinitionInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ojs-3380089/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatterBase.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 16 | WARNING | Possible useless method overriding detected
    |         | (Generic.CodeAnalysis.UselessOverridingMethod.Found)
--------------------------------------------------------------------------------
FILE: ...videojs-3380089/src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Field\FieldDefinitionInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 154ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
.../src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php  1       0
.../Plugin/Field/FieldFormatter/VideoJsPlayerFormatterBase.php  0       1
.../Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php  1       0
--------------------------------------------------------------------------------
A TOTAL OF 2 ERRORS AND 1 WARNING WERE FOUND IN 5 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 2 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
    SOURCE                                                                 COUNT
--------------------------------------------------------------------------------
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.Incorrectl  2
[ ] Generic.CodeAnalysis.UselessOverridingMethod.Found                     1
--------------------------------------------------------------------------------
A TOTAL OF 3 SNIFF VIOLATIONS WERE FOUND IN 2 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SOURCES AUTOMATICALLY (2 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------
πŸ“Œ Task
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine _shy Ukraine, Lutsk πŸ‡ΊπŸ‡¦

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

Merge Requests

Comments & Activities

  • Issue created by @_shy
  • First commit to issue fork.
  • Merge request !15Issue #3465382 : Coding standards β†’ (Open) created by nfabing
  • Pipeline finished with Success
    4 months ago
    Total: 138s
    #269017
  • Status changed to Needs review 4 months ago
  • πŸ‡«πŸ‡·France nfabing

    Hi,

    Resolved all reported issues.
    You can review the MR.

  • πŸ‡΅πŸ‡­Philippines clarkssquared

    Hi

    I applied the MR !15 and tested the PHPCS and I noticed that there is 1 PHPCS remained after I applied your merge request

    ➜  videojs git:(3.x) curl https://git.drupalcode.org/project/videojs/-/merge_requests/15.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  8138    0  8138    0     0  13225      0 --:--:-- --:--:-- --:--:-- 13319
    patching file 'config/install/videojs.settings.yml'
    patching file 'config/schema/videojs.schema.yml'
    patching file 'src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatter.php'
    patching file 'src/Plugin/Field/FieldFormatter/VideoJsPlayerFormatterBase.php'
    patching file 'src/Plugin/Field/FieldFormatter/VideoJsPlayerListFormatter.php'
    patching file videojs.libraries.yml
    ➜  videojs git:(3.x) βœ— ..
    ➜  contrib git:(main) βœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml videojs 
    
    FILE: /Users/clarksubing-subing/Projects/d10/drupal_local/web/modules/contrib/videojs/README.md
    -----------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------
     157 | ERROR | [x] Expected 1 newline at end of file; 0 found
    -----------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------
    
    Time: 292ms; Memory: 10MB
    
    ➜  contrib git:(main) βœ— 
    
Production build 0.71.5 2024