Fix the issues reported by phpcs

Created on 2 May 2023, about 1 year ago
Updated 15 February 2024, 4 months ago

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

FILE: /var/www/html/contribution/web/modules/contrib/media_aparat/src/Plugin/Field/FieldFormatter/AparatFormatter.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 11 ERRORS AND 2 WARNINGS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
32 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [ ] Class property $aparat_api should use lowerCamel naming without underscores
37 | ERROR | [ ] Missing short description in doc comment
59 | ERROR | [ ] Missing parameter comment
60 | ERROR | [ ] Missing parameter comment
132 | ERROR | [x] No space found before comment text; expected "// 'width' => $max_width ?: $resource->getWidth()," but found "//'width' => $max_width ?:
| | $resource->getWidth(),"
133 | ERROR | [x] No space found before comment text; expected "// 'height' => $max_height ?: $resource->getHeight()," but found "//'height' => $max_height ?:
| | $resource->getHeight(),"
143 | WARNING | [ ] Line exceeds 80 characters; contains 92 characters
144 | ERROR | [ ] Doc comment short description must end with a full stop
144 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
160 | ERROR | [x] Expected 1 blank line after function; 0 found
161 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/media_aparat/src/Plugin/Field/FieldWidget/AparatWidget.php
------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
------------------------------------------------------------------------------------------------------------------------
5 | WARNING | [x] Unused use statement
48 | WARNING | [ ] Line exceeds 80 characters; contains 89 characters
49 | ERROR | [ ] Doc comment short description must end with a full stop
49 | ERROR | [ ] Doc comment short description must be on a single line, further text should be a separate paragraph
59 | ERROR | [x] Expected 1 blank line after function; 0 found
60 | 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: /var/www/html/contribution/web/modules/contrib/media_aparat/src/Plugin/media/Source/AparatVideo.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 11 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
13 | WARNING | [x] Unused use statement
23 | ERROR | [x] Doc comment short description must end with a full stop
35 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
60 | ERROR | [x] Doc comment short description must end with a full stop
61 | ERROR | [ ] Missing @var tag in member variable comment
64 | ERROR | [ ] Doc comment is empty
66 | ERROR | [ ] Missing @var tag in member variable comment
93 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 2 spaces
93 | ERROR | [x] Parameter comment must end with a full stop
116 | ERROR | [ ] The trigger_error message 'The file_system service must be passed to OEmbed::__construct(), it is required before Drupal 9.0.0. See
| | https://www.drupal.org/node/3006851 โ†’ .' does not match the relaxed standard format: %thing% is deprecated in %deprecation-version% any free text
| | %removal-version%. %extra-info%. See %cr-link%
262 | ERROR | [x] Expected 1 blank line after function; 0 found
263 | ERROR | [x] The closing brace for the class must have an empty line before it
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/media_aparat/src/AparatApi.php
----------------------------------------------------------------------------------------------------------------------
FOUND 18 ERRORS AND 1 WARNING AFFECTING 14 LINES
----------------------------------------------------------------------------------------------------------------------
13 | ERROR | [x] Doc comment short description must end with a full stop
14 | WARNING | [ ] The class short comment should describe what the class does and not simply repeat the class name
18 | ERROR | [ ] Missing short description in doc comment
23 | ERROR | [ ] Missing short description in doc comment
28 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [x] Doc comment short description must start with a capital letter
35 | ERROR | [x] Doc comment short description must end with a full stop
44 | ERROR | [x] Doc comment short description must start with a capital letter
44 | ERROR | [x] Doc comment short description must end with a full stop
47 | ERROR | [x] Parameter comment indentation must be 3 spaces, found 1 spaces
47 | ERROR | [x] Parameter comment must end with a full stop
49 | ERROR | [ ] Description for the @return value is missing
84 | ERROR | [x] Doc comment short description must start with a capital letter
84 | ERROR | [x] Doc comment short description must end with a full stop
86 | ERROR | [x] Parameter comment must be on the next line
86 | ERROR | [x] Parameter comment must end with a full stop
89 | ERROR | [x] Return comment indentation must be 3 spaces, found 1 spaces
104 | ERROR | [x] Expected 1 blank line after function; 0 found
105 | ERROR | [x] The closing brace for the class must have an empty line before it
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------

