Pylint plugin for Odoo
Project description
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 start with “_compute_” |
method-compute |
C8109 |
Name of search method should start with “_search_” |
method-search |
C8110 |
Name of inverse method should start 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 |
SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md#no-sql-injection |
sql-injection |
F8101 |
File “%s”: “%s” not found. |
resource-not-exist |
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 |
W7939 |
%s Use <odoo> instead of <odoo><data> or use <odoo noupdate=”1”>instead of <odoo><data noupdate=”1”> |
deprecated-data-xml-node |
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 |
W8114 |
Website “%s” in manifest key is not a valid URI |
website-manifest-key-not-valid-uri |
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
CHANGES
1.8.0
[REF] README: Auto-update Using pylint_odoo.messages2rst()
[REF] cache: Cache other extension files just if is a odoo module (#142)
[IMP] pylint_odoo: Skip pylint check on one xml file (#135)
[ADD] website-manifest-key-not-valid-uri: For validate if the website into manifest is valid URI (#136)
1.7.0
[REF] README: Auto-update Using pylint_odoo.messages2rst()
[ADD] pylint_odoo: Adding new check resource-not-exist (#130)
[FIX] fields: Validate a assign directly from root class (#116)
[FIX] jslintrc: Remove deprecated ecmaFeatures key
[ADD] pylint_odoo: Adding check detected <data> tag inside <odoo> tag and show warning (#129)
[REF] Fix typo
[REF] jslint: Enable no-comma-dangle check
[IMP] sql-injection: support new cases and ignore some false positives (#122)
[FIX] xml-attribute-translatable: Skip if version is different 8.0 (#117)
[FIX] deprecated-module: Consider ‘from openerp.osv.expression’
1.6.0
[REF] README: Auto-update Using the following script: ‘PYTHONPATH=~/odoo/pylint-odoo python -c “import pylint_odoo;print pylint_odoo.messages2rst()”’
[REF] .travis.yml: Renamed flake8 error from F999 to F601 (#115)
[FIX] Check file-not-used: Skip tests folders (#114)
[FIX] incoherent-interpreter-exec-perm: Skip check for windows (#113)
[ADD] except-pass: Emit message If a except:pass is used (#107)
[FIX] attribute-string-redundant: Add “isinstance” validation for nodes
[ADD] attribute-string-redundant: Check if “string” parameter is equal to variable name (#100)
[ADD] renamed-field-parameter: Detect deprecated field values (digits_compute, select) (#99)
[REF] javascript-lint: Use eslint instead of jshint (#97)
[ADD] xml-attribute-translatable: Check XML attribute without translation parameter (#105)
[REF] incoherent-interpreter-exec-perm: Better message (#106)
[IMP] pylint-odoo: Adding support for parameters –ignore and –ignore-patterns (#103)
[ADD] eval-referenced: Detects if a “eval” is referenced (without call it) (#101)
[FIX] duplicate-xml-fields: False red using 2 tree sub-views *2M fields (#96)
[FIX] method-NAME: Fix if value is not a string
[REF] misc: Remove deprecated method
[FIX] test: Never use global into test
1.5.0
[REF] duplicate-xml-record-id: Get xml section from manifest to skip different origin (#89)
[FIX] method-NAME: Fix case compute=None Fix OCA/pylint-odoo#88
1.4.0
[REF] attribute-deprecated: Deprecate length class attribute (#86)
[ADD] missing-return If you use call a `super` method then you will need return the original value. If you want overwrite a original method then you need add documentation of why and add a `pylint: disable=missing-return`
[FIX] Whitelist `anybox.testing.openerp` * Add `anybox.testing.openerp` - Fixes #81
[FIX] manifest-version-format: Fix regex to use explicit dot instead of any char
[FIX] manifest-version-format: Support -e manifest-version-format only
[FIX] missing-import-error: Updating libraries used from requirements.txt but not imported or nested imported from odoo
[IMP] manifest-version-format: Add valid_odoo_versions parameter to force a valid version of odoo in the manifest version
[REF] missing-import-error: Skip test file since these files are loaded only when running tests and in such a case your module and their external dependencies are installed
[ADD] Support for 10.0 manifest name
[REF] requirements: Update developer version of pylint and astroid
1.3.5
Adding isort dependency (#70)
1.3.4
[REF] README: Update messages list
1.3.3
[ADD] missing-import-error, missing-manifest-dependency
[FIX] rst-syntax-error: Skip unknown roles
[FIX] rst-syntax-error: Skip unknown directives
[REF] global refactoring: better message output and use real file and line number in non-py files (#62)
[REF] README: Add examples special folder
[REF] checkers: Skip example folder to check lints
1.3.2
[REF] README: Update messages list
1.3.1
[ADD] file-not-used: Emit message if there are xml, yml, sql or csv files but It isn’t referenced from manifest (#53)
[ADD] dangerous-view-replace-wo-priority: Check dangerous view with replace but defined with low priority (#55)
[ADD] old-api7-method-defined: Emit message if the method defined have (self, cr, uid) (#52)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.