Coding standard and code fixes.

Created on 3 May 2023, about 1 year ago

Problem/Motivation

FILE: ...\contrib\media_sitemap\config\install\media_sitemap.settings.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
2 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...-contri\web\modules\contrib\media_sitemap\media_sitemap.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
----------------------------------------------------------------------

FILE: ...i\web\modules\contrib\media_sitemap\media_sitemap.links.menu.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
5 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ap-contri\web\modules\contrib\media_sitemap\media_sitemap.module
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
8 | ERROR | [x] When importing a class with "use", do not include a
| | leading \
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...i\web\modules\contrib\media_sitemap\media_sitemap.permission.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
2 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...tri\web\modules\contrib\media_sitemap\media_sitemap.services.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
4 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...rib\media_sitemap\src\Controller\MediaSitemapBatchController.php
----------------------------------------------------------------------
FOUND 8 ERRORS AND 4 WARNINGS AFFECTING 10 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
11 | WARNING | [x] Unused use statement
12 | WARNING | [x] Unused use statement
18 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
28 | ERROR | [x] Short array syntax must be used to define arrays
30 | ERROR | [x] Short array syntax must be used to define arrays
31 | ERROR | [ ] The array declaration extends to column 86 (the
| | limit is 80). The array content should be split
| | up over multiple lines
31 | ERROR | [x] Short array syntax must be used to define arrays
31 | ERROR | [x] Short array syntax must be used to define arrays
33 | WARNING | [x] A comma should follow the last multiline array
| | item. Found:
| | 'MediaSitemapGenerator::sitemapGenerateFinished'
38 | ERROR | [x] Expected 1 blank line after function; 0 found
39 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...\contrib\media_sitemap\src\Controller\MediaSitemapController.php
----------------------------------------------------------------------
FOUND 16 ERRORS AND 3 WARNINGS AFFECTING 18 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
21 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
29 | ERROR | [ ] Class property $config_factory should use
| | lowerCamel naming without underscores
30 | ERROR | [x] Whitespace found at end of line
37 | ERROR | [x] Whitespace found at end of line
38 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
| | found 3
38 | ERROR | [ ] Parameter $config_factory is not described in
| | comment
39 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
40 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
41 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
42 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
43 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
67 | ERROR | [x] Short array syntax must be used to define arrays
73 | ERROR | [x] Short array syntax must be used to define arrays
81 | ERROR | [x] Short array syntax must be used to define arrays
85 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: )
93 | WARNING | [x] A comma should follow the last multiline array
| | item. Found: )
96 | ERROR | [x] Expected 1 blank line after function; 0 found
97 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...\web\modules\contrib\media_sitemap\src\MediaSitemapGenerator.php
----------------------------------------------------------------------
FOUND 28 ERRORS AND 1 WARNING AFFECTING 25 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
22 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
24 | ERROR | [ ] Missing short description in doc comment
29 | ERROR | [ ] Missing short description in doc comment
34 | ERROR | [ ] Missing short description in doc comment
39 | ERROR | [ ] Missing short description in doc comment
51 | ERROR | [ ] Parameter $configFactory is not described in
| | comment
53 | ERROR | [x] There must be exactly one blank line before the
| | tags in a doc comment
53 | ERROR | [ ] Missing parameter comment
53 | ERROR | [x] Data types in @param tags need to be fully
| | namespaced
54 | ERROR | [ ] Missing parameter comment
54 | ERROR | [ ] Doc comment for parameter $database does not
| | match actual variable name $file_url_generate
55 | ERROR | [ ] Missing parameter comment
56 | ERROR | [ ] Missing parameter comment
58 | ERROR | [x] Parameter comment indentation must be 3 spaces,
| | found 1 spaces
68 | ERROR | [x] Missing function doc comment
79 | ERROR | [x] Missing function doc comment
81 | ERROR | [x] Short array syntax must be used to define arrays
92 | ERROR | [x] Inline comments must start with a capital letter
94 | ERROR | [x] Short array syntax must be used to define arrays
101 | ERROR | [x] Short array syntax must be used to define arrays
101 | ERROR | [x] Short array syntax must be used to define arrays
102 | ERROR | [x] Object operator not indented correctly; expected
| | 12 spaces but found 14
112 | ERROR | [x] There should be no white space after an opening
| | "("
125 | ERROR | [x] Missing function doc comment
133 | ERROR | [x] Short array syntax must be used to define arrays
135 | ERROR | [x] Closing parenthesis of array declaration must be
| | on a new line
138 | ERROR | [x] Expected 1 blank line after function; 0 found
139 | ERROR | [x] The closing brace for the class must have an
| | empty line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...les\contrib\media_sitemap\src\MediaSitemapGeneratorInterface.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
14 | WARNING | [ ] The class short comment should describe what the
| | class does and not simply repeat the class name
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...dia_sitemap\Tests\Controller\MediaSitemapBatchControllerTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
21 | ERROR | [x] Short array syntax must be used to define arrays
31 | WARNING | [ ] Possible useless method overriding detected
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

FILE: ...ib\media_sitemap\Tests\Controller\MediaSitemapControllerTest.php
----------------------------------------------------------------------
FOUND 4 ERRORS AND 2 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
3 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
11 | WARNING | [x] Unused use statement
23 | ERROR | [ ] Class property $config_factory should use
| | lowerCamel naming without underscores
27 | ERROR | [x] Expected 1 blank line before function; 0 found
28 | ERROR | [x] Short array syntax must be used to define arrays
38 | WARNING | [ ] Possible useless method overriding detected
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

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

FILE: ...rib\media_sitemap\src\Controller\MediaSitemapBatchController.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
29 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
----------------------------------------------------------------------

FILE: ...\contrib\media_sitemap\src\Controller\MediaSitemapController.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
68 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
69 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
70 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
71 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
85 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
93 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
----------------------------------------------------------------------

FILE: ...\web\modules\contrib\media_sitemap\src\MediaSitemapGenerator.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
93 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
114 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
127 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
132 | WARNING | t() calls should be avoided in classes, use
| | \Drupal\Core\StringTranslation\StringTranslationTrait
| | and $this->t() instead
----------------------------------------------------------------------

Steps to reproduce

  • Intall media sitemap module.
  • Run phpcs --standard=DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/media_sitemap
  • Run phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml web/modules/contrib/media_sitemap

Proposed resolution

Fixed major issues and worked on a patch.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇮🇳India arpitk

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

Comments & Activities

Production build 0.69.0 2024