GitLabCI: Fix existing PHPCS issues

Created on 26 June 2024, 8 months ago

Problem/Motivation

$ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source $_PHPCS_EXTRA
FILE: ...r/web/modules/custom/config_provider/src/ConfigProviderConfigInstaller.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
  9 | ERROR   | [x] Missing class doc comment
    |         |     (Drupal.Commenting.ClassComment.Missing)
 16 | ERROR   | [x] Data types in @param tags need to be fully namespaced
    |         |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
 19 | ERROR   | [x] Parameter comment indentation must be 3 spaces, found 2
    |         |     spaces
    |         |     (Drupal.Commenting.FunctionComment.ParamCommentIndentation)
 34 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
    |         |     (Drupal.Commenting.InlineVariableComment.VarInline)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...er/web/modules/custom/config_provider/src/Plugin/ConfigProviderManager.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Cache\CacheBackendInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../web/modules/custom/config_provider/src/Plugin/ConfigProviderInterface.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
 17 | ERROR | [ ] Doc comment short description must be on a single line,
    |       |     further text should be a separate paragraph
    |       |     (Drupal.Commenting.DocComment.ShortSingleLine)
 44 | ERROR | [ ] Parameter $active_storage is not described in comment
    |       |     (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
 47 | ERROR | [ ] Doc comment for parameter $storage does not match actual
    |       |     variable name $active_storage
    |       |     (Drupal.Commenting.FunctionComment.ParamNameNoMatch)
 68 | ERROR | [ ] Parameter $config_to_create is not described in comment
    |       |     (Drupal.Commenting.FunctionComment.ParamMissingDefinition)
 78 | ERROR | [x] Data types in @param tags need to be fully namespaced
    |       |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...vider/web/modules/custom/config_provider/src/Plugin/ConfigProviderBase.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
--------------------------------------------------------------------------------
 208 | ERROR   | [x] list(...) is forbidden, use [...] instead.
     |         |     (SlevomatCodingStandard.PHP.ShortList.LongListUsed)
 222 | ERROR   | [x] Case breaking statements must be followed by a single
     |         |     blank line
     |         |     (Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak)
 252 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
     |         |     (Drupal.Commenting.InlineVariableComment.VarInline)
 269 | ERROR   | [ ] Missing parameter type
     |         |     (Drupal.Commenting.FunctionComment.MissingParamType)
 272 | ERROR   | [ ] Missing parameter type
     |         |     (Drupal.Commenting.FunctionComment.MissingParamType)
 299 | WARNING | [ ] Line exceeds 80 characters; contains 84 characters
     |         |     (Drupal.Files.LineLength.TooLong)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...provider/web/modules/custom/config_provider/src/Plugin/ConfigCollector.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  87 | ERROR   | [ ] The trigger_error message 'Install profile will be a
     |         |     mandatory parameter in Drupal 9.0.' does not match the
     |         |     relaxed standard format: %thing% is deprecated in
     |         |     %deprecation-version% any free text %removal-version%.
     |         |     %extra-info%. See %cr-link%
     |         |     (Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed)
 117 | WARNING | [x] Inline @var declarations should use the /** */ delimiters
     |         |     (Drupal.Commenting.InlineVariableComment.VarInline)
 143 | ERROR   | [x] Expected 1 newline at end of file; 2 found
     |         |     (Drupal.Files.EndFileNewline.TooMany)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ustom/config_provider/src/Plugin/ConfigProvider/ConfigProviderOptional.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  6 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
  7 | ERROR   | [x] Use statements should be sorted alphabetically. The first
    |         |     wrong one is
    |         |     Drupal\Core\Config\Entity\ConfigDependencyManager.
    |         |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
 66 | ERROR   | [x] Expected 1 space after FUNCTION keyword; 0 found
    |         |     (Drupal.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 193ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
...ustom/config_provider/src/ConfigProviderConfigInstaller.php  3       1
...dules/custom/config_provider/src/Plugin/ConfigCollector.php  2       1
...es/custom/config_provider/src/Plugin/ConfigProviderBase.php  4       2
...stom/config_provider/src/Plugin/ConfigProviderInterface.php  5       0
...custom/config_provider/src/Plugin/ConfigProviderManager.php  1       0
...ovider/src/Plugin/ConfigProvider/ConfigProviderOptional.php  2       1
--------------------------------------------------------------------------------
A TOTAL OF 17 ERRORS AND 5 WARNINGS WERE FOUND IN 13 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 14 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
    SOURCE                                                                 COUNT
--------------------------------------------------------------------------------
[x] Drupal.Commenting.InlineVariableComment.VarInline                      3
[x] Drupal.Commenting.DataTypeNamespace.DataTypeNamespace                  2
[ ] Drupal.Commenting.FunctionComment.MissingParamType                     2
[ ] Drupal.Commenting.FunctionComment.ParamMissingDefinition               2
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.Incorrectl  2
[x] Drupal.Classes.UnusedUseStatement.UnusedUse                            1
[x] Drupal.Commenting.ClassComment.Missing                                 1
[ ] Drupal.Commenting.DocComment.ShortSingleLine                           1
[x] Drupal.Commenting.FunctionComment.ParamCommentIndentation              1
[ ] Drupal.Commenting.FunctionComment.ParamNameNoMatch                     1
[x] Drupal.Files.EndFileNewline.TooMany                                    1
[ ] Drupal.Files.LineLength.TooLong                                        1
[x] Drupal.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction       1
[ ] Drupal.Semantics.FunctionTriggerError.TriggerErrorTextLayoutRelaxed    1
[x] SlevomatCodingStandard.PHP.ShortList.LongListUsed                      1
[x] Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak            1
--------------------------------------------------------------------------------
A TOTAL OF 22 SNIFF VIOLATIONS WERE FOUND IN 16 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SOURCES AUTOMATICALLY (14 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇺🇸United States joegraduate Arizona, USA

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

Merge Requests

Comments & Activities

  • Issue created by @joegraduate
  • Issue was unassigned.
  • Status changed to Needs review 8 months ago
  • 🇺🇸United States joegraduate Arizona, USA
  • 🇺🇸United States joegraduate Arizona, USA

    Decided it'd be easier to tackle PHPCS and PHPStan issues together since there is some overlap.

  • 🇺🇸United States joegraduate Arizona, USA

    Moved method deprecations changes to 📌 Deprecate ConfigProviderBase drupalGetPath() and drupalGetProfile() methods Active .

  • Pipeline finished with Success
    19 days ago
    Total: 174s
    #401376
  • 🇵🇭Philippines paraderojether

    Hi

    I reviewed MR!9, and confirmed PHPCS & PHPStan issues are fixed on the Gitlab CI

    However, I noticed a phpcs issue using PHP_CodeSniffer:

    ➜  contrib git:(main) ✗ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig config_provider
    
    FILE: /Users/jetherparadero/Q1/q1contributions/web/modules/contrib/config_provider/src/ConfigProviderConfigInstaller.php
    -------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------------
     12 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\config_provider\Plugin\ConfigCollectorInterface.
    -------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/jetherparadero/Q1/q1contributions/web/modules/contrib/config_provider/src/Plugin/ConfigCollector.php
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\StorageInterface.
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    Time: 391ms; Memory: 10MB

    Command used: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig config_provider

    Kindly check and advise, please.
    Thank you.

  • 🇮🇳India akulsaxena

    Hi @paraderojether
    Since Gitlab CI has been added to Drupal, It is used to find errors for coding standards. If the pipeline is passing, re-run the pipeline to test that it is passing and if the job succeeds, the standards are considered correct.
    You can re-run the pipeline on this issue and if it passes, feel free to move it to RTBC+

  • 🇺🇸United States joegraduate Arizona, USA
  • 🇺🇸United States trackleft2 Tucson, AZ 🇺🇸

    All tests are passing, additionally, the gitlab-ci.yml update and dependency injection updates look good to me.

    • joegraduate committed 932a457a on 3.0.x
      Issue #3457459 by joegraduate, paraderojether, akulsaxena, trackleft2:...
  • 🇺🇸United States joegraduate Arizona, USA

    Thanks all. Merged.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024