Is it possible to add pre-commit configuration file to a non-root folder?
Asked Answered
G

1

5

I set up a pre-commit plugin for one of my projects.

Right now, the .pre-commit-config.yaml configuration file is located on the root of the project (as indicated by the official doc https://pre-commit.com/#usage).

Is it possible to move it to a separate folder and adjust it somehow to be read from there?

Current state (output of dir command):

.pre-commit-config.yaml                                                                                                                                                                                                                                                                                                                      
.pylintrc                                                                                                                                                                      
ci                                                                                                                                                                             
commons                                                                                                                                                                        
doc
...         

What I would like to have (or similar):

.pylintrc                                                                                                                                                                      
ci                                                                                                                                                                             
commons                                                                                                                                                                        
doc
precommit\.pre-commit-config.yaml
...         
Genista answered 8/9, 2022 at 11:25 Comment(0)
R
7

yes -- but you shouldn't fight the convention unless you've got a very good reason to do so as it's likely to confuse your contributors and be more annoying to use and you'll be fighting the convention

all of the pre-commit commands support a --config option which allows you to put the configuration anywhere


disclaimer: I wrote pre-commit

Ripping answered 8/9, 2022 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.