OCA / pylint-odoo

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

Ruff support? #479

Closed ahaly-compass closed 8 months ago

ahaly-compass commented 11 months ago

Is there a way to use pylint-odoo with ruff? https://docs.astral.sh/ruff/

How would the pyproject.toml look like? My current config with pylint and pyproject.toml is:

` [tool.poetry] name = "odoo" version = "0.0.1" description = "description " authors = ["authors"] readme = "README.md"

[tool.poetry.dependencies] python = "^3.11"

[tool.poetry.group.dev.dependencies] pylint-odoo = "^8.0.20" ruff = "^0.1.6"

[build-system] build-backend = "poetry.core.masonry.api" requires = [ "poetry-core", ]

[tool.pylint.main] extension-pkg-whitelist = ["lxml"] fail-under = 10 ignore = [ "CVS", ".git", "scenarios", "LICENSE", "*.md", "community", "enterprise", "3rd-party-addons" ] ignore-patterns = ["^\.#"] jobs = 0 limit-inference-results = 100 load-plugins = ["pylint_odoo"] py-version = "3.11" suggestion-mode = true recursive = true

[tool.pylint.basic] good-names = ["_", "cr", "uid", "id", "ids", "_logger"]

[tool.pylint.design] max-args = 10

[tool.pylint.exceptions] overgeneral-exceptions = ["BaseException", "Exception"]

[tool.pylint.format] max-line-length = 120

[tool.pylint."messages control"] disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-symbolic-message-instead", "missing-module-docstring", "missing-class-docstring", "missing-function-docstring", "too-many-instance-attributes", "unsubscriptable-object", "protected-access", "no-member", "too-many-branches", "attribute-defined-outside-init", "access-member-before-definition", "too-few-public-methods", "missing-readme", "arguments-renamed", "cell-var-from-loop", "no-name-in-module", "import-error", "trailing-whitespace"]

[tool.pylint.odoolint] license-allowed = ["OPL-1", "AGPL-3", "GPL-2", "GPL-2 or any later version", "GPL-3", "GPL-3 or any later version", "LGPL-3"] manifest-deprecated-keys = ["description", "active"] manifest-required-authors = ["Company"] manifest-required-keys = ["license", "installable"] manifest-version-format = "({valid_odoo_versions})\.\d+\.\d+\.\d+$" valid-odoo-versions = ["15.0", "16.0", "17.0"]

[tool.pylint.reports] msg-template = "{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" output-format = "colorized" reports = false

[tool.pylint.similarities] ignore-comments = true ignore-docstrings = true min-similarity-lines = 8 `

antonag32 commented 11 months ago

Hello, AFAIK, Ruff has no support for a plugin system: https://github.com/astral-sh/ruff/issues/283

So it seems like it is not possible yet and it does not depend on us, but on ruff itself (upstream). However you can still use ruff for your Odoo projects, in fact it was done for the repo template on branch 17.0:

However you can use ruff and ruff format in your Odoo projects for other checks, in fact is has been done in 17.0

The only possible way I can think of to use pylint-odoo with ruff, would be to fork the project and add custom rules ourselves, but seems out of the scope.

antonag32 commented 8 months ago

Since there is no official plugin system in Ruff, it is written in a different language (Rust) and there has been no further discussion, I am closing this.