Fix the issues reported by phpcs

Created on 19 May 2023, almost 2 years ago

Problem/Motivation

Module's code contains several Drupal Coding Standards issues. This task is created to fix them.

Steps to reproduce

Run the command:

phpcs --standard=Drupal web/modules/contrib/published_referenced_entity/
phpcs --standard=DrupalPractice web/modules/contrib/published_referenced_entity/

Proposed resolution

Fix the following coding standards issues and upload the patch or create an MR with fixes.

FILE: C:\modules\contrib\published_referenced_entity\src\Plugin\Field\FieldFormatter\PublishedEntityIdFormatter.php
---------------------------------------------------------------------------------
FOUND 8 ERRORS AFFECTING 7 LINES
---------------------------------------------------------------------------------
  1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
 33 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
 34 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
 38 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
 39 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
 42 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
 42 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 43 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
---------------------------------------------------------------------------------


FILE: C:\modules\contrib\published_referenced_entity\src\Plugin\Field\FieldFormatter\PublishedEntityLabelFormatter.php
---------------------------------------------------------------------------------
FOUND 16 ERRORS AFFECTING 15 LINES
----------------------------------------------------------------------------------
   1 | ERROR | [x] End of line character is invalid; expected "\n" but found "\r\n"
  68 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
  69 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
  73 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
  74 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
  77 | ERROR | [x] Line indented incorrectly; expected 10 spaces, found 8
  77 | ERROR | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  78 | ERROR | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
  83 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 6
  84 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 6
  90 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
  91 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
  92 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
  93 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
 109 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
 110 | ERROR | [x] Line indented incorrectly; expected 12 spaces, found 10
-----------------------------------------------------------------------------


FILE: C:\modules\contrib\published_referenced_entity\src\Plugin\Field\FieldFormatter\PublishedRenderedEntityFormatter.php
-----------------------------------------------------------------------------
FOUND 10 ERRORS AND 1 WARNING AFFECTING 10 LINES
-----------------------------------------------------------------------------
   1 | ERROR   | [x] End of line character is invalid; expected "\n" but found "\r\n"
  15 | WARNING | [ ] Line exceeds 80 characters; contains 87 characters
  64 | ERROR   | [ ] The @var tag must be the first tag in a member variable comment
 167 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 8
 168 | ERROR   | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
 172 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 8
 173 | ERROR   | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
 176 | ERROR   | [x] Line indented incorrectly; expected 10 spaces, found 8
 176 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 177 | ERROR   | [x] Case breaking statement indented incorrectly; expected 10 spaces, found 8
 179 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
-----------------------------------------------------------------------------
๐Ÿ“Œ Task
Status

Active

Version

1.1

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Shanu Chouhan

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

  • Issue created by @Shanu Chouhan
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Shanu Chouhan

    Here's a patch for it.

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines kenyoOwen

    Hi Shanu Chouhan

    After applying the patch it still found errors

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

    FILE: /Users/studenttrainees/Project10/drupalorg10/docroot/modules/contrib/published_referenced_entity/published_referenced_entity.module
    -----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 18 ERRORS AFFECTING 10 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------
    1 | ERROR | [x] Missing file doc comment
    11 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    11 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
    12 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    12 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 2
    13 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    13 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 2
    14 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    14 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 2
    15 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    15 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 2
    16 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    16 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 2
    17 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    17 | ERROR | [x] Case breaking statement indented incorrectly; expected 4 spaces, found 2
    18 | ERROR | [x] Spaces must be used to indent lines; tabs are not allowed
    18 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found 1
    19 | ERROR | [x] Expected 1 newline at end of file; 2 found
    -----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------

    FILE: /Users/studenttrainees/Project10/drupalorg10/docroot/modules/contrib/published_referenced_entity/published_referenced_entity.info.yml
    -------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
    -------------------------------------------------------------------------------------------------------------------------------------------
    1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
    1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
    1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
    -------------------------------------------------------------------------------------------------------------------------------------------

    Time: 197ms; Memory: 10MB

  • Assigned to dineshkumarbollu
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    Hi

    I will work on remaining,

  • @dineshkumarbollu opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia dineshkumarbollu

    Hi

    I created MR for the remaining issues

    Please Review,

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    If the report shown in the issue summary does not show all the warnings/errors reported by phpcs, the report in the issue summary must be updated. That is helpful to verify the patch/MR fixes all the warnings/errors.

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Fixed 3 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ตNepal sujan shrestha Kathmandu๐Ÿ‡ณ๐Ÿ‡ต, Nepal

    Thank you! The issues reported by PHPCS have been fixed.

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

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
Production build 0.71.5 2024