Fix the issues reported by phpcs

Created on 9 January 2023, almost 2 years ago
Updated 26 October 2023, about 1 year ago

Problem/Motivation

$ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
FILE: ...tom/message_subscribe-3396691/tests/src/Unit/SubscribersTest.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 7 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
  7 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
  8 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 10 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 12 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 16 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 20 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 21 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ..._subscribe-3396691/tests/src/Kernel/MessageSubscribeTestBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Tests\message\Kernel\MessageTemplateCreateTrait.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...ustom/message_subscribe-3396691/tests/src/Kernel/ContextTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 10 | ERROR | [x] Use statements should be sorted alphabetically. The
    |       |     first wrong one is Drupal\og\Og.
    |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...6691/tests/src/Kernel/Form/MessageSubscribeAdminSettingsTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\KernelTests\ConfigFormTestBase.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...es/custom/message_subscribe-3396691/src/SubscribersInterface.php
----------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
----------------------------------------------------------------------
 62 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 63 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 64 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 67 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 68 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 70 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
 72 | ERROR | Long array syntax must not be used in doc comment code
    |       | annotations
    |       | (Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray)
----------------------------------------------------------------------
FILE: ...web/modules/custom/message_subscribe-3396691/src/Subscribers.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
 143 | ERROR | [x] Use null coalesce operator instead of ternary
     |       |     operator.
     |       |     (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
 144 | ERROR | [x] Use null coalesce operator instead of ternary
     |       |     operator.
     |       |     (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
 242 | ERROR | [ ] The array declaration extends to column 206 (the
     |       |     limit is 120). The array content should be split
     |       |     up over multiple lines
     |       |     (Drupal.Arrays.Array.LongLineDeclaration)
 274 | ERROR | [x] Use null coalesce operator instead of ternary
     |       |     operator.
     |       |     (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...age_subscribe_ui/tests/src/Functional/SubscriptionsBlockTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is Drupal\Tests\BrowserTestBase.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...-3396691/message_subscribe_ui/src/Plugin/Block/Subscriptions.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 235 | WARNING | [x] 'TODO: Implement validateForm() method.' should
     |         |     match the format '@todo Fix problem X here.'
     |         |     (Drupal.Commenting.TodoComment.TodoFormat)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...1/message_subscribe_ui/src/Controller/SubscriptionController.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 183 | ERROR | [x] list(...) is forbidden, use [...] instead.
     |       |     (SlevomatCodingStandard.PHP.ShortList.LongListUsed)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...96691/message_subscribe_example/message_subscribe_example.module
----------------------------------------------------------------------
FOUND 7 ERRORS AND 3 WARNINGS AFFECTING 7 LINES
----------------------------------------------------------------------
  10 | ERROR   | [x] Use statements should be sorted alphabetically.
     |         |     The first wrong one is
     |         |     Drupal\comment\Entity\Comment.
     |         |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
  13 | WARNING | [x] Unused use statement
     |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
  21 | WARNING | [ ] Hook implementations should not duplicate @param
     |         |     documentation
     |         |     (Drupal.Commenting.HookComment.HookParamDoc)
  24 | WARNING | [ ] Hook implementations should not duplicate @param
     |         |     documentation
     |         |     (Drupal.Commenting.HookComment.HookParamDoc)
  55 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 2
     |         |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
  55 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     4 spaces but found 2
     |         |     (Drupal.WhiteSpace.ObjectOperatorIndent.Indent)
  87 | ERROR   | [x] Line indented incorrectly; expected 6 spaces,
     |         |     found 4
     |         |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
  87 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     6 spaces but found 4
     |         |     (Drupal.WhiteSpace.ObjectOperatorIndent.Indent)
 198 | ERROR   | [x] Line indented incorrectly; expected 4 spaces,
     |         |     found 2
     |         |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 198 | ERROR   | [x] Object operator not indented correctly; expected
     |         |     4 spaces but found 2
     |         |     (Drupal.WhiteSpace.ObjectOperatorIndent.Indent)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...e-3396691/message_subscribe_email/message_subscribe_email.module
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 35 | WARNING | [x] 'TODO: Replace this with something cleaner once
    |         |     core provides it.' should match the format '@todo
    |         |     Fix problem X here.'
    |         |     (Drupal.Commenting.TodoComment.TodoFormat)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...96691/message_subscribe_email/tests/src/Functional/ViewsTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is Drupal\Tests\BrowserTestBase.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 620ms; Memory: 6MB
PHP CODE SNIFFER REPORT SUMMARY
----------------------------------------------------------------------
FILE                                                  ERRORS  WARNINGS
----------------------------------------------------------------------
...ge_subscribe_email/message_subscribe_email.module  0       1
...ubscribe_email/tests/src/Functional/ViewsTest.php  1       0
...ubscribe_example/message_subscribe_example.module  7       3
...ribe_ui/src/Controller/SubscriptionController.php  1       0
...e_subscribe_ui/src/Plugin/Block/Subscriptions.php  0       1
...i/tests/src/Functional/SubscriptionsBlockTest.php  1       0
...tom/message_subscribe-3396691/src/Subscribers.php  4       0
...ge_subscribe-3396691/src/SubscribersInterface.php  7       0
...ubscribe-3396691/tests/src/Kernel/ContextTest.php  1       0
...691/tests/src/Kernel/MessageSubscribeTestBase.php  1       0
...Kernel/Form/MessageSubscribeAdminSettingsTest.php  1       0
...scribe-3396691/tests/src/Unit/SubscribersTest.php  0       7
----------------------------------------------------------------------
A TOTAL OF 24 ERRORS AND 12 WARNINGS WERE FOUND IN 38 FILES
----------------------------------------------------------------------
PHPCBF CAN FIX 26 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
PHP CODE SNIFFER VIOLATION SOURCE SUMMARY
----------------------------------------------------------------------
    SOURCE                                                       COUNT
----------------------------------------------------------------------
[x] Drupal.Classes.UnusedUseStatement.UnusedUse                  8
[ ] Drupal.Commenting.DocCommentLongArraySyntax.DocLongArray     7
[x] SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.  6
[x] Drupal.WhiteSpace.ObjectOperatorIndent.Indent                3
[x] Drupal.WhiteSpace.ScopeIndent.IncorrectExact                 3
[x] SlevomatCodingStandard.ControlStructures.RequireNullCoalesc  3
[ ] Drupal.Commenting.HookComment.HookParamDoc                   2
[x] Drupal.Commenting.TodoComment.TodoFormat                     2
[ ] Drupal.Arrays.Array.LongLineDeclaration                      1
[x] SlevomatCodingStandard.PHP.ShortList.LongListUsed            1
----------------------------------------------------------------------
A TOTAL OF 36 SNIFF VIOLATIONS WERE FOUND IN 10 SOURCES
----------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SOURCES AUTOMATICALLY (26 VIOLATIONS IN TOTAL)
----------------------------------------------------------------------
$CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$CI_PROJECT_DIR/$_WEB_ROOT/core --ext=.js,.yml . || true
/builds/issue/message_subscribe-3396691/web/modules/custom/message_subscribe-3396691/message_subscribe_example/config/optional/core.entity_view_display.message.update_node.mail_body.yml
  10:1  error  Expected indentation of 4 spaces but found 5 spaces  yml/indent
/builds/issue/message_subscribe-3396691/web/modules/custom/message_subscribe-3396691/message_subscribe_example/config/optional/core.entity_view_display.message.update_node.mail_subject.yml
  10:1  error  Expected indentation of 4 spaces but found 5 spaces  yml/indent
โœ– 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

Steps to reproduce

Proposed resolution

Above error/warnings need to be fixed

๐Ÿ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia samit.310@gmail.com

Live updates comments and jobs are added and updated live.
  • Coding standards

    It involves compliance with, or the content of coding standards. Requires broad community agreement.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024