OCA / odoo-pre-commit-hooks

Linters of Odoo addons that complement pylint-odoo
GNU Affero General Public License v3.0
10 stars 12 forks source link

Add environment variable parser #38

Closed moylop260 closed 2 years ago

moylop260 commented 2 years ago

We need 3 ways to configure arguments parameter to hooks

1) hook.py --param1 2) os.environ.get(param1) 3) config_file.cfg param1 4) default value

The priority should be in the same order

I mean, the parameter in the shell overwrite the other 3

I'm not sure about os.environment vs configuration file but you could define the same way than https://click.palletsprojects.com/en/8.1.x/

Disclaimer: Don't use click, only the same criteria

I think it should be

parser(default=os.environ.get("VARIABLE", DEFAULT_VALUE)

https://github.com/OCA/odoo-pre-commit-hooks/blob/710c295aeae768877d51120904ba0a2072a7dba6/src/oca_pre_commit_hooks/cli.py#L42

antonag32 commented 2 years ago

Starting to work on this.