Skip to content

pre-commit #23

@florian-dacosta

Description

@florian-dacosta

This issue is here to document what I have done, to use pre-commit with the current template.
This is not the best way and we'll need to improve ourselves, but I want to note the issues I did meet and the workaround until we have a better solution.

For now, if we want to have pre-commit with all the oca linter one solution is to do the following

in /odoo/local-src : copier copy --UNSAFE https://github.com/OCA/oca-addons-repo-template.git .
Answer all questions and then remove the generated repo /odoo/local-src/.github

Then, as pre-commit run always from the root of the git repository, you may want to ignore some files from the project, that are not linted the same ways as OCA (and we don't really want to maintain a linting each time there is a change in OCA...)


bin/*|
.gitlab-ci.yml|
docker-compose.yml|ci.secrets.docker-compose.yml|ci.docker-compose.yml|prod.docker-compose.yml|prod.secrets.docker-compose.yml|
.copier-answers.yml|
odoo/spec.yam
  • add config file from oca that are not linted...
    eslint.config.cjs|prettier.config.cjs

And it seems we have to have a symbolic link at the root of the project with eslint.config.cjs for it to work propertly
ln -s odoo/local-src/eslint.config.cjs eslint.config.cjs

In option, you can remove the missing-readme error if you do not want to manage a readme file in all custom modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions