Your (coding) standards matter

3,285 views

Published on

My short talk at the berlin php user group about phpmd and phpcs..

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,285
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Your (coding) standards matter

  1. 1. YOUR (CODING) STANDARDS MATTER
  2. 2. ABOUT ME Software Engineer PHP since 11 years CI CleanCode DevOps TDD Shipping Bullet points
  3. 3. WORKING FOR ResearchGate gives science back to the people who make it happen. We help researchers build reputation and accelerate scientific progress. On their terms.
  4. 4. GET IN TOUCH stackoverflow: Twitter: @_ _edorian G+ / Xing: Volker Dusch IRC (freenode): edorian Mail: php@wallbash.com
  5. 5. WHY I AM HERE TODAY
  6. 6. SO WHAT IS THIS TALK ABOUT?
  7. 7. PHP!
  8. 8. CODING GUIDELINES!
  9. 9. THE TOOLS PHP MESSDETECTOR Complexity, long term maintainability, keeps you honest when designing PHP CODE SNIFFER Code formatting, simple coding errors, helps you stay consistent in a team
  10. 10. PURPOSE (IMHO) PHPMD is for naming, size, complexity and all the hard to change things PHPCS is for whitespace and all the things that are easy to fix
  11. 11. HOW TO MAKE USE OF THEM Configure rules that match the way you are working! It's easier than it feels!
  12. 12. WHAT ABOUT STANDARDS? PHPMD: Use all the rules, they are reasonable. Configure them later PHPCS: Use PSR2. Replace things if they don't work for your team
  13. 13. INSTALLING { "require": { "squizlabs/php_codesniffer": "*", "phpmd/phpmd": "*" }, "config": { "bin-dir": "/usr/local/bin/" } }
  14. 14. DEMO Let's create ruleset files for both of the tools :) http://edorian.github.io/php-coding-standard-generator/#phpmd
  15. 15. COMMANDS USED Use most of PHPMDs rules: Use your custom ruleset: Use PSR2 with PHPCS: Use your own PHPCS rules: phpmd source text codesize,unusedcode,naming,design phpmd source text phpmd.xml phpcs --standard=PSR2 source/ phpcs --standard=phpcs.xml source/
  16. 16. CONTINUOUS INTEGRATION Real world usage along a projects lifecylce Pretty graphs in Jenkins! Fail your travis ci build on phpcs errors? Fail your travis ci build on phpmd errors???
  17. 17. THANK YOU!
  18. 18. QUESTIONS? GET IN TOUCH stackoverflow: Twitter: @_ _edorian G+ / Xing: Volker Dusch IRC (freenode): edorian Mail: php@wallbash.com

×