FILE: /var/www/html/contribution/web/modules/contrib/media_aparat/src/Form/AddVideoForm.php
-------------------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 9 LINES
-------------------------------------------------------------------------------------------
11 | ERROR | [x] Missing class doc comment
48 | ERROR | [x] Array indentation error, expected 12 spaces but found 14
49 | ERROR | [x] Array closing indentation error, expected 10 spaces but found 12
70 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
71 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
74 | ERROR | [x] Line indented incorrectly; expected 6 spaces, found 8
76 | ERROR | [x] Line indented incorrectly; expected 7 spaces, found 6
112 | ERROR | [x] Expected 1 blank line after function; 0 found
113 | ERROR | [x] The closing brace for the class must have an empty line before it
-------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------

๐Ÿ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia himanshu_jhaloya Mandsaur

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 @himanshu_jhaloya
  • @himanshu_jhaloya opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia himanshu_jhaloya Mandsaur
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
     /**
    - * Class AparatApi
    + * Class of AparatApi.
      */

    A class short description must not start with Class of nor repeat the class name.

       /**
    +   * Logger channel interface.
    +   *
        * @var \Drupal\Core\Logger\LoggerChannel
        */
       protected LoggerChannel $logger;
     

    There is a missing article. interface is not necessary and it is wrong, since a property cannot contain an interface.

    
    Each description is missing an article.
    Since that documentation comment is edited, the constructor description needs to be changed too.
    
    <code>   /**
    -   * get Video info from video hash
    +   * Get Video info from video hash.
        *
        * @param string $hash
    -   * The vide hash
    +   *   The vide hash.
        *
        * @return array|bool
    +   *   Return array.
        */
       public function getVideoInfo(string $hash) {

    In the short description, the verb must use the third person singular.
    vide is a typo.
    The return value description must describe the return value, not its type.

           try {
    -        $resource_url = $this->urlResolver->getResourceUrl($url);
    -        $this->resourceFetcher->fetchResource($resource_url);
    +      $resource_url = $this->urlResolver->getResourceUrl($url);
    +      $this->resourceFetcher->fetchResource($resource_url);
           }

    The code is already correctly indented, contrary to the changed code.

       /**
    +   * Third party api.
    +   *
        * @var \Drupal\media_aparat\AparatApi
        */

    api is misspelled.
    That description is too vague.

    -   * @param \Drupal\media_aparat\AparatApi $aparat_api
    +   * @param \Drupal\media_aparat\AparatApi $aparatApi
    +   *   The third party api.
        * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
    +   *   The logger service.
        */

    Local variables, which include also method parameters, are allowed to follow that naming schema.

       /**
    -   * Prevent usage of this field formatter on any fields other than those which are added in
    -   * a media type which it's source is AparatVideo
    +   * Prevent usage of this field formatter on any fields other than.
    +   *
    +   * Those which are added in a media type which it's source is AparatVideo.

    Prevent usage of this field formatter on any fields other than. alone is not a sentence.
    Those which are added in a media type which it's source is AparatVideo. does not make any sense and it is not grammatically correct.
    The existing description must be fixed, but the changed description is not the way to correct it.

       /**
    -   * Prevent usage of this field widget on any fields other than those which are added in
    -   * a media type which it's source is AparatVideo
    +   * Prevent usage of this field widget on any fields other than .
    +   *
    +   * Those which are added in a media type which it's source is AparatVideo.
        */

    Ditto.

       /**
    -   * The Aparat Api
    +   * The Aparat Api.
    +   *
    +   * @var \Drupal\media_aparat\AparatApi
        */
       protected AparatApi $aparatApi;

    Api is misspelled.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

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

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Ashutosh Ahirwal India

    Hi I have addressed #5 comment and updated the MR
    Please review.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    (Fixing code that does not follow the Drupal coding standards is a task.)

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • Assigned to nitin_lama
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kbk1992 Hyderabad

    bharath-kondeti โ†’ made their first commit to this issueโ€™s fork.

  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
Production build 0.69.0 2024