Fix the issues reported by PHPCS

Created on 19 April 2023, over 1 year ago
Updated 10 July 2024, 5 months ago

Problem/Motivation

FILE: ...b/modules/contrib/locale_deploy/tests/src/Build/CustomTranslationsTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
121 | ERROR | Missing short description in doc comment
122 | ERROR | Missing parameter type
--------------------------------------------------------------------------------

FILE: ...eb/modules/contrib/locale_deploy/tests/src/Functional/LocaleDeployTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
24 | ERROR | Missing short description in doc comment
36 | ERROR | Missing short description in doc comment
--------------------------------------------------------------------------------

FILE: ...dules/contrib/locale_deploy/tests/src/Functional/LocaleDeployDrushTest.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------------
132 | ERROR | The array declaration extends to column 174 (the limit is 80).
| | The array content should be split up over multiple lines
137 | ERROR | The array declaration extends to column 98 (the limit is 80).
| | The array content should be split up over multiple lines
206 | ERROR | Missing parameter type
212 | ERROR | The array declaration extends to column 87 (the limit is 80).
| | The array content should be split up over multiple lines
213 | ERROR | The array declaration extends to column 88 (the limit is 80).
| | The array content should be split up over multiple lines
216 | ERROR | The array declaration extends to column 84 (the limit is 80).
| | The array content should be split up over multiple lines
217 | ERROR | The array declaration extends to column 84 (the limit is 80).
| | The array content should be split up over multiple lines
--------------------------------------------------------------------------------

FILE: ...10/web/modules/contrib/locale_deploy/src/Commands/LocaleDeployCommands.php
--------------------------------------------------------------------------------
FOUND 7 ERRORS AFFECTING 7 LINES
--------------------------------------------------------------------------------
30 | ERROR | [ ] Missing short description in doc comment
35 | ERROR | [ ] Missing short description in doc comment
40 | ERROR | [ ] Missing short description in doc comment
45 | ERROR | [ ] Missing short description in doc comment
57 | ERROR | [ ] The array declaration extends to column 121 (the limit is
| | 80). The array content should be split up over multiple
| | lines
125 | ERROR | [x] Missing function doc comment
138 | ERROR | [ ] The array declaration extends to column 84 (the limit is
| | 80). The array content should be split up over multiple
| | lines
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 1.02 secs; Memory: 10MB

Steps to reproduce

Execute the command: phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig locale_deploy/

Proposed resolution

Fix all the issues reported for Drupal and DrupalPractice coding standards

Remaining tasks

Patch Review

๐Ÿ“Œ Task
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

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 @urvashi_vora
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    This project will only accept issues found by running automated scanners with the following configuration on a current Drupal core install.

    composer run phpcs -- -ps modules/locale_deploy/
    vendor/bin/phpstan analyse  -c core/phpstan.neon.dist modules/locale_deploy
    

    If you do want to make changes according to automated scan then the issue will only be accepted if it comes with an MR and the work done already. It will be rejected if the changes make the code harder to read. For example, line length enforced by PHPCS will not be observed by this project.

    Wrt to the MR filed here:

    • all the array declaration changes will not be accepted.
    • The unnecessary param documentation will not be accepted.
    1. +++ b/src/Commands/LocaleDeployCommands.php
      @@ -122,6 +132,9 @@ class LocaleDeployCommands extends DrushCommands implements SiteAliasManagerAwar
      +  /**
      +   * {@inheritdoc}
      +   */
      

      This is not inheriting anything. It's okay to have a private method without a doc block.

    2. +++ b/tests/src/Build/CustomTranslationsTest.php
      @@ -119,7 +119,9 @@ EOT;
      -   * @param $custom_setup_file
      +   * {@inheritdoc}
      

      This is not inheriting anything.

    3. +++ b/tests/src/Functional/LocaleDeployTest.php
      @@ -22,6 +22,8 @@ class LocaleDeployTest extends BrowserTestBase {
         /**
      +   * {@inheritdoc}
      +   *
          * @see locale_deploy_form_locale_translate_settings_alter()
          */
         public function testFormAlter(): void {
      
      @@ -34,6 +36,8 @@ class LocaleDeployTest extends BrowserTestBase {
         /**
      +   * {@inheritdoc}
      +   *
          * @see locale_deploy_requirements()
          */
         public function testRequirements(): void {
      

      Theses are not inheriting anything and the docblocks here + method names are perfect already.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India

    Thanks Alex for brief description.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    4 pass, 2 fail
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ashutosh ahirwal India

    Providing patch with fixes if it works for you.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

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

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia urvashi_vora Madhya Pradesh, India
  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Hi,
    Hi I reviewed patch #6, and there are still remaining issues reported by phpcs shown below:

    FILE:/locale_deploy/src/Commands/LocaleDeployCommands.php
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
    ------------------------------------------------------------------------------------------------------------------------
     164 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
     165 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and
         |         | $this->t() instead
    ------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /locale_deploy/locale_deploy.module
    ------------------------------------------------------------------------------------------------------------------------
    FOUND 3 ERRORS AND 1 WARNING AFFECTING 4 LINES
    ------------------------------------------------------------------------------------------------------------------------
     15 | WARNING | Global constants should not be used, move it to a class or interface
     24 | ERROR   | All functions defined in a module file must be prefixed with the module's name, found
        |         | "locale_form_locale_translate_settings_alter" but expected
        |         | "locale_deploy_locale_form_locale_translate_settings_alter"
     39 | ERROR   | All functions defined in a module file must be prefixed with the module's name, found
        |         | "locale_locale_translation_projects_alter" but expected
        |         | "locale_deploy_locale_locale_translation_projects_alter"
     56 | ERROR   | All functions defined in a module file must be prefixed with the module's name, found
        |         | "locale_module_implements_alter" but expected "locale_deploy_locale_module_implements_alter"
    ------------------------------------------------------------------------------------------------------------------------
    
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia viren18febS

    Hi , i have fixed these remaining issues. please review

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pray_12

    Hi,
    Patch #10 is applied cleanly, but one warning was found.
    Thank you!!

    FILE: .../locale_deploy/locale_deploy.module
    ----------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ----------------------------------------------------------------------------
     15 | WARNING | Global constants should not be used, move it to a class or
        |         | interface
    ----------------------------------------------------------------------------
    
  • Status changed to Closed: won't fix 5 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    This project is using gitlabci if the PHPCS errors are not reported there then they are not errors.

Production build 0.71.5 2024