Maintaining the chaos, automate your code quality

A presentation at PHP South Wales, Lightning Sessions in July 2019 in by Steve McDougall

Slide 1

Slide 1

AUTOMATE YOUR CODE QUALITY MAINTAINING THE CHAOS

Slide 2

Slide 2

MAINTAINING THE CHAOS WHO AM I? I’m Steve McDougall ‣ PHP User Group Organiser ‣ Conference Organiser ‣ Experienced Developer ‣ PHP Advocate

Slide 3

Slide 3

MAINTAINING THE CHAOS MANAGING CODE QUALITY CAN GET CONFUSING PRETTY QUICKLY

Slide 4

Slide 4

MAINTAINING THE CHAOS AN EVOLVING SYSTEM INCREASES ITS COMPLEXITY UNLESS WORK IS DONE TO REDUCE IT Prof. Meir Lehman, Middlesex University

Slide 5

Slide 5

THE FIGHT AGAINST CHAOS

Slide 6

Slide 6

MAINTAINING THE CHAOS ENTER GRUMPHP

Slide 7

Slide 7

MAINTAINING THE CHAOS YAML GOODNESS Simple to use YAML confuration files

Slide 8

Slide 8

MAINTAINING THE CHAOS WHAT DOES IT DO With GrumPHP you set certain tasks to run on git pre-commit hooks. These can be configured per task.

Slide 9

Slide 9

LETS BREAK DOWN A FEW TASKS

Slide 10

Slide 10

MAINTAINING THE CHAOS FILE SIZE CHECKER max_size: The target value may use magnitudes of kilobytes (k, ki), megabytes (m, mi), or gigabytes (g, gi) ignore_patterns: This is a list of patterns that will be ignored. With this option you can skip files.

Slide 11

Slide 11

MAINTAINING THE CHAOS GIT BLACKLIST keywords: Use this parameter to specify your blacklisted keywords list. triggered_by: This option will specify which file extensions will trigger the git blacklist task. regexp_type This option allows you to choose the type of regexp you want to use for patterns (can be G for POSIX basic, E for POSIX extended or P for Perl Compatible).

Slide 12

Slide 12

MAINTAINING THE CHAOS PHP LINT exclude: Any directories to be excluded from linting. short_open_tag: This option can allow PHP short open tags. triggered_by: Any file extensions that you wish to be passed to the linter.

Slide 13

Slide 13

MAINTAINING THE CHAOS THERE ARE MANY OTHER TASKS ALREADY AVAILABLE From Doctrine ORM to NPM Scripts and Phan there are many pre-built tasks you can configure to run. Alongside these custom tasks can be built as required.

Slide 14

Slide 14

TEXT MAINTAINING CODE QUALITY AMIDST THE CHAOS IS EASIER WITH TOOLS, STOP STRUGGLING. Steve McDougall

Slide 15

Slide 15

GitHub: JustSteveKing Twitter: @JustSteveKing THANK YOU FOR LISTENING