Coding standards need to fix.

Created on 14 March 2019, over 5 years ago
Updated 21 August 2024, 3 months ago

Review of the 8.x-1.x branch (commit bb057b8):

  • Your README.txt does not follow best practices (headings need to be uppercase). See https://www.drupal.org/node/2181737 .
    • The REQUIREMENTS section is missing.
  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards ). See attachment.
  • DrupalPractice has found some issues with your code, but could be false positives.
    
    FILE: .../drupal/pareviewsh/pareview_temp/src/Form/EnvironmentSettingForm.php
    --------------------------------------------------------------------------
    FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 4 LINES
    --------------------------------------------------------------------------
     36 | WARNING | Unused global variable $base_url.
     47 | WARNING | t() calls should be avoided in classes, use dependency
        |         | injection and $this->t() instead
     48 | WARNING | t() calls should be avoided in classes, use dependency
        |         | injection and $this->t() instead
     49 | WARNING | #options values usually have to run through t() for
        |         | translation
     49 | WARNING | #options values usually have to run through t() for
        |         | translation
    --------------------------------------------------------------------------
    
    Time: 233ms; Memory: 4Mb
    
  • No automated test cases were found, did you consider writing PHPUnit tests ? This is not a requirement but encouraged for professional software development.


FILE: ...00000/site1101/web/vendor/drupal/pareviewsh/pareview_temp/README.txt
--------------------------------------------------------------------------
FOUND 1 ERROR AND 2 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------
 19 | WARNING | [ ] Line exceeds 80 characters; contains 177 characters
 20 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
 50 | ERROR   | [x] Expected 1 newline at end of file; 3 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: ...ite1101/web/vendor/drupal/pareviewsh/pareview_temp/site_env.info.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: ...1/web/vendor/drupal/pareviewsh/pareview_temp/site_env.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: .../drupal/pareviewsh/pareview_temp/src/Form/EnvironmentSettingForm.php
--------------------------------------------------------------------------
FOUND 30 ERRORS AND 1 WARNING AFFECTING 30 LINES
--------------------------------------------------------------------------
  3 | ERROR   | [x] Namespaced classes, interfaces and traits should not
    |         |     begin with a file doc comment
 14 | ERROR   | [x] Missing class doc comment
 16 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 19 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 20 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 21 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 23 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 26 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 27 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 30 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 32 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 35 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 36 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 38 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 39 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 43 | ERROR   | [x] Functions must not contain multiple empty lines in a
    |         |     row; found 2 empty lines
 45 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 48 | WARNING | [ ] Avoid backslash escaping in translatable strings when
    |         |     possible, use "" quotes instead
 49 | ERROR   | [ ] If the line declaring an array spans longer than 80
    |         |     characters, each element should be broken into its
    |         |     own line
 49 | ERROR   | [x] Short array syntax must be used to define arrays
 52 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 53 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 55 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 58 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 60 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 62 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 65 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 66 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 67 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 71 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 8
 72 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 29 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------


FILE: .../web/vendor/drupal/pareviewsh/pareview_temp/site_env.permissions.yml
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
 3 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------

Time: 728ms; Memory: 4Mb
📌 Task
Status

Needs work

Version

1.0

Component

Code

Created by

🇮🇳India kkalaskar Pune

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

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs work 3 months ago
  • 🇵🇭Philippines cleavinjosh

    Hi @Deepthi kumari,

    I applied patch #8, it was applied smoothly and fixed most of the phpcs issues.

    I can only see some warnings after I ran phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml.

    ➜  site_env git:(8.x-1.0) curl https://www.drupal.org/files/issues/2020-03-16/coding-standards-fixes-3040119-8.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  5977  100  5977    0     0  13961      0 --:--:-- --:--:-- --:--:-- 13964
    patching file README.txt
    patching file site_env.info.yml
    patching file site_env.links.menu.yml
    patching file site_env.permissions.yml
    patching file src/Form/EnvironmentSettingForm.php
    ➜  site_env git:(8.x-1.0) ✗ ..
    ➜  contrib phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js site_env
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/site_env/site_env.info.yml
    -----------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------
     1 | WARNING | "core_version_requirement" property is missing in the info.yml file
    -----------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/site_env/src/Form/EnvironmentSettingForm.php
    -----------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
    -----------------------------------------------------------------------------------------------------------------
     44 | WARNING | #options values usually have to run through t() for translation
     46 | WARNING | #options values usually have to run through t() for translation
     47 | WARNING | #options values usually have to run through t() for translation
    -----------------------------------------------------------------------------------------------------------------
    
    Time: 94ms; Memory: 10MB
    
    ➜  contrib

    Thank you.

Production build 0.71.5 2024