Address PHPCS errors in gitlab-ci jobs

Created on 22 January 2025, 3 months ago

Problem/Motivation

When there are failing tests maintainership is slightly more difficult because you can't depend on the tests to catch new issues.

Steps to reproduce

See:

Proposed resolution

Address everything mentioned in this report.

FILE: ...ules/custom/easy_breadcrumb/tests/src/Kernel/EasyBreadcrumbBuilderTest.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 2 WARNINGS AFFECTING 8 LINES
--------------------------------------------------------------------------------
 231 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
     |         |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 232 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
     |         |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 232 | WARNING | [ ] Line exceeds 80 characters; contains 94 characters
     |         |     (Drupal.Files.LineLength.TooLong)
 233 | ERROR   | [x] Expected 5 space(s) before asterisk; 3 found
     |         |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 237 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true" (Generic.PHP.UpperCaseConstant.Found)
 272 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
     |         |     (Drupal.Files.LineLength.TooLong)
 277 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE"
     |         |     but found "true" (Generic.PHP.UpperCaseConstant.Found)
 312 | ERROR   | [x] Expected 1 blank line after function; 0 found
     |         |     (Squiz.WhiteSpace.FunctionSpacing.AfterLast)
 313 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
     |         |     (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...t/easy_breadcrumb/web/modules/custom/easy_breadcrumb/src/TitleResolver.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  74 | WARNING | [ ] Line exceeds 80 characters; contains 91 characters
     |         |     (Drupal.Files.LineLength.TooLong)
 103 | ERROR   | [x] Expected 1 blank line after function; 0 found
     |         |     (Squiz.WhiteSpace.FunctionSpacing.AfterLast)
 104 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
     |         |     (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 380ms; Memory: 12MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
...mb/web/modules/custom/easy_breadcrumb/src/TitleResolver.php  2       1
...tests/src/Functional/EasyBreadcrumbInstallUninstallTest.php  5       1
...y_breadcrumb/tests/src/Kernel/EasyBreadcrumbBuilderTest.php  7       2
--------------------------------------------------------------------------------
A TOTAL OF 14 ERRORS AND 4 WARNINGS WERE FOUND IN 11 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 14 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
---------------------------------------------------------------------------
    SOURCE                                                            COUNT
---------------------------------------------------------------------------
[ ] Drupal.Files.LineLength.TooLong                                   4
[x] Drupal.WhiteSpace.ScopeIndent.IncorrectExact                      4
[x] Drupal.Classes.ClassDeclaration.CloseBraceAfterBody               2
[x] Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar             2
[x] Generic.PHP.UpperCaseConstant.Found                               2
[x] Squiz.WhiteSpace.FunctionSpacing.AfterLast                        2
[x] Drupal.Commenting.PostStatementComment.Found                      1
[x] Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace  1
---------------------------------------------------------------------------
A TOTAL OF 18 SNIFF VIOLATIONS WERE FOUND IN 8 SOURCES
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SOURCES AUTOMATICALLY (14 VIOLATIONS IN TOTAL)
---------------------------------------------------------------------------

Remaining tasks

Add a merge request.
Update gitlab-ci.yml to disallow merging if tests are failing.

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ“Œ Task
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024