Fix the issues reported by phpcs

Created on 9 March 2023, over 1 year ago
Updated 21 August 2024, 4 months ago

Problem/Motivation

FILE: /Users/projects/drupal-d10/modules/contrib/media_entity_soundcloud/tests/src/Functional/SoundcloudEmbedFormatterTest.php
--------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------------------
 64 | WARNING | Unused variable $entity_display_repository.
--------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/media_entity_soundcloud/src/Form/SoundcloudForm.php
------------------------------------------------------------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------
 122 | ERROR | [x] Expected "void|true" but found "void|TRUE" for function return type
 122 | ERROR | [ ] @return doc comment specified, but function has no return statement
 122 | ERROR | [ ] Description for the @return value is missing
 152 | ERROR | [x] Expected 1 blank line after function; 0 found
 153 | ERROR | [x] The closing brace for the class must have an empty line before it
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------


FILE: /Users/projects/drupal-d10/modules/contrib/media_entity_soundcloud/src/Plugin/Field/FieldFormatter/SoundcloudEmbedFormatter.php
---------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
---------------------------------------------------------------------------------------------------------------------------------------------------------
  76 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
 162 | WARNING | Avoid backslash escaping in translatable strings when possible, use "" quotes instead
---------------------------------------------------------------------------------------------------------------------------------------------------------

Time: 145ms; Memory: 10MB

Steps to reproduce

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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

šŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

šŸ‡®šŸ‡³India rassoni 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 @rassoni
  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡³India Adil_Siddiqui

    Patch created

  • Assigned to indrapatil
  • šŸ‡®šŸ‡³India indrapatil Bangalore

    I am reviewing it

  • Issue was unassigned.
  • Status changed to RTBC over 1 year ago
  • šŸ‡®šŸ‡³India indrapatil Bangalore

    @Adil_Siddiqui patch applied successfully without errors, So moving to RTBC.

  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹

    Keep in mind that the correct issue tag for this issues is Coding standards.

  • Status changed to Needs work over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
    -    $entity_display_repository = \Drupal::service('entity_display.repository');
    -
    

    Since the test is using the following code, it is probably better to change the other lines, instead of removing that line.

        $entity_display_repository = \Drupal::service('entity_display.repository');
    
        $media_type = $this->createMediaType('soundcloud', ['id' => 'soundcloud']);
    
        $source_field = $media_type->getSource()->getSourceFieldDefinition($media_type);
        $this->assertSame('field_media_soundcloud', $source_field->getName());
        $this->assertSame('string', $source_field->getType());
    
        // Set form and view displays.
        \Drupal::service('entity_display.repository')->getFormDisplay('media', $media_type->id(), 'default')
          ->setComponent('field_media_soundcloud', [
            'type' => 'string_textfield',
          ])
          ->save();
    
        \Drupal::service('entity_display.repository')->getViewDisplay('media', $media_type->id(), 'full')
          ->setComponent('field_media_soundcloud', [
            'type' => 'soundcloud_embed',
          ])
          ->save();
    
  • šŸ‡®šŸ‡³India Adil_Siddiqui

    The below variable is not required as it is just declared and not used anywhere hence it is removed in the patch.

    -    $entity_display_repository = \Drupal::service('entity_display.repository');
    -
  • šŸ‡®šŸ‡³India kkalashnikov Ghaziabad, India

    Updated patch accordingly

  • Status changed to Needs review over 1 year ago
  • šŸ‡®šŸ‡¹Italy apaderno Brescia, šŸ‡®šŸ‡¹
  • šŸ‡®šŸ‡³India rajeshreeputra Pune

    Can we get the MR for quick review and merge.

  • First commit to issue fork.
  • Status changed to Needs work 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi @kkalashnikov,

    I applied your patch, it was applied smoothly. However I still encountered some issues after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    āžœ  media_entity_soundcloud git:(3346907-fix-the-issues) curl https://www.drupal.org/files/issues/2023-03-14/3346907-8.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2950  100  2950    0     0   7039      0 --:--:-- --:--:-- --:--:--  7040
    patching file src/Form/SoundcloudForm.php
    patching file src/Plugin/Field/FieldFormatter/SoundcloudEmbedFormatter.php
    patching file tests/src/Functional/SoundcloudEmbedFormatterTest.php
    āžœ  media_entity_soundcloud git:(3346907-fix-the-issues) āœ— ..
    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml media_entity_soundcloud
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/media_entity_soundcloud/media_entity_soundcloud.module
    ---------------------------------------------------------------------------------------------------------------------------
    FOUND 4 ERRORS AFFECTING 4 LINES
    ---------------------------------------------------------------------------------------------------------------------------
      8 | ERROR | [x] There must be one blank line after the last USE statement; 2 found;
     14 | ERROR | [x] Expected 1 blank line before function; 2 found
     48 | ERROR | [x] Case breaking statements must be followed by a single blank line
     51 | ERROR | [x] Expected 1 blank line after function; 0 found
    ---------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------

    .

    Thank you.

  • Merge request !15Fixed phpcs issues ā†’ (Merged) created by cleavinjosh
  • Status changed to Needs review 4 months ago
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    Please review MR!15. Thank you.

  • Pipeline finished with Failed
    4 months ago
    Total: 166s
    #238133
  • Status changed to RTBC 4 months ago
  • Pipeline finished with Skipped
    4 months ago
    #246686
  • Status changed to Fixed 4 months ago
  • šŸ‡®šŸ‡³India rajeshreeputra Pune

    Fixed!

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

Production build 0.71.5 2024