Fix the PHP_CodeSniffer warnings/errors shown in GitLab CI tests

Created on 11 October 2023, 9 months ago
Updated 6 June 2024, 20 days 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 9 months 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
    9 months ago
    Total: 215s
    #29336
  • Status changed to Needs work 8 months 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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sarwan

    sarwan_verma โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    8 months ago
    Total: 143s
    #39126
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sarwan

    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 7 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 7 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

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    Providing the updated patch for 2.x

  • Pipeline finished with Success
    6 months ago
    Total: 143s
    #67523
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nitin_lama

    Please review.

  • Issue was unassigned.
  • Status changed to Needs review 6 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia zkhan.aamir

    Hi,

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

  • Status changed to Needs work 6 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
    5 months ago
    Total: 148s
    #85352
  • Pipeline finished with Success
    5 months ago
    Total: 240s
    #85592
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Success
    5 months ago
    Total: 158s
    #85602
  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Pipeline finished with Success
    5 months ago
    Total: 150s
    #85610
  • Status changed to RTBC 20 days ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia deepak5423

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

Production build 0.69.0 2024