Coding Standard Issues | PHPCS

Created on 6 January 2023, almost 2 years ago
Updated 10 September 2024, 3 months ago

Problem/Motivation

Getting Following errors/warning

FILE: ..._field_value/tests/src/Unit/FieldValue/FieldTargetEntityTest.php
----------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 8 LINES
----------------------------------------------------------------------
153 | ERROR | [ ] No key specified for array entry; first entry
| | specifies key
220 | ERROR | [x] Data types in @param tags need to be fully
| | namespaced
229 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
229 | ERROR | [x] Object operator not indented correctly; expected 6
| | spaces but found 4
230 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
231 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
233 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
233 | ERROR | [x] Object operator not indented correctly; expected 6
| | spaces but found 4
234 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
235 | ERROR | [x] Line indented incorrectly; expected 6 spaces,
| | found 4
----------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 1.13 secs; Memory: 12MB

Steps to reproduce

Run following command:

phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/twig_field_value/

Proposed resolution

Run following command:
phpcbf --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml modules/contrib/twig_field_value/

๐Ÿ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia shivam-kumar

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    Fixed The Failed Patch .

  • Status changed to Needs work almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia rajneeshb New Delhi

    Reviewed patch #3 there still one coding standard issue.
    Attaching screenshot for reference.

  • Status changed to Needs review almost 2 years ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Akram Khan Cuttack, Odisha

    added updated patch and fixed remaining issue

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

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

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    Thanks @Akram Khan for the updated patch, patch looks good, applies cleanly, and fixing all the php coding standard issues and warnings, attaching the Screenshot and Created MR for easy Merging.

  • Assigned to RohitRawat676
  • Status changed to Active over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia RohitRawat676

    Fixing Some Error

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 8 months ago
    Patch Failed to Apply
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia riddhi.addweb

    I have applied this "fixing_coding_standard-3331514-10.patch" cleanly, but some of the errors are still there.
    Please check the Screenshots for the same.

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi @sahil.goyal,

    I applied MR!3, it was applied smoothly and fixed most of the phpcs issues.

    However, I still encountered an issue after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    โžœ  twig_field_value git:(8.x-1.x) curl https://git.drupalcode.org/project/twig_field_value/-/merge_requests/3.diff | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 62382    0 62382    0     0   132k      0 --:--:-- --:--:-- --:--:--  132k
    patching file README.txt
    patching file src/Twig/Extension/FieldValueExtension.php
    patching file tests/modules/twig_field_value_test/src/Plugin/Field/FieldFormatter/EntityReferencesHiddenFieldFormatter.php
    patching file tests/modules/twig_field_value_test/src/Plugin/Field/FieldFormatter/EntityReferencesHiddenThirdChildFormatter.php
    patching file tests/modules/twig_field_value_test/src/Plugin/Field/FieldFormatter/StringHiddenFieldFormatter.php
    patching file tests/modules/twig_field_value_test/src/Plugin/Field/FieldFormatter/StringHiddenThirdChildFormatter.php
    patching file tests/modules/twig_field_value_test/twig_field_value_test.info.yml
    patching file tests/src/Kernel/FieldRawTest.php
    patching file tests/src/Kernel/FieldTargetEntityTest.php
    patching file tests/src/Kernel/FieldValueTest.php
    patching file tests/src/Unit/FieldValue/FieldRawValueTest.php
    patching file tests/src/Unit/FieldValue/FieldTargetEntityTest.php
    patching file tests/src/Unit/FieldValue/FieldValueTest.php
    patching file twig_field_value.info.yml
    patching file twig_field_value.services.yml
    โžœ  twig_field_value git:(8.x-1.x) โœ— ..
    โžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml twig_field_value
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php
    ----------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Access\AccessResultInterface.
    ----------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------
    
    Time: 788ms; Memory: 12MB
    
    โžœ  contrib
    

    Thank you.

  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ต๐Ÿ‡ญPhilippines cleavinjosh

    Hi,

    I fixed the issue that I encountered. Please review.

    Thank you.

  • Status changed to RTBC 5 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia riddhi.addweb

    The mentioned phpcs issue is resolved, & I have also checked and it is working as expected. I am attaching the Screenshots & doing RTBC for the same.

  • Status changed to Fixed 4 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Grevil
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024