plone / plone.recipe.codeanalysis

provides static code analysis for Buildout-based Python projects, including flake8, JSHint, CSS Lint, and other code checks
https://pypi.org/project/plone.recipe.codeanalysis/
11 stars 8 forks source link

Is it possible to configure a git pre-commit hook for several packages stored in src/ #227

Open gbastien opened 5 years ago

gbastien commented 5 years ago

Hi,

in addition to use code-analysis when developing a package with "his own buildout", we also have dev buildouts that checks out (using mr.developer) many packages in src.

When we commit from one of these packages stored in src/, the git pre-commit hook is not available as the packages in src/ are cloned from others github repositories.

Is there a way to achieve this? If not and if it seem useful to others, we could propose a PR.

Thank you,

Gauthier

MrTango commented 5 years ago

So your commit is inside one of the packages which have there own reposotory right. You could probably configure the hooks inside the packages to run the code-analysis in the upper buildout. But i don't know how this package could solve this for you, it's more on your side to configure the hooks as you need it.

ramiroluz commented 5 years ago

I understood the feature as something like this:

A setting that indicates which sub-package(s) need a pre-hook to be ran. Also, when it runs it uses the root package settings, avoiding to re-configure each sub-package.

gbastien commented 5 years ago

Hi @MrTango @ramiroluz

yes maybe we have to do it ourself ;-) In general, we have the buildout for each package then an "application" buildout that have several packages in dev using mr.developer. In this case, that would be nice that the recipe adds the pre-commit hook to each of the packages that mr.developer manages so each commit in one of these packages run code-analysis.

Thank you for feed back,

Gauthier

ale-rt commented 5 years ago

I am experimenting with this:

[code-analysis]
hook-locations =
    ${buildout:directory}/src/my.package