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 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 %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 |
R8101 |
Import Warning should be renamed as UserError from openerp.exceptions import Warning as UserError |
openerp-exception-warning |
W7901 |
Dangerous filter without explicit user_id in xml_id %s |
dangerous-filter-wo-user |
W7902 |
Duplicate xml record id %s |
duplicate-xml-record-id |
W7903 |
%s |
javascript-lint |
W7904 |
%s:%d Deprecated <openerp> xml node |
deprecated-openerp-xml-node |
W7905 |
%s:%d record res.users without context=”{‘no_reset_password’: True}” |
create-user-wo-reset-password |
W7906 |
Duplicate id “%s” in ir.model.access.csv file |
duplicate-id-csv |
W7907 |
Duplicate xml field “%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:%s Use wrong tabs indentation instead of four spaces |
wrong-tabs-instead-of-spaces |
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 |
W8201 |
Incoherent interpreter comment and executable permission. Interpreter: [%s] Exec perm: %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}
CHANGES
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)
[ADD] odoo-addons-relative-import (#56)
[REF] tox: Freeze stable sha pylint20
[FIX] consider-merging-classes-inherited: Skip check if has ‘_name’ and fix when you use ‘_inherit’ name out of class attribute . Add more tests
[REF] missing-newline-extrafiles: Skip lib folder
[FIX] consider-merging-classes-inherited: Fix leaving module isn’t a good idea. Better close method
[IMP] consider-merging-classes-inherited: Support disable comment
[REF] consider-merging-classes-inherited: Use assign node and better message
[ADD] consider-merging-classes-inherited
[REF] Increase performance
[IMP] pylint_odoo: Enable cProfile print stats
[IMP] deprecated-module: Add exception for the case of valid openerp.osv.expression (#40)
[IMP] sql-injection: Add compatibility with .format (#44)
[REF] translation-required: 100% coverage
[IMP] translation-required: Support % strings
[IMP] translation-required: Support .format
[FIX] translation-required: Fix AttributeError ‘Getattr’ object has no attribute ‘name’
[IMP] translation-required: Just check odoo exceptions
[FIX] odoolint: Remove unsafe eval and reduce mccabe rate
1.3.0
[REF] README: Add new checks (#36)
[FIX] duplicate-xml-fields: Support security xml style (#35)
[ADD] sql-injection: Add new check to avoid sql injection (#29)
[FIX] missing-newline-extrafiles: Fix ‘IOError: [Errno 22] Invalid argument’ by files of size 2 (#37)
[REF] README: Add new checks
[ADD] method-param: Check param method starts with “_param_” (#33)
[FIX] join_node_args_kwargs: AttributeError (#30)
[REF] duplicate-id-csv: Better message of error - Message before: Duplicate id id_example1 in ir.model.access.csv file - Message now: security/ir.model.access.csv duplicated id id_example1
[REF] javascript-lint: Ignore /lib/ subfolder
[ADD] invalid-commit: Add new check invalid-commit - Verify the guideline https://github.com/oca/maintainer-tools/blob/master/CONTRIBUTING.md#never-commit-the-transaction
1.2.0
[REF] README.rst: Updating new checks
[IMP] test: Add tox for multi-environment and add compatiblity with latest version
[ADD] translation-required: Add check to required even a translation (#23)
[IMP] Add pylint check missing newline in extra extension files
[IMP] test: Add tox for multi-environment and add compatiblity with latest version
[IMP] Add Check tabs identation instead of four spaces
better_msg
merge
[REF] test: better way to identify check error expected
[IMP] Add check Duplicate field in xml record (#20)
[IMP] Add pylint check Redundant module name reference in xml_id
[IMP] pylint_odoo: Add check duplicate ids in ir.model.access.csv files
[IMP] pylint_odoo: Add check for manifest-version-format
[FIX] OCA/MQT#302: Use of astroid version 1.3.8
1.1.0
[FIX] setup: Build ChangeLog file
[ADD] Add check ‘deprecated-openerp-xml-node’
[ADD] ChangeLog: Empty file to support auto build
[FIX] Change _fields by _columns
[REF] Fix typo
[IMP] Add check ‘create-user-without-reset-password’
[IMP] Support odoo tag in xml file
[REF] Support of ‘noupdate’ in check ‘duplicate-xml-record-id’
[REF] setup.cfg: Enable ChangeLog
[REF] README: Add new message manifest-author-string
1.0.2
check that author is a string
1.0.1
[REF] Migrate md to rst
1.0.0
[IMP] .travis.yml: Enable auto deploy of pypi package from travis
[ADD] pylint_odoo: Add main package
[ADD] .gitignore: Add file gitignore for first commit
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.