Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Munavijayalakshmi created an issue. See original summary.

Munavijayalakshmi’s picture

Status: Active » Needs review
FileSize
813 bytes
riddhi.addweb’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
79.83 KB
60.34 KB

@Munavijayalakshmi ,thanks for the patch it works well. I checked it over Simplytest.Me with the help of coder module and with patch it removes the coding standard errors.PFA

Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
Manuel Garcia’s picture

Status: Reviewed & tested by the community » Needs work

I can see plenty more CS violations than what is fixed in the provided patch:

$ phpcs --standard=Drupal .

FILE: ...rupal7/sites/all/modules/contrib/mailsystem/mailsystem.admin.inc
----------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 9 LINES
----------------------------------------------------------------------
  52 | ERROR | [x] Array indentation error, expected 4 spaces but
     |       |     found 6
  53 | ERROR | [x] Array indentation error, expected 4 spaces but
     |       |     found 6
  54 | ERROR | [x] Array indentation error, expected 4 spaces but
     |       |     found 6
  55 | ERROR | [x] Array indentation error, expected 4 spaces but
     |       |     found 6
  56 | ERROR | [x] Array indentation error, expected 4 spaces but
     |       |     found 6
 170 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
     |       |     found 3
 170 | ERROR | [x] Closing brace indented incorrectly; expected 2
     |       |     spaces, found 3
 198 | ERROR | [x] Comments may not appear after statements
 198 | ERROR | [x] Inline comments must start with a capital letter
 199 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 199 | ERROR | [x] Comments may not appear after statements
 222 | ERROR | [x] Expected 1 blank line after function; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 12 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../all/modules/contrib/mailsystem/MailsystemDelegateMailSystem.inc
----------------------------------------------------------------------
FOUND 6 ERRORS AFFECTING 6 LINES
----------------------------------------------------------------------
  6 | ERROR | [ ] Doc comment short description must be on a single
    |       |     line, further text should be a separate paragraph
  7 | ERROR | [x] There must be exactly one blank line after the file
    |       |     comment
 12 | ERROR | [ ] Doc comment short description must be on a single
    |       |     line, further text should be a separate paragraph
 27 | ERROR | [x] Expected 1 blank line after function; 2 found
 41 | ERROR | [x] Expected 1 blank line after function; 0 found
 42 | ERROR | [x] The closing brace for the class must have an empty
    |       |     line before it
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...rupal7/sites/all/modules/contrib/mailsystem/mailsystem.theme.inc
----------------------------------------------------------------------
FOUND 16 ERRORS AND 1 WARNING AFFECTING 15 LINES
----------------------------------------------------------------------
   4 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   5 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   6 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
   9 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  10 | ERROR   | [x] Expected 1 space(s) before asterisk; 0 found
  29 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  50 | ERROR   | [x] "include_once" is a statement not a function; no
     |         |     parentheses are required
  50 | ERROR   | [x] Language constructs must be followed by a single
     |         |     space; expected "include_once (" but found
     |         |     "include_once("
  52 | ERROR   | [x] "include_once" is a statement not a function; no
     |         |     parentheses are required
  52 | ERROR   | [x] Language constructs must be followed by a single
     |         |     space; expected "include_once (" but found
     |         |     "include_once("
  83 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
  92 | WARNING | [ ] Line exceeds 80 characters; contains 83
     |         |     characters
  95 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 101 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 105 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 115 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
 121 | ERROR   | [x] Inline comments must end in full-stops,
     |         |     exclamation marks, colons, question marks, or
     |         |     closing parentheses
