Fix the PHP_CodeSniffer warnings/errors shown in GitLab CI tests

Created on 11 October 2023, about 1 year ago
Updated 6 June 2024, 5 months ago

The GitLab CI tests that runs for this module shows the following warnings/errors which should be fixed.

FILE: ...ntity/web/modules/custom/style_entity/tests/src/Kernel/StyleEntityTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 39 | ERROR | Description for the @return value is missing
    |       | (Drupal.Commenting.FunctionComment.MissingReturnComment)
--------------------------------------------------------------------------------
FILE: .../style_entity/web/modules/custom/style_entity/style_entity.post_update.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 14 | ERROR | Doc comment short description must be on a single line, further
    |       | text should be a separate paragraph
    |       | (Drupal.Commenting.DocComment.ShortSingleLine)
 42 | ERROR | Doc comment short description must be on a single line, further
    |       | text should be a separate paragraph
    |       | (Drupal.Commenting.DocComment.ShortSingleLine)
 65 | ERROR | Doc comment short description must be on a single line, further
    |       | text should be a separate paragraph
    |       | (Drupal.Commenting.DocComment.ShortSingleLine)
--------------------------------------------------------------------------------
FILE: ...s/project/style_entity/web/modules/custom/style_entity/style_entity.module
--------------------------------------------------------------------------------
FOUND 6 ERRORS AND 1 WARNING AFFECTING 5 LINES
--------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
    |         |     (Drupal.Commenting.FileComment.Missing)
 53 | WARNING | [ ] Line exceeds 80 characters; contains 82 characters
    |         |     (Drupal.Files.LineLength.TooLong)
 55 | ERROR   | [ ] Missing parameter comment
    |         |     (Drupal.Commenting.FunctionComment.MissingParamComment)
 55 | ERROR   | [ ] Missing parameter type
    |         |     (Drupal.Commenting.FunctionComment.MissingParamType)
 56 | ERROR   | [ ] Missing parameter comment
    |         |     (Drupal.Commenting.FunctionComment.MissingParamComment)
 56 | ERROR   | [ ] Missing parameter type
    |         |     (Drupal.Commenting.FunctionComment.MissingParamType)
 71 | ERROR   | [x] Use null coalesce operator instead of ternary operator.
    |         |     (SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator.NullCoalesceOperatorNotUsed)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...ustom/style_entity/src/Plugin/Field/FieldType/StyleEntityReferenceItem.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 21 | ERROR | The text '@deprecated in style_entity:2.0 and is removed in
    |       | style_entity:3.0. Use entity_reference FieldType instead.' does
    |       | not match the standard format: @deprecated in
    |       | %deprecation-version% and is removed from %removal-version%.
    |       | %extra-info%. (Drupal.Commenting.Deprecated.IncorrectTextLayout)
--------------------------------------------------------------------------------
FILE: .../custom/style_entity/src/Plugin/EntityReferenceSelection/UsesSelection.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The first
   |       |     wrong one is Drupal\Core\Entity\EntityTypeManagerInterface.
   |       |     (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses.IncorrectlyOrderedUses)
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
Time: 359ms; Memory: 6MB
šŸ“Œ Task
Status

RTBC

Version

2.0

Component

Code

Created by

šŸ‡®šŸ‡³India akshay_d Bangalore

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

Merge Requests

Comments & Activities

  • Issue created by @akshay_d
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • šŸ‡®šŸ‡³India sakthi_dev

    Fixed the issue from phpcs using command phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml. Please review.

  • Pipeline finished with Success
    about 1 year ago
    Total: 215s
    #29336
  • Status changed to Needs work about 1 year ago
  • šŸ‡®šŸ‡³India akshay_d Bangalore

    @sakthi_dev Thanks for working on the issue.

    I can still see some errors/warning on the phpcs pipeline build

    can we address that ?

    Thanks

  • First commit to issue fork.
  • Pipeline finished with Success
    about 1 year ago
    Total: 143s
    #39126
  • Status changed to Needs review about 1 year ago
  • šŸ‡®šŸ‡³India sarwan_verma

    Hi @akshay_d,
    I have fixed this issue "Fix the PHPCS errors reported for the project". created MR.
    please review and verify.

  • Status changed to RTBC 12 months ago
  • šŸ‡µšŸ‡­Philippines clarkssquared

    Hi

    I applied MR !7 and I confirmed that it fixes all the PHPCS issues and erros in the module

    āžœ  style_entity git:(2.x) curl https://git.drupalcode.org/project/style_entity/-/merge_requests/7.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5438    0  5438    0     0   9942      0 --:--:-- --:--:-- --:--:-- 10241
    patching file 'src/Plugin/EntityReferenceSelection/UsesSelection.php'
    patching file 'src/Plugin/Field/FieldType/StyleEntityReferenceItem.php'
    patching file style_entity.module
    patching file style_entity.post_update.php
    patching file 'tests/src/Kernel/StyleEntityTest.php'
    āžœ  style_entity git:(2.x) āœ— ..
    āžœ  contrib git:(master) āœ— phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml style_entity 
    āžœ  contrib git:(master) āœ— 
    
    
    
  • Status changed to Needs work 12 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    A summary must describe what needs to be changed, and eventually why. A screenshot is not sufficient, even in the case a patch/MR is provided.
    In the case of bug reports, the steps to reproduce the bug should be provided too. In the case of coding standards issues found using an automatic tool, the report given by that tool must be quoted too, including the arguments passed to that tool, if it is a command line tool.

    Also, please do not use a screenshot to show the report generated by PHP_CodeSniffer or other CLI tools.

  • šŸ‡®šŸ‡³India zkhan.aamir

    Issue summary updated

  • Assigned to nitin_lama
  • šŸ‡®šŸ‡³India nitin_lama India
  • šŸ‡®šŸ‡³India nitin_lama India

    There are still remaining issues that needs to get fixed. Updated the IS.

  • šŸ‡®šŸ‡³India nitin_lama India

    Providing the updated patch for 2.x

  • Pipeline finished with Success
    11 months ago
    Total: 143s
    #67523
  • šŸ‡®šŸ‡³India nitin_lama India

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 11 months ago
  • šŸ‡®šŸ‡³India nitin_lama India
  • šŸ‡®šŸ‡³India zkhan.aamir

    Hi,

    The patch #13 applied cleanly.
    All the errors are fixed.
    Please refer the screenshot.

  • Status changed to Needs work 10 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Also, the MR changes five files, while the report is only for one file. Either the report is not complete, or the MR is changing more files than necessary.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • First commit to issue fork.
  • Pipeline finished with Success
    10 months ago
    Total: 148s
    #85352
  • Pipeline finished with Success
    10 months ago
    Total: 240s
    #85592
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    10 months ago
    Total: 158s
    #85602
  • Status changed to Needs review 10 months ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • Pipeline finished with Success
    10 months ago
    Total: 150s
    #85610
  • Status changed to RTBC 5 months ago
  • šŸ‡®šŸ‡³India deepak5423

    I have applied !MR7 no phpcs found.
    It looks good to me.

Production build 0.71.5 2024