pre-commit-maven icon indicating copy to clipboard operation
pre-commit-maven copied to clipboard

Configure maven-checkstyle hook

Open patilarpith opened this issue 4 years ago • 3 comments

Wondering if there's a way to pass checkstyle rules xml file as a parameter to the hook

patilarpith avatar Jun 07 '21 09:06 patilarpith

Hi @patilarpith, parametrisation is not available because you can configure the location of the rules file through the property configLocation on the POM file. Although, the hook "maven" gives the flexibility to configure anything you want.

ejba avatar Jun 07 '21 11:06 ejba

@ejba Does that mean the checkstyle check is run on the entire project, not just for the files staged for commit?

patilarpith avatar Jun 07 '21 12:06 patilarpith

The library is not aware of the "git" context where it is inserted, only runs the configured commands. So, it always runs upon the entire project. Eventually, I will adapt give support to run only on staged files (or on modules with staged files) but I cannot promise when I will add this because I do not have spare time that I can spend. That is why I giving you those options for now.

ejba avatar Jun 07 '21 12:06 ejba