- 
                Notifications
    
You must be signed in to change notification settings  - Fork 40
 
Closed
Description
Describe your issue or idea
Run phpcs Backdrop code standards checks against all backdrop/backdrop PRs.
- Devs get near real time feedback on code standards violations that can be addressed before a human gets the time to review it for technical implementation.
 
Actual behavior (if reporting a bug)
- Currently PRs are not checked for code standards except by humans.
 
Expected behavior (if reporting a bug)
- Automate the 
phpcschecks in ZenCI 
There are two PRs on the table to enable this to happen:
- Add phpcs checks to PRs for backdrop/backdrop. backdrop-ops/backdropcms.org#460
- This gets BackdropCMS to fire the ZenCI requests
 
 - Check if we can fire phpcs in ZenCI. backdrop#2244
- this one against core provides the test to run
 
 
To run the phpcs checks locally follow the instructions in the README.md here: https://packagist.org/packages/backdrop/coder
Here is an example of running phpcs locally against one file:
vendor/bin/phpcs --standard=./vendor/backdrop/coder/coder_sniffer/Backdrop core/modules/admin_bar/admin_bar.incand the output:
FILE: ...f/code/sites/backdrop-ops/backdrop/core/modules/admin_bar/admin_bar.inc
--------------------------------------------------------------------------------
FOUND 18 ERROR(S) AND 3 WARNING(S) AFFECTING 20 LINE(S)
--------------------------------------------------------------------------------
  35 | WARNING | Line exceeds 80 characters; contains 81 characters
 124 | WARNING | Line exceeds 80 characters; contains 81 characters
 126 | ERROR   | Missing parameter type at position 1
 168 | ERROR   | Missing parameter type at position 1
 172 | ERROR   | Data type of return value is missing
 215 | ERROR   | Inline comments must start with a capital letter
 252 | ERROR   | Doc comment for var A does not match actual variable name
     |         | $tree at position 1
 252 | ERROR   | Parameter comment must be on the next line at position 1
 254 | ERROR   | Missing parameter type at position 2
 256 | ERROR   | Missing parameter type at position 3
 367 | ERROR   | Missing parameter type at position 1
 369 | ERROR   | Missing parameter type at position 2
 396 | ERROR   | The first index in a multi-value array must be on a new line
 399 | ERROR   | Array indentation error, expected 6 spaces but found 4
 408 | ERROR   | Missing parameter type at position 1
 465 | ERROR   | Missing parameter type at position 1
 469 | ERROR   | Data type of return value is missing
 479 | ERROR   | Inline comments must end in full-stops, exclamation marks, or
     |         | question marks
 757 | ERROR   | Missing parameter type at position 1
 821 | 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.", or "*
     |         | Implements hook_foo_BAR_ID_bar() for xyz-bar.tpl.php.".
 834 | ERROR   | Missing parameter type at position 1
--------------------------------------------------------------------------------
UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------
- We can break this up into per module tasks.
 - We should file the PRs against this branch 
https://github.com/backdrop/backdrop/tree/phpcsrather than the1.xbranch until we get complete coverge 
Each participant should self assign themselves a core module and add it to the list here:
core/includes
-  
database@serundeputy-  
mysql@serundeputy 
 -  
 -  
filetransfer 
core/modules
-  
admin_bar@serundeputy -  
block@serundeputy -  
book@serundeputy -  
ckeditor -  
color -  
comment -  
config -  
contact -  
contextual -  
dashboard -  
date -  
dblog -  
email -  
entity -  
field -  
field_ui -  
file -  
filter -  
image -  
installer -  
language -  
layout -  
link -  
locale -  
menu -  
node -  
path -  
redirect -  
search -  
simpletest -  
syslog -  
system -  
taxonomy -  
translation -  
update -  
user -  
views -  
views_ui