Problem/Motivation

Drupal Coding standards should be fixed.

FILE: /home/akash/Documents/patches/node_access_allow/node_access_allow.install
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AND 7 WARNINGS AFFECTING 8 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  1 | ERROR   | [x] Missing file doc comment
  3 | WARNING | [x] Unused use statement
 11 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 34 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 41 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 48 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 55 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
 65 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


FILE: /home/akash/Documents/patches/node_access_allow/node_access_allow.module
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 78 ERRORS AND 22 WARNINGS AFFECTING 61 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   3 | ERROR   | [ ] Missing short description in doc comment
   7 | WARNING | [x] Unused use statement
   7 | ERROR   | [x] When importing a class with "use", do not include a leading \
   8 | WARNING | [x] Unused use statement
   8 | ERROR   | [x] When importing a class with "use", do not include a leading \
   9 | ERROR   | [x] When importing a class with "use", do not include a leading \
  12 | WARNING | [x] Unused use statement
  14 | WARNING | [x] Unused use statement
  16 | WARNING | [x] Unused use statement
  17 | WARNING | [x] Unused use statement
  18 | WARNING | [x] Unused use statement
  18 | ERROR   | [x] There must be one blank line after the last USE statement; 2 found;
  22 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
  24 | ERROR   | [x] Expected 1 blank line before function; 2 found
  29 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
  39 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  47 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  65 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  85 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
  88 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "TRUE" but found "true"
 121 | ERROR   | [x] Function comment short description must start with exactly one space
 121 | ERROR   | [x] Doc comment short description must end with a full stop
 125 | WARNING | [ ] Line exceeds 80 characters; contains 226 characters
 126 | WARNING | [ ] Line exceeds 80 characters; contains 113 characters
 126 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 127 | WARNING | [ ] Line exceeds 80 characters; contains 117 characters
 127 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 6
 128 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 130 | ERROR   | [x] No space found before comment text; expected "// die;" but found "//die;"
 130 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 131 | WARNING | [ ] Line exceeds 80 characters; contains 116 characters
 131 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 132 | WARNING | [ ] Line exceeds 80 characters; contains 107 characters
 132 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 133 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 135 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
 135 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 136 | WARNING | [ ] Line exceeds 80 characters; contains 106 characters
 136 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 137 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 139 | WARNING | [ ] Line exceeds 80 characters; contains 224 characters
 139 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 140 | WARNING | [ ] Line exceeds 80 characters; contains 110 characters
 140 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 4
 141 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 3
 143 | WARNING | [x] There must be no blank line following an inline comment
 143 | ERROR   | [x] Line indented incorrectly; expected 2 spaces, found 0
 143 | ERROR   | [x] No space found before comment text; expected "// dump($access_allow['scheduler']);die;" but found "//dump($access_allow['scheduler']);die;"
 143 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 145 | WARNING | [x] There must be no blank line following an inline comment
 145 | ERROR   | [x] No space found before comment text; expected "// dump($access_allow['scheduler']['start']);die;" but found "//dump($access_allow['scheduler']['start']);die;"
 145 | ERROR   | [x] Inline comments must end in full-stops, exclamation marks, question marks, colons, or closing parentheses
 147 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 148 | ERROR   | [x] Expected 1 space after IF keyword; 0 found
 155 | ERROR   | [x] Function comment short description must start with exactly one space
 155 | ERROR   | [x] Doc comment short description must end with a full stop
 192 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 194 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 203 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 205 | ERROR   | [x] Namespaced classes/interfaces/traits should be referenced with use statements
 215 | WARNING | [ ] Format should be "* Implements hook_foo().", "* Implements hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         |     hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements hook_foo_BAR_ID_bar() for block templates."
 220 | ERROR   | [x] Expected one space after the comma, 0 found
 221 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 221 | ERROR   | [x] Object operator not indented correctly; expected 6 spaces but found 4
 222 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 223 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 224 | ERROR   | [x] Line indented incorrectly; expected 6 spaces, found 4
 227 | ERROR   | [x] TRUE, FALSE and NULL must be uppercase; expected "FALSE" but found "false"
 230 | ERROR   | [x] Use "elseif" in place of "else if"
 240 | ERROR   | [x] Expected one space after the comma, 0 found
 243 | ERROR   | [x] Expected one space after the comma, 0 found
 245 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 245 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 246 | ERROR   | [x] Expected 1 space before ">"; 0 found
 246 | ERROR   | [x] Expected 1 space after ">"; 0 found
 246 | ERROR   | [x] Expected 1 space before ">"; 0 found
 246 | ERROR   | [x] Expected 1 space after ">"; 0 found
 253 | ERROR   | [x] Use "elseif" in place of "else if"
 253 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 253 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 254 | ERROR   | [x] Expected 1 space before ">"; 0 found
 254 | ERROR   | [x] Expected 1 space after ">"; 0 found
 254 | ERROR   | [x] Expected 1 space before ">"; 0 found
 254 | ERROR   | [x] Expected 1 space after ">"; 0 found
 261 | ERROR   | [x] Use "elseif" in place of "else if"
 261 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 261 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 262 | ERROR   | [x] Expected 1 space before ">"; 0 found
 262 | ERROR   | [x] Expected 1 space after ">"; 0 found
 262 | ERROR   | [x] Expected 1 space before ">"; 0 found
 262 | ERROR   | [x] Expected 1 space after ">"; 0 found
 269 | ERROR   | [x] Use "elseif" in place of "else if"
 269 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 269 | ERROR   | [x] Expected 1 space(s) after cast statement; 0 found
 270 | ERROR   | [x] Expected 1 space before ">"; 0 found
 270 | ERROR   | [x] Expected 1 space after ">"; 0 found
 270 | ERROR   | [x] Expected 1 space before ">"; 0 found
 270 | ERROR   | [x] Expected 1 space after ">"; 0 found
 282 | ERROR   | [x] Whitespace found at end of line
 284 | ERROR   | [x] Whitespace found at end of line
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 86 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Steps to reproduce

phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml"

Proposed resolution

Follow https://www.drupal.org/docs/develop/standards/coding-standards to fix it

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

AkashKumar07 created an issue. See original summary.

akashkumar07’s picture

Status: Active » Needs review
StatusFileSize
new10.88 KB

Patch added to fix drupal cs issues. Please review.

Thanks!

dipesh_goswami’s picture

Assigned: Unassigned » dipesh_goswami

Hi @AkashKumar07,
I am reviewing your patch.

dipesh_goswami’s picture

Assigned: dipesh_goswami » Unassigned
Status: Needs review » Needs work

Hi,
Your patch applied cleanly (see below):

dipes@Lucky MINGW64 /c/xampp/htdocs/dipeshdrupal/web/modules/contrib/node_access_allow-3300851 (coding-standard-issues-3300851)
$ git apply -v 3300851-2.patch
Checking patch node_access_allow.install...
Checking patch node_access_allow.module...
Applied patch node_access_allow.install cleanly.
Applied patch node_access_allow.module cleanly.

Most of the issues are resolved but some issues are still left (see below):

dipes@Lucky MINGW64 /c/xampp/htdocs/dipeshdrupal/web/modules/contrib (master)
$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig node_access_allow-3300851/

FILE: ...al\web\modules\contrib\node_access_allow-3300851\node_access_allow.install
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  9 | WARNING | Format should be "* Implements hook_foo().", "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
    |         | hook_foo_BAR_ID_bar() for block templates."
 63 | WARNING | Format should be "* Implements hook_foo().", "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
    |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
    |         | hook_foo_BAR_ID_bar() for block templates."
--------------------------------------------------------------------------------


FILE: ...pal\web\modules\contrib\node_access_allow-3300851\node_access_allow.module
--------------------------------------------------------------------------------
FOUND 7 ERRORS AND 7 WARNINGS AFFECTING 11 LINES
--------------------------------------------------------------------------------
  16 | WARNING | Format should be "* Implements hook_foo().", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         | hook_foo_BAR_ID_bar() for block templates."
  73 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
  82 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
  83 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
  83 | WARNING | Unused variable $k.
 164 | WARNING | Format should be "* Implements hook_foo().", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         | hook_foo_BAR_ID_bar() for block templates."
 175 | WARNING | Format should be "* Implements hook_foo().", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         | hook_foo_BAR_ID_bar() for block templates."
 187 | WARNING | Format should be "* Implements hook_foo().", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz_bar().",, "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.html.twig.", "* Implements
     |         | hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.", or "* Implements
     |         | hook_foo_BAR_ID_bar() for block templates."
 199 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
 202 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
 203 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
 203 | WARNING | Unused variable $k.
 210 | WARNING | Unused variable $allowed_roles.
 210 | ERROR   | unserialize() is insecure unless allowed classes are limited.
     |         | Use a safe format like JSON or use the allowed_classes option.
--------------------------------------------------------------------------------

Time: 276ms; Memory: 12MB


dipes@Lucky MINGW64 /c/xampp/htdocs/dipeshdrupal/web/modules/contrib (master)
$

So, moving it to "Needs work".

abhijith s’s picture

StatusFileSize
new12.46 KB
new3.61 KB

Fixed CS issues.Please review.

abhijith s’s picture

Status: Needs work » Needs review