Odoo plugin for Pylint
Clone or download
Pull request Compare This branch is 12 commits ahead, 92 commits behind it-projects-llc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
pylint_odoo
.coveragerc
.gitignore
.travis.yml
ChangeLog
README.rst
install.sh
requirements.txt
setup.cfg
setup.py
tox.ini

README.rst

Build Status Coverage Status Pypi Package

Pylint Odoo plugin

Enable custom checks for Odoo modules.

Code Description Short name
C7902 Missing ./README.rst file. Template here: %s missing-readme
C8101 Missing author required "%s" in manifest file manifest-required-author
C8102 Missing required key "%s" in manifest file manifest-required-key
C8103 Deprecated key "%s" in manifest file manifest-deprecated-key
C8104 Use CamelCase "%s" in class name "%s". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it. class-camelcase
C8105 License "%s" not allowed in manifest file. license-allowed
C8106 Wrong Version Format "%s" in manifest file. Regex to match: "%s" manifest-version-format
C8107 String parameter of raise "%s" requires translation. Use _(%s) translation-required
C8108 Name of compute method should starts with "_compute_" method-compute
C8109 Name of search method should starts with "_search_" method-search
C8110 Name of inverse method should starts with "_inverse_" method-inverse
C8201 No UTF-8 coding comment found: Use # coding: utf-8 or # -*- coding: utf-8 -*- no-utf8-coding-comment
E7901 %s %s rst-syntax-error
E7902 %s error: %s xml-syntax-error
E8101 The author key in the manifest file must be a string (with comma separated values) manifest-author-string
E8102 Use of cr.commit() directly - More info https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#never-commit-the-transaction invalid-commit
E8103 Use of "%" operator in execute database method. Better use parameters instead. - More info https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#no-sql-injection sql-injection
R7980 Consider merging classes inherited to "%s" from %s. consider-merging-classes-inherited
R8101 Import Warning should be renamed as UserError from openerp.exceptions import Warning as UserError openerp-exception-warning
R8110 Method defined with old api version 7 old-api7-method-defined
W7901 %s Dangerous filter without explicit user_id in xml_id %s dangerous-filter-wo-user
W7902 %s Duplicate xml record id "%s" in %s duplicate-xml-record-id
W7903 %s javascript-lint
W7904 %s Deprecated <openerp> xml node deprecated-openerp-xml-node
W7905 %s record res.users without context="{'no_reset_password': True}" create-user-wo-reset-password
W7906 %s Duplicate id "%s" duplicate-id-csv
W7907 %s Duplicate xml field "%s" in lines %s duplicate-xml-fields
W7908 %s Missing newline missing-newline-extrafiles
W7909 %s Redundant name module reference in xml_ids "%s". redundant-modulename-xml
W7910 %s Use wrong tabs indentation instead of four spaces wrong-tabs-instead-of-spaces
W7930 %s not used from manifest file-not-used
W7935 External dependency "%s" without ImportError. More info: https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#external-dependencies missing-import-error
W7936 Missing external dependency "%s" from manifest. More info: https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#external-dependencies missing-manifest-dependency
W7937 %s The xml attribute is missing the translation="off" tag %s xml-attribute-translatable
W7938 pass into block except. If you really need to use the pass consider logging that exception except-pass
W7940 %s Dangerous use of "replace" from view with priority %s < %s dangerous-view-replace-wo-priority
W7950 Same Odoo module absolute import. You should use relative import with "." instead of "openerp.addons.%s" odoo-addons-relative-import
W8101 Detected api.one and api.multi decorators together. api-one-multi-together
W8102 Missing api.one or api.multi in copy function. copy-wo-api-one
W8103 Translation method _("string") in fields is not necessary. translation-field
W8104 api.one deprecated api-one-deprecated
W8105 attribute "%s" deprecated attribute-deprecated
W8106 Missing super call in "%s" method. method-required-super
W8110 Missing return (super is used) in method %s. missing-return
W8111 Field parameter "%s" is no longer supported. Use "%s" instead. renamed-field-parameter
W8112 "eval" referenced detected. eval-referenced
W8113 The attribute string is redundant. String parameter equal to name of variable attribute-string-redundant
W8201 You have a python file with execution permissions but you don't have a interpreter magic comment. If you really needs a execution permission then add a magic comment ( https://en.wikipedia.org/wiki/Shebang_(Unix) ). If you don't needs a execution permission then remove it with: chmod -x %s incoherent-interpreter-exec-perm
W8202 Use of vim comment use-vim-comment

Install

# pip install --upgrade git+https://github.com/oca/pylint-odoo.git

Or

# pip install --upgrade --pre pylint-odoo

Usage

pylint --load-plugins=pylint_odoo -e odoolint ...

Example to test just odoo-lint case:

touch {ADDONS-PATH}/__init__.py

pylint --load-plugins=pylint_odoo -d all -e odoolint {ADDONS-PATH}

If you have external files you can add them in examples folder to skip.

For rst-syntax-error skip unknown directives