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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Rashmisoni created an issue. See original summary.

adil_siddiqui’s picture

Status: Needs work » Needs review
StatusFileSize
new2.57 KB

Patch created

indrapatil’s picture

Assigned: Unassigned » indrapatil

I am reviewing it

indrapatil’s picture

Assigned: indrapatil » Unassigned
Status: Needs review » Reviewed & tested by the community

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

avpaderno’s picture

Issue tags: -Coding standards Phpcs +Coding standards

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

avpaderno’s picture

Version: 3.0.0 » 3.x-dev
Status: Reviewed & tested by the community » Needs work
-    $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();
adil_siddiqui’s picture

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');

kunalgautam’s picture

StatusFileSize
new2.88 KB
new1.32 KB

Updated patch accordingly

avpaderno’s picture

Title: Fix coding standards » Fix the issues reported by phpcs
Status: Needs work » Needs review
rajeshreeputra’s picture

Can we get the MR for quick review and merge.

cleavinjosh made their first commit to this issue’s fork.

cleavinjosh’s picture

Status: Needs review » Needs work

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.

cleavinjosh’s picture

Status: Needs work » Needs review

Hi,

Please review MR!15. Thank you.

avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

rajeshreeputra’s picture

Status: Reviewed & tested by the community » Fixed

Fixed!

Status: Fixed » Closed (fixed)

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