----------------------------------------------------------------------
PHPCBF CAN FIX THE 16 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: .../drupal7/sites/all/modules/contrib/mailsystem/mailsystem.install
----------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
  1 | ERROR | [x] Missing file doc comment
  8 | ERROR | [x] Inline comments must end in full-stops, exclamation
    |       |     marks, colons, question marks, or closing
    |       |     parentheses
 31 | ERROR | [x] Array indentation error, expected 8 spaces but
    |       |     found 10
 32 | ERROR | [x] Array indentation error, expected 8 spaces but
    |       |     found 10
 59 | ERROR | [x] Object operator not indented correctly; expected 4
    |       |     spaces but found 6
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ww/drupal7/sites/all/modules/contrib/mailsystem/html_to_text.inc
----------------------------------------------------------------------
FOUND 23 ERRORS AFFECTING 20 LINES
----------------------------------------------------------------------
   1 | ERROR | [x] The PHP open tag must be followed by exactly one
     |       |     blank line
  16 | ERROR | [ ] Missing parameter type
  73 | ERROR | [ ] Doc comment short description must be on a single
     |       |     line, further text should be a separate paragraph
  92 | ERROR | [ ] Missing parameter type
  94 | ERROR | [ ] Missing parameter type
  98 | ERROR | [ ] Return type missing for @return tag in function
     |       |     comment
 129 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 145 | ERROR | [ ] Missing parameter type
 147 | ERROR | [ ] Missing parameter type
 152 | ERROR | [ ] Missing parameter type
 157 | ERROR | [ ] Missing parameter type
 410 | ERROR | [x] There should be no white space before a closing
     |       |     "}"
 410 | ERROR | [x] Closing brace must be on a line by itself
 419 | ERROR | [x] A unary operator statement must not be followed by
     |       |     a space
 462 | ERROR | [ ] Missing parameter type
 467 | ERROR | [ ] Missing parameter type
 470 | ERROR | [ ] Return type missing for @return tag in function
     |       |     comment
 485 | ERROR | [x] Comments may not appear after statements
 499 | ERROR | [ ] Blank lines are not allowed after DEFAULT
     |       |     statements
 499 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 499 | ERROR | [x] Comments may not appear after statements
 585 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 650 | ERROR | [x] Expected 1 space after FOR keyword; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: /var/www/drupal7/sites/all/modules/contrib/mailsystem/README.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
----------------------------------------------------------------------
 123 | WARNING | Line exceeds 80 characters; contains 87 characters
 128 | WARNING | Line exceeds 80 characters; contains 89 characters
 129 | WARNING | Line exceeds 80 characters; contains 87 characters
 130 | WARNING | Line exceeds 80 characters; contains 87 characters
 131 | WARNING | Line exceeds 80 characters; contains 89 characters
 132 | WARNING | Line exceeds 80 characters; contains 89 characters
----------------------------------------------------------------------


FILE: ...www/drupal7/sites/all/modules/contrib/mailsystem/mailsystem.info
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 4 | ERROR | Drupal 7 core already requires PHP 5.2
----------------------------------------------------------------------


FILE: ...w/drupal7/sites/all/modules/contrib/mailsystem/mailsystem.module
----------------------------------------------------------------------
FOUND 35 ERRORS AFFECTING 30 LINES
----------------------------------------------------------------------
  69 | ERROR | [ ] Description for the @return value must be on the
     |       |     next line
 108 | ERROR | [ ] Doc comment short description must be on a single
     |       |     line, further text should be a separate paragraph
 110 | ERROR | [ ] Missing parameter type
 110 | ERROR | [x] Parameter comment must be on the next line
 126 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 135 | ERROR | [ ] Doc comment short description must be on a single
     |       |     line, further text should be a separate paragraph
 137 | ERROR | [ ] Missing parameter type
 137 | ERROR | [x] Parameter comment must be on the next line
 138 | ERROR | [x] Parameter comment indentation must be 3 spaces,
     |       |     found 1 spaces
 142 | ERROR | [x] Parameter comment indentation must be 3 spaces,
     |       |     found 1 spaces
 144 | ERROR | [ ] Parameter tags must be grouped together in a doc
     |       |     comment
 144 | ERROR | [ ] Missing parameter type
 163 | ERROR | [ ] Missing parameter type
 163 | ERROR | [x] Parameter comment must be on the next line
 164 | ERROR | [x] Parameter comment indentation must be 3 spaces,
     |       |     found 7 spaces
 165 | ERROR | [ ] Missing parameter type
 165 | ERROR | [x] Parameter comment must be on the next line
 166 | ERROR | [x] Parameter comment indentation must be 3 spaces,
     |       |     found 7 spaces
 169 | ERROR | [ ] Description for the @return value must be on the
     |       |     next line
 179 | ERROR | [x] Doc comment long description must start with a
     |       |     capital letter
 191 | ERROR | [ ] Description for the @return value is missing
 193 | ERROR | [x] Trailing punctuation for @see references is not
     |       |     allowed.
 277 | ERROR | [ ] Tags must be grouped together in a doc comment
 282 | ERROR | [ ] Tags must be grouped together in a doc comment
 321 | ERROR | [ ] Description for the @return value must be on the
     |       |     next line
 340 | ERROR | [x] Expected 1 space before "="; 0 found
 360 | ERROR | [ ] Description for the @return value must be on the
     |       |     next line
 394 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 395 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 402 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 403 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 404 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 405 | ERROR | [x] Expected 1 space(s) before asterisk; 0 found
 412 | ERROR | [x] Case breaking statements must be followed by a
     |       |     single blank line
 415 | ERROR | [x] Case breaking statements must be followed by a
     |       |     single blank line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 20 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Matroskeen’s picture

