CODING-STYLEGUIDESAktuell Zend Framework Styleguide von anno dazumal Keine Berücksichtigung...

Preview:

Citation preview

CODING-STYLEGUIDESJan-Hendrik Willms

Universität Oldenburg

CSS / LESS / SASS

AIRBNB CSS / SASS STYLEGUIDE

➤ http://bit.ly/airbnbcss

➤ OOCSS / „Object Oriented CSS“: • Style Objekte, nicht HTML-Elemente

• Keine IDs, nur Klassen

• So flach wie möglich

➤ BEM / „Block-Element-Modifier“ • .block {}

• .block__element {}

• .block--modifier {}

TOOLING

➤ https://stylelint.io/

JAVASCRIPT

JAVASCRIPT

➤ https://google.github.io/styleguide/jsguide.html

➤ https://github.com/airbnb/javascript

➤ Linting erfolgt durch Webpack

SQL

➤ Brauchen wir hier etwas?

➤ Gibt es Dinge, über die wir reden sollten?

PHP

➤ Aktuell Zend Framework Styleguide von anno dazumal

➤ Keine Berücksichtigung aktueller Neuerungen in PHP

➤ Uneinigkeit, wie Dinge abgebildet werden sollen

➤ Absehbare automatische Überprüfung schwierig

ZEND CODING STANDARD 2.4 (2013)

➤ http://bit.ly/zend2013

➤ Aktueller als unsere Version, marginale Unterschiede

➤ Zend selbst nutzt diesen Standard nicht mehr

PHP STANDARDS RECOMMENDATIONS

➤ http://bit.ly/psr-php

➤ PSR-1: Basic Coding Standard (final)

➤ PSR-2: Coding Style Guide (final)

➤ PSR-12: Extended Coding Style Guide (review)

➤ PSR-5: PHPDoc Standard (draft)

➤ PSR-19: PHPDoc tags (draft)

PHP STANDARDS RECOMMENDATIONS

➤ Sehr weit verbreitet

➤ Viele Tools, die dies unterstützen

➤ Weitere nützliche Recommendations:

• PSR-4: Autoloading Standard

• PSR-7: HTTP Message Interface (Trails 2.0)

• PSR-15: HTTP Handlers

TOOLING

➤ Standards

• PHPMD - PHP Mess Detector

• PHPCS - PHP_CodeSniffer

➤ Statische Codeanalyse

• PHPStan - PHP Static Analysis Tool

• Phan

• Psalm

Recommended