A
A
Alexander Arbuzov2018-09-17 10:29:50
git
Alexander Arbuzov, 2018-09-17 10:29:50

How to set up git to check var_dump in code before commit?

How to set up git to check the code before commit, so that there are no debugging things in the code, var_dump, console.log, etc.?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
l4m3r, 2018-09-17
@arbuzzz

pre commit hook?

A
Alexander Novikov, 2018-09-17
@AlexndrNovikov

1) Connect phpcs to check the code style (specifically configure https://github.com/squizlabs/PHP_CodeSniffer/wiki/... section Generic.PHP.ForbiddenFunctions)
2) Automate checking on the git side - precommit hook (for example https:/ /habr.com/post/111977/ here is an example)
3) Ideally, if there is more than one developer, then add the launch of this phpcs task to the CI process (for example, in Jenkins).
Since locally someone may not set up a hook, but if you want or don’t want a remote build, they will check it.
That is, the best option is
1) add phpcs to composer
2) write the necessary ruleset (in your case, specifying genericphpforbiddenfunctions)
3) add a task to the builder (for example, phing) to launch phpcs with the configs of the required ruleset
4) add a local hook to launch phing phpcs
5) add the launch of phing phpcs to the jenkins build

E
Evgeny Komarov, 2018-09-17
@maNULL

1. Forget about using "any debugging things, var_dump, console.log, etc." (use normal debug tools)
2. Core-review before pushing to production

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question