Having an automated code formatting and php unit runner is a great addition to your automation.
I work in a team where different developers have different habit when it comes to code formatting. Yes, they are small things I know. But, I spend a lot of time in code review. And, reading other's code is always difficult if the formatting is different. And hence, I want to ensure that the code formatting, structure etc are as much similar as possible. It reduces a lot of load from the code review process and speeds up things.
Plus, the aspect of automatically running the unit tests before every code commit is one check enforced for the developer to ensure that his new code is not breaking something which is running properly right now and was working before he / she made any code changes.
And, hence I looked at different options and this combination of husky to hook into the git hooks and lint-staged to get the context of the files which are staged are really helpful.
In this article, I will explain how I did the setup of these two npm modules to ensure code formatting and running php unit before every git push.
Hope you like it, and feel free to leave comments about your views.