Coding Standards issues

Created on 27 April 2023, almost 2 years ago
Updated 28 April 2023, almost 2 years ago

Problem/Motivation

Hi, phpcs shows some issues in the code.

~/vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml xero_sync

FILE: /Users/smovs/projects/drupal-org/xero_sync/tests/src/Unit/SynchronizerTest.php
------------------------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 6 LINES
------------------------------------------------------------------------------------
297 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
297 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
298 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
298 | ERROR | [x] Line indented incorrectly; expected at least 6 spaces, found 4
298 | ERROR | [x] Array indentation error, expected 5 spaces but found 4
299 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
343 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
343 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 3
344 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
344 | ERROR | [x] Line indented incorrectly; expected at least 6 spaces, found 4
344 | ERROR | [x] Array indentation error, expected 5 spaces but found 4
345 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------

FILE: /Users/smovs/projects/drupal-org/xero_sync/tests/src/Unit/TestItemFinder.php
----------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------------------
64 | WARNING | Possible useless method overriding detected
71 | WARNING | Possible useless method overriding detected
78 | WARNING | Possible useless method overriding detected
85 | WARNING | Possible useless method overriding detected
----------------------------------------------------------------------------------

FILE: /Users/smovs/projects/drupal-org/xero_sync/tests/src/Unit/QueueJobTest.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------
162 | WARNING | [x] There must be no blank line following an inline comment
172 | ERROR | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing
| | parentheses
209 | WARNING | [x] There must be no blank line following an inline comment
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...sync/modules/xero_sync_user_contact/tests/modules/xero_sync_user_contact_test/xero_sync_user_contact_test.info.yml
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
7 | ERROR | [x] Expected 1 newline at end of file; 2 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: ...vs/projects/drupal-org/xero_sync/modules/xero_sync_user_contact/tests/src/Kernel/AdvancedQueuingProcessingTest.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
131 | ERROR | The array declaration extends to column 119 (the limit is 80). The array content should be split up over
| | multiple lines
------------------------------------------------------------------------------------------------------------------------

FILE: ...sers/smovs/projects/drupal-org/xero_sync/modules/xero_sync_user_contact/tests/src/Kernel/QueuingProcessingTest.php
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
------------------------------------------------------------------------------------------------------------------------
289 | WARNING | Line exceeds 80 characters; contains 118 characters
290 | WARNING | Line exceeds 80 characters; contains 86 characters
410 | WARNING | Line exceeds 80 characters; contains 86 characters
546 | ERROR | The array declaration extends to column 85 (the limit is 80). The array content should be split up
| | over multiple lines
------------------------------------------------------------------------------------------------------------------------

FILE: /Users/smovs/projects/drupal-org/xero_sync/modules/xero_sync_user_contact/xero_sync_user_contact.services.yml
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
14 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------

FILE: ...projects/drupal-org/xero_sync/modules/xero_sync_user_contact/src/Plugin/CommerceXero/processor/CustomerContact.php
------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
75 | ERROR | [x] Incorrect spacing between argument "$strategy" and equals sign; expected 1 but found 0
75 | ERROR | [x] Incorrect spacing between default value and equals sign for argument "$strategy"; expected 1 but
| | found 0
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------

FILE: /Users/smovs/projects/drupal-org/xero_sync/src/XeroSyncQueueJobTrait.php
------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------
264 | ERROR | [x] Use null coalesce operator instead of ternary operator.
265 | ERROR | [x] Use null coalesce operator instead of ternary operator.
------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------

FILE: /Users/smovs/projects/drupal-org/xero_sync/src/XeroSyncItemFinder.php
---------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------
109 | ERROR | [x] Use null coalesce operator instead of ternary operator.
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine SmovS Lutsk

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

Comments & Activities

  • Issue created by @SmovS
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update almost 2 years ago
    Waiting for branch to pass
  • @smovs opened merge request.
  • πŸ‡ΊπŸ‡¦Ukraine SmovS Lutsk

    Hi!
    I've fixed most phpcs issues.
    I am not sure of the main goal to create functions that return parent's methods and necessarily for comments in QueuingProcessingTest.php. I've left these ones warnings. Let me know if it should be fixed as well.

     ~/vendor/bin/phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml xero_sync
    
    FILE: /Users/smovs/projects/drupal-org/xero_sync/tests/src/Unit/TestItemFinder.php
    ----------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
    ----------------------------------------------------------------------------------
     64 | WARNING | Possible useless method overriding detected
     71 | WARNING | Possible useless method overriding detected
     78 | WARNING | Possible useless method overriding detected
     85 | WARNING | Possible useless method overriding detected
    ----------------------------------------------------------------------------------
    
    
    FILE: ...sers/smovs/projects/drupal-org/xero_sync/modules/xero_sync_user_contact/tests/src/Kernel/QueuingProcessingTest.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    ------------------------------------------------------------------------------------------------------------------------
     289 | WARNING | Line exceeds 80 characters; contains 118 characters
     290 | WARNING | Line exceeds 80 characters; contains 86 characters
     410 | WARNING | Line exceeds 80 characters; contains 86 characters
    ------------------------------------------------------------------------------------------------------------------------
    
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡¦Ukraine SmovS Lutsk
  • Status changed to Fixed almost 2 years ago
  • πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

    Thanks! Merged. Sorry for not giving issue credit, I forgot to edit the MR commit message.

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

Production build 0.71.5 2024