Fix coding standards

Created on 19 May 2024, about 1 month ago
Updated 2 June 2024, 24 days ago

Problem/Motivation

Adding the GitLab CI template identified several coding standards issues:

--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\datetime_testing\TestTime.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../web/modules/custom/datetime_testing/tests/src/Kernel/TestDateTimeTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 7 | WARNING | [x] Unused use statement
   |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ng/web/modules/custom/datetime_testing/tests/src/Kernel/PinnedTimeTest.php
--------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
--------------------------------------------------------------------------------
  8 | ERROR | [x] Use statements should be sorted alphabetically. The first
    |       |     wrong one is Drupal\datetime_testing\TestTime.
    |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
 58 | ERROR | [ ] Missing member variable doc comment
    |       |     (Drupal.Commenting.VariableComment.Missing)
 59 | ERROR | [ ] Missing member variable doc comment
    |       |     (Drupal.Commenting.VariableComment.Missing)
 60 | ERROR | [ ] Missing member variable doc comment
    |       |     (Drupal.Commenting.VariableComment.Missing)
 61 | ERROR | [ ] Missing member variable doc comment
    |       |     (Drupal.Commenting.VariableComment.Missing)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...stom/datetime_testing/tests/src/Functional/TestDatetimeTestingCommands.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 3 | ERROR   | [x] Expected strict_types=1, found strict_types = 1.
   |         |     (SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat)
 7 | WARNING | [x] Unused use statement
   |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: .../datetime_testing/web/modules/custom/datetime_testing/src/TestDateTime.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 5 LINES
--------------------------------------------------------------------------------
   6 | ERROR   | [x] Use statements should be sorted alphabetically. The first
     |         |     wrong one is Drupal\Component\Datetime\DateTimePlus.
     |         |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
  19 | WARNING | [ ] Line exceeds 80 characters; contains 149 characters
     |         |     (Drupal.Files.LineLength.TooLong)
 115 | ERROR   | [ ] Missing parameter comment
     |         |     (Drupal.Commenting.FunctionComment.MissingParamComment)
 116 | ERROR   | [ ] Missing parameter comment
     |         |     (Drupal.Commenting.FunctionComment.MissingParamComment)
 118 | ERROR   | [ ] Description for the @return value is missing
     |         |     (Drupal.Commenting.FunctionComment.MissingReturnComment)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...eb/modules/custom/datetime_testing/src/Drush/Commands/TestTimeCommands.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
 3 | ERROR | [x] Expected strict_types=1, found strict_types = 1.
   |       |     (SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTypesFormat)
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Datetime\DrupalDateTime.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 236ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE                                                            ERRORS  WARNINGS
--------------------------------------------------------------------------------
...ng/web/modules/custom/datetime_testing/src/TestDateTime.php  4       1
...om/datetime_testing/src/Drush/Commands/TestTimeCommands.php  2       0
...esting/tests/src/Functional/TestDatetimeTestingCommands.php  1       1
...custom/datetime_testing/tests/src/Kernel/PinnedTimeTest.php  5       0
...stom/datetime_testing/tests/src/Kernel/TestDateTimeTest.php  0       1
...stom/datetime_testing/tests/src/Kernel/UnpinnedTimeTest.php  1       0
--------------------------------------------------------------------------------
A TOTAL OF 13 ERRORS AND 3 WARNINGS WERE FOUND IN 10 FILES
--------------------------------------------------------------------------------
PHPCBF CAN FIX 8 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
--------------------------------------------------------------------------------
    SOURCE                                                                 COUNT
--------------------------------------------------------------------------------
[ ] Drupal.Commenting.VariableComment.Missing                              4
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.Incorrectl  4
[x] Drupal.Classes.UnusedUseStatement.UnusedUse                            2
[ ] Drupal.Commenting.FunctionComment.MissingParamComment                  2
[x] SlevomatCodingStandard.TypeHints.DeclareStrictTypes.IncorrectStrictTy  2
[ ] Drupal.Commenting.FunctionComment.MissingReturnComment                 1
[ ] Drupal.Files.LineLength.TooLong                                        1
--------------------------------------------------------------------------------
A TOTAL OF 16 SNIFF VIOLATIONS WERE FOUND IN 7 SOURCES
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SOURCES AUTOMATICALLY (8 VIOLATIONS IN TOTAL)
--------------------------------------------------------------------------------

Let's fix these.

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΅Japan ptmkenny

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024