OCA / pylint-odoo

Odoo plugin for Pylint
http://www.pylint.org
143 stars 168 forks source link

Cannot add pylint-odoo to the pre-commit #460

Closed much-aydin closed 1 year ago

much-aydin commented 1 year ago

Module

pylint-odoo

Describe the bug

After trying to make a commit I get


[ERROR] `pylint` is not present in repository https://github.com/OCA/pylint-odoo.  Typo? Perhaps it is introduced in a newer version?  Often `pre-commit autoupdate` fixes this.```
moylop260 commented 1 year ago

Could you share more details, please?

Impacted versions:

Steps to reproduce:

Current behavior:

Expected behavior:

Video/Screenshot link (optional):

Include your configuration files used
davdenic commented 1 year ago

I've the same issue, while running the pre-commit I have the error but if I run the pylint command I have no error:

odoo 16.0 python 3.11.4 pylint 2.15.10

here my .pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-yaml
      - id: end-of-file-fixer
      - id: trailing-whitespace

  - repo: https://github.com/OCA/pylint-odoo
    rev: v8.0.19
    hooks:
      - id: pylint
        args:
          - --rcfile=.pylintrc

here my .pylintrc

[MASTER]
fail-under=10
ignore=CVS,LICENSE,README.rst,README.md
ignore-paths=
ignore-patterns=^\.#
init-hook='import sys; sys.path.append("/Volumes/DEV/odoo/odoo")'
load-plugins=pylint_odoo
py-version=3.11
suggestion-mode=yes
disable=C0114,C0115,W0611

when I say pylint command I mean the pylint --load-plugins=pylint_odoo -d all -e my_module/* or pylint --rcfile=.pylintrc my_module/* both are working:

Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

While I git commit then I have the error:

[ERROR] pylint is not present in repository https://github.com/OCA/pylint-odoo. Typo? Perhaps it is introduced in a newer version? Often pre-commit autoupdate fixes this.

I try the proposed solution pre-commit autoupdate and I get this message: [https://github.com/OCA/pylint-odoo] Cannot update because the update target is missing these hooks: pylint

Thanks

antonag32 commented 1 year ago

@davdenic I think the id you should use is pylint_odoo, try:

- repo: https://github.com/OCA/pylint-odoo
    rev: v8.0.19
    hooks:
      - id: pylint_odoo
        args:
          - --rcfile=.pylintrc
antonag32 commented 1 year ago

There is an issue in the documentation, which shows the wrong hook id (pylint instead of pylint_odoo). Should fix that.

moylop260 commented 1 year ago

Fixed documentation from https://github.com/OCA/pylint-odoo/pull/463