Coding Standard issues

Created on 11 October 2017, about 7 years ago
Updated 22 August 2024, 3 months ago

There are some coding standard issues in this module.

šŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡³India jayesh_makwana

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

Merge Requests

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 #3, it was applied smoothly and fixed some of the phpcs issues.

    These are the remaining issues after I ran

    </code>:
    
    <code>āžœ  field_expression git:(8.x-1.x) curl https://www.drupal.org/files/issues/2020-03-17/field_expression_coding_standard-2915427-3.patch | patch -p1
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  6744  100  6744    0     0  11642      0 --:--:-- --:--:-- --:--:-- 11647
    patching file field_expression.module
    patching file src/Plugin/Field/FieldFormatter/ExpressionValueFormatter.php
    patching file src/Plugin/Field/FieldType/ExpressionItem.php
    āžœ  field_expression git:(8.x-1.x) āœ— ..
    āžœ  contrib phpcs --standard="Drupal,DrupalPractice" --extensions=php,module,inc,install,test,profile,theme,info,txt,md,yml,css,js field_expression
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/field_expression.module
    -----------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------
     9 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Form\FormStateInterface.
    -----------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldWidget/ExpressionEditableWidget.php
    -----------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 10 ERRORS AFFECTING 9 LINES
    -----------------------------------------------------------------------------------------------------------------------------------------------
     31 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     32 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     33 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     33 | ERROR | [x] Use null coalesce operator instead of ternary operator.
     34 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     38 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     39 | ERROR | [x] 8 spaces found before inline comment; expected "// '#type' => 'hidden'," but found "//        '#type' => 'hidden',"
     40 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     41 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     42 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    -----------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 10 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    -----------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldWidget/ExpressionWidget.php
    ---------------------------------------------------------------------------------------------------------------------------------------
    FOUND 6 ERRORS AFFECTING 5 LINES
    ---------------------------------------------------------------------------------------------------------------------------------------
     31 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     32 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     33 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
     34 | ERROR | [x] Line indented incorrectly; expected at least 4 spaces, found 0
     34 | ERROR | [x] 8 spaces found before inline comment; expected "// '#disabled' => TRUE," but found "//        '#disabled' => TRUE,"
     35 | ERROR | [x] Array indentation error, expected 6 spaces but found 8
    ---------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionDecimalItem.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     22 | ERROR | [x] The closing brace for the class must have an empty line before it
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionFloatItem.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------
     22 | ERROR | [x] The closing brace for the class must have an empty line before it
    ----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionIntegerItem.php
    ------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------------------------------------------------------------------
     27 | ERROR | [x] Expected 1 space after cast statement; 0 found
    ------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionItem.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     175 | WARNING | The use of function dpm() is discouraged
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionItemTrait.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 38 ERRORS AND 2 WARNINGS AFFECTING 40 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
      33 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      34 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      35 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      36 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      49 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      50 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      51 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      52 | ERROR   | [ ] Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
      56 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      57 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      58 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      59 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      60 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      64 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      65 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      69 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      70 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      71 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      72 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      76 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      77 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      78 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      79 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
      84 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
      85 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
      86 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
      87 | ERROR   | [x] Array indentation error, expected 8 spaces but found 10
     103 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     107 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     114 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     120 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     122 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     129 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     132 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     137 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     142 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     150 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
     156 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
     161 | WARNING | [x] A comma should follow the last multiline array item. Found: $result
     163 | WARNING | [ ] The use of function dpm() is discouraged
    ----------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 38 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldFormatter/ExpressionDecimalFormatter.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------
     21 | ERROR | [x] The closing brace for the class must have an empty line before it
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldFormatter/ExpressionFormatterTrait.php
    --------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 10 ERRORS AND 1 WARNING AFFECTING 11 LINES
    --------------------------------------------------------------------------------------------------------------------------------------------------
      8 | ERROR   | [x] Missing trait doc comment
     15 | WARNING | [x] A comma should follow the last multiline array item. Found: FALSE
     18 | ERROR   | [x] Whitespace found at end of line
     25 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
     26 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
     27 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
     28 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
     29 | ERROR   | [x] Array indentation error, expected 6 spaces but found 8
     33 | ERROR   | [x] Whitespace found at end of line
     42 | ERROR   | [x] Whitespace found at end of line
     54 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
    --------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldFormatter/ExpressionIntegerFormatter.php
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ----------------------------------------------------------------------------------------------------------------------------------------------------
     20 | ERROR | [x] The closing brace for the class must have an empty line before it
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ----------------------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 232ms; Memory: 10MB
    
    āžœ  contrib

    Thank you.

  • šŸ‡ŗšŸ‡øUnited States Greg Boggs Portland Oregon

    Thanks for the review! Happy to get improvements committed if someone wants to open a merge request with fixes, even if they aren't perfect yet.

  • Assigned to cleavinjosh
  • šŸ‡µšŸ‡­Philippines cleavinjosh
  • Merge request !2Fixed phpcs issues ā†’ (Open) created by cleavinjosh
  • Issue was unassigned.
  • šŸ‡µšŸ‡­Philippines cleavinjosh

    Hi,

    These are the remaining issues:

    āžœ  contrib phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig field_expression
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionItem.php
    -----------------------------------------------------------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    -----------------------------------------------------------------------------------------------------------------------------------
     175 | WARNING | The use of function dpm() is discouraged
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    FILE: /Users/interns/Demo-site/drupal-org-issues/web/modules/contrib/field_expression/src/Plugin/Field/FieldType/ExpressionItemTrait.php
    ----------------------------------------------------------------------------------------------------------------------------------------
    FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
    ----------------------------------------------------------------------------------------------------------------------------------------
      52 | ERROR   | Concatenating translatable strings is not allowed, use placeholders instead and only one string literal
     163 | WARNING | The use of function dpm() is discouraged
    ----------------------------------------------------------------------------------------------------------------------------------------
    
    Time: 237ms; Memory: 10MB
    
    āžœ  contrib

    I used the phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml command.

    Thank you.

Production build 0.71.5 2024