drupal europe 2018 - lesser known perks of using …...git hooks helps to enforce code quality...
TRANSCRIPT
![Page 1: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/1.jpg)
1axelerant.comwww.drupaleurope.org
![Page 2: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/2.jpg)
2axelerant.com
Lesser known perks of using composer
Drupal Europe 2018
![Page 3: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/3.jpg)
3axelerant.com
Drupal + Technology
TRACK SUPPORTED BY
![Page 4: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/4.jpg)
4axelerant.com
Special Thanks to..
![Page 5: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/5.jpg)
5axelerant.com
Mohit Aghera
Drupal developer @Axelerant
Drupal.org: mohit_aghera
Twitter: @mohit_rocks
![Page 6: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/6.jpg)
6axelerant.com
Quick Introduction
● Why do we need it?● How do we use it?
![Page 7: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/7.jpg)
7axelerant.com
Drupal Composer initiative
Follow updates here: https://www.drupal.org/project/ideas/issues/2958021
![Page 8: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/8.jpg)
8axelerant.com
Composer scripts
● Define script in composer.json and run● Helps to automate tasks● Supports various events.
![Page 9: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/9.jpg)
9axelerant.com
Composer Scripts
![Page 10: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/10.jpg)
10axelerant.com
Composer Plugins
● Helps to overcome limitation of composer scripts● Run independently - irrespective of root package● Helps in creating distributable package
![Page 11: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/11.jpg)
11axelerant.com
Composer Plugins
{
"name": "my/plugin-package",
"type": "composer-plugin",
"require": {
"composer-plugin-api": "^1.1"
},
"extra": {
"class": "My\\Plugin"
}
}
● “type” : “composer-plugin”● “extra” : Contains class name● Add special package called
“composer-plugin-api”
![Page 12: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/12.jpg)
12axelerant.com
Composer Plugins
drupal-composer/drupal-scaffold
![Page 13: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/13.jpg)
13axelerant.com
Composer Plugins
![Page 14: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/14.jpg)
14axelerant.com
Patching
● Requirement to update core of system● Bugs that are not merged
![Page 15: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/15.jpg)
15axelerant.com
Patching
![Page 16: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/16.jpg)
16axelerant.com
Keeping data up to date
● Pull and process remote data automatically● Implement Composer Plugins
![Page 17: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/17.jpg)
17axelerant.com
Keeping data up to date
Benefits:
● No need to have separate sync code● Helps to solve problems in continuous integration as data will already be there
Limitations:
● It is meant for retrieving and storing data - no live sync.
![Page 18: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/18.jpg)
18axelerant.com
Commit Hooks
![Page 19: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/19.jpg)
19axelerant.com
Commit Hooks
● GIT hooks helps to enforce code quality● Ensure commit messages are proper● Coding standards validation● Sharing GIT hooks with composer has more advantages
![Page 20: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/20.jpg)
20axelerant.com
Commit Hooks
There are several libraries that supports this type of implementations:
● https://github.com/sebastianfeldmann/captainhook● https://github.com/bruli/php-git-hooks● https://github.com/php-composter/php-composter● https://github.com/BrainMaestro/composer-git-hooks
![Page 21: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/21.jpg)
21axelerant.com
![Page 22: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/22.jpg)
22axelerant.com
Automatting project structure
● Composer helps to generate essential files and other code● Use case : drupal-composer/drupal-project
![Page 23: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/23.jpg)
23axelerant.com
Automatting project structure
![Page 24: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/24.jpg)
24axelerant.com
Example from “ScriptHandler.php”
![Page 25: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/25.jpg)
25axelerant.com
Thank you..
![Page 26: Drupal Europe 2018 - Lesser known perks of using …...GIT hooks helps to enforce code quality Ensure commit messages are proper Coding standards validation Sharing GIT hooks with](https://reader033.vdocuments.site/reader033/viewer/2022060404/5f0eca507e708231d440f36b/html5/thumbnails/26.jpg)
26axelerant.com
Become a Drupal contributor, Friday from 9 AM
● First timers workshop● Mentored contribution● General contribution
26