Status: Needs work » Closed (duplicate)
Matroskeen’s picture

Title: Fix coding standards » Fix coding standards (D7)
Status: Closed (duplicate) » Needs work
Related issues: +#2858676: Fix coding standards violations

Removed back to "Needs work" because of different Drupal versions.

daiwik.addweb’s picture

Status: Needs work » Needs review
FileSize
21.28 KB

@Matroskeen, Please find my attached that works to resolve the coding standard issues. Thanks!..

Manuel Garcia’s picture

Priority: Normal » Minor
Status: Needs review » Needs work
  1. +++ b/README.txt
    @@ -120,15 +120,21 @@ mailsystem_set(
    -   2. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
    +   2. http://api.drupal.org/api/drupal/includes--mail.inc/function/
    +   drupal_mail_system/7
        3. http://drupal.org/node/1134044
        4. http://drupal.org/project/htmlmail
        5. http://drupal.org/project/mimemail
        6. http://drupal.org/project/postmark
    -   7. http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7
    -   8. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
    -   9. http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_mail_system/7
    -  10. http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7
    -  11. http://api.drupal.org/api/drupal/includes--mail.inc/interface/MailSystemInterface/7
    +   7. http://api.drupal.org/api/drupal/includes--mail.inc/
    +   interface/MailSystemInterface/7
    +   8. http://api.drupal.org/api/drupal/includes--mail.inc/
    +   function/drupal_mail_system/7
    +   9. http://api.drupal.org/api/drupal/includes--mail.inc/
    +   function/drupal_mail_system/7
    +  10. http://api.drupal.org/api/drupal/includes--mail.inc/
    +  interface/MailSystemInterface/7
    +  11. http://api.drupal.org/api/drupal/includes--mail.inc/
    +  interface/MailSystemInterface/7
    

    I think its better to keep these in one line, since they are URLs

  2. +++ b/html_to_text.inc
    @@ -13,7 +14,7 @@
    - * @param $text
    + * @param array $text
    

    Is this actually an array, or a string?

  3. +++ b/mailsystem.install
    @@ -56,7 +61,7 @@ function mailsystem_update_7300() {
           ->condition('filename', db_like($class_dir) . '%', 'LIKE')
           ->execute()
           ->fetchAllKeyed();
    

    This should be corrected for indentation also.

  4. +++ b/mailsystem.module
    @@ -66,7 +66,8 @@ function mailsystem_defaults() {
    + * The contents of the mail_system variable merged with its defaults.
    

    indentation is off

  5. +++ b/mailsystem.module
    @@ -119,11 +119,11 @@ function mailsystem_read_settings() {
    -  $mail_system = mailsystem_get();
    +  // $mail_system = mailsystem_get().
    

    This should be left as is.

  6. +++ b/mailsystem.module
    @@ -160,13 +161,16 @@ function mailsystem_clear(array $setting) {
    + * Is the machine-readable module name optionally followed by '_'
    

    indentation.

  7. +++ b/mailsystem.module
    @@ -160,13 +161,16 @@ function mailsystem_clear(array $setting) {
    + *  A string specifying the name of the delegator class.
    

    Indentation

  8. +++ b/mailsystem.module
    @@ -176,7 +180,7 @@ function mailsystem_delegate_set_mailsystem_settings($id, $settings) {
      * Returns an MailSystemInterface class instance for a given action.
    ...
    + *  Of a class implementing the MailSystemInterface
      * responsible for performing the given action.
    

    This should be rephrased to be a one line description.

  9. +++ b/mailsystem.module
    @@ -189,8 +193,9 @@ function mailsystem_delegate_set_mailsystem_settings($id, $settings) {
      * @return MailSystemInterface
    + *  MailSystemInterface
    

    It adds no value. Rather describe what is returned.

  10. +++ b/mailsystem.module
    @@ -318,7 +323,8 @@ function mailsystem_get_classes() {
    + * @return ¶
    

    trailing space.

  11. +++ b/mailsystem.module
    @@ -337,11 +343,11 @@ function _mailsystem_get_registry_whitelist_condition() {
    -        $condition_added = TRUE;
    +        // $condition_added = TRUE.
    

    Incorrect. Leave as is.

manishsaharan’s picture

Priority: Minor » Normal
Status: Needs work » Needs review
FileSize
22.33 KB

This patch will solve this issue

Berdir’s picture

Status: Needs review » Fixed

Did some cleanup on this, fixing @return's, php7 syntax and so on. Committed.

Status: Fixed » Closed (fixed)

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