Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Pylint tests for Beta|Stable|Mature on development_status #602

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 10 additions & 74 deletions travis/cfg/travis_run_pylint_beta.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,19 @@ cache-size=500
[MESSAGES CONTROL]
disable=all

# Beta message and code:
# api-one-deprecated - W8104
# api-one-multi-together - W8101
# attribute-deprecated - W8105
# class-camelcase - C8104
# create-user-wo-reset-password - W7905
# consider-merging-classes-inherited - R7980
# copy-wo-api-one - W8102
# dangerous-filter-wo-user - W7901
# dangerous-view-replace-wo-priority - W7940
# deprecated-module - W0402
# duplicate-id-csv - W7906
# duplicate-xml-fields - W7907
# duplicate-xml-record-id - W7902
# file-not-used - W7930
# incoherent-interpreter-exec-perm - W8201
# invalid-commit - E8102
# javascript-lint - W7903
# manifest-deprecated-key - C8103
# method-compute - C8108
# method-inverse - C8110
# method-required-super - W8106
# method-search - C8109
# missing-newline-extrafiles - W7908
# Enable message and code:
# missing-readme - C7902
# no-utf8-coding-comment - C8201
# unnecessary-utf8-coding-comment - C8202
# odoo-addons-relative-import - W7950
# old-api7-method-defined - R8110
# openerp-exception-warning - R8101
# redundant-modulename-xml - W7909
# sql-injection - E8103
# too-complex - C0901
# translation-field - W8103
# translation-required - C8107
# use-vim-comment - W8202
# wrong-tabs-instead-of-spaces - W7910
# xml-syntax-error - E7902
# manifest-required-author - C8101
# missing-manifest-dependency - W7936
# rst-syntax-error - E7901

enable=api-one-deprecated,
api-one-multi-together,
attribute-deprecated,
class-camelcase,
create-user-wo-reset-password,
consider-merging-classes-inherited,
copy-wo-api-one,
dangerous-filter-wo-user,
dangerous-view-replace-wo-priority,
deprecated-module,
duplicate-id-csv,
duplicate-xml-fields,
duplicate-xml-record-id,
file-not-used,
incoherent-interpreter-exec-perm,
invalid-commit,
javascript-lint,
manifest-deprecated-key,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-newline-extrafiles,

enable=rst-syntax-error,
missing-readme,
no-utf8-coding-comment,
unnecessary-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
openerp-exception-warning,
redefined-builtin,
redundant-modulename-xml,
sql-injection,
too-complex,
translation-field,
translation-required,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
manifest-required-author,
development-status-allowed,
missing-manifest-dependency,


[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
Expand Down
104 changes: 104 additions & 0 deletions travis/cfg/travis_run_pylint_mature.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[MASTER]
profile=no
ignore=CVS,.git,scenarios,.bzr
persistent=yes
cache-size=500

[MESSAGES CONTROL]
disable=all

# Mature message and code:
# api-one-deprecated - W8104
# api-one-multi-together - W8101
# attribute-deprecated - W8105
# class-camelcase - C8104
# create-user-wo-reset-password - W7905
# consider-merging-classes-inherited - R7980
# copy-wo-api-one - W8102
# dangerous-filter-wo-user - W7901
# dangerous-view-replace-wo-priority - W7940
# deprecated-module - W0402
# duplicate-id-csv - W7906
# duplicate-xml-fields - W7907
# duplicate-xml-record-id - W7902
# file-not-used - W7930
# incoherent-interpreter-exec-perm - W8201
# invalid-commit - E8102
# javascript-lint - W7903
# manifest-deprecated-key - C8103
# method-compute - C8108
# method-inverse - C8110
# method-required-super - W8106
# method-search - C8109
# missing-newline-extrafiles - W7908
# missing-readme - C7902
# no-utf8-coding-comment - C8201
# unnecessary-utf8-coding-comment - C8202
# odoo-addons-relative-import - W7950
# old-api7-method-defined - R8110
# openerp-exception-warning - R8101
# redundant-modulename-xml - W7909
# sql-injection - E8103
# too-complex - C0901
# translation-field - W8103
# translation-required - C8107
# use-vim-comment - W8202
# wrong-tabs-instead-of-spaces - W7910
# xml-syntax-error - E7902

enable=api-one-deprecated,
api-one-multi-together,
attribute-deprecated,
class-camelcase,
create-user-wo-reset-password,
consider-merging-classes-inherited,
copy-wo-api-one,
dangerous-filter-wo-user,
dangerous-view-replace-wo-priority,
deprecated-module,
duplicate-id-csv,
duplicate-xml-fields,
duplicate-xml-record-id,
file-not-used,
incoherent-interpreter-exec-perm,
invalid-commit,
javascript-lint,
manifest-deprecated-key,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
unnecessary-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
openerp-exception-warning,
redefined-builtin,
redundant-modulename-xml,
sql-injection,
too-complex,
translation-field,
translation-required,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,

[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
files-output=no
reports=no
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
comment=no

[FORMAT]
indent-string=' '

[SIMILARITIES]
ignore-comments=yes
ignore-docstrings=yes

[MISCELLANEOUS]
notes=
104 changes: 104 additions & 0 deletions travis/cfg/travis_run_pylint_stable.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[MASTER]
profile=no
ignore=CVS,.git,scenarios,.bzr
persistent=yes
cache-size=500

[MESSAGES CONTROL]
disable=all

# Stable message and code:
# api-one-deprecated - W8104
# api-one-multi-together - W8101
# attribute-deprecated - W8105
# class-camelcase - C8104
# create-user-wo-reset-password - W7905
# consider-merging-classes-inherited - R7980
# copy-wo-api-one - W8102
# dangerous-filter-wo-user - W7901
# dangerous-view-replace-wo-priority - W7940
# deprecated-module - W0402
# duplicate-id-csv - W7906
# duplicate-xml-fields - W7907
# duplicate-xml-record-id - W7902
# file-not-used - W7930
# incoherent-interpreter-exec-perm - W8201
# invalid-commit - E8102
# javascript-lint - W7903
# manifest-deprecated-key - C8103
# method-compute - C8108
# method-inverse - C8110
# method-required-super - W8106
# method-search - C8109
# missing-newline-extrafiles - W7908
# missing-readme - C7902
# no-utf8-coding-comment - C8201
# unnecessary-utf8-coding-comment - C8202
# odoo-addons-relative-import - W7950
# old-api7-method-defined - R8110
# openerp-exception-warning - R8101
# redundant-modulename-xml - W7909
# sql-injection - E8103
# too-complex - C0901
# translation-field - W8103
# translation-required - C8107
# use-vim-comment - W8202
# wrong-tabs-instead-of-spaces - W7910
# xml-syntax-error - E7902

enable=api-one-deprecated,
api-one-multi-together,
attribute-deprecated,
class-camelcase,
create-user-wo-reset-password,
consider-merging-classes-inherited,
copy-wo-api-one,
dangerous-filter-wo-user,
dangerous-view-replace-wo-priority,
deprecated-module,
duplicate-id-csv,
duplicate-xml-fields,
duplicate-xml-record-id,
file-not-used,
incoherent-interpreter-exec-perm,
invalid-commit,
javascript-lint,
manifest-deprecated-key,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
unnecessary-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
openerp-exception-warning,
redefined-builtin,
redundant-modulename-xml,
sql-injection,
too-complex,
translation-field,
translation-required,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,

[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
files-output=no
reports=no
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
comment=no

[FORMAT]
indent-string=' '

[SIMILARITIES]
ignore-comments=yes
ignore-docstrings=yes

[MISCELLANEOUS]
notes=
15 changes: 13 additions & 2 deletions travis/run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ def get_branch_base():
branch_base = 'origin/' + (branch_base and branch_base or '')
return branch_base

def get_status_module(path):
if path and os.path.isdir(path):
for module in os.listdir(path):
manifest_path = is_module(os.path.join(path, module))
if manifest_path:
manifest = ast.literal_eval(open(manifest_path).read())
if manifest.get('development_status'):
return manifest.get('development_status').lower()
return 'Beta'.lower()

def pylint_run(is_pr, version, dir):
# Look for an environment variable
Expand All @@ -158,12 +167,15 @@ def pylint_run(is_pr, version, dir):
'cfg', "travis_run_pylint_pr.cfg")
odoo_version = version_validate(version, dir)
modules_cmd = get_modules_cmd(dir)
pylint_config_file_status = 'travis_run_pylint_%s.cfg'%(get_status_module(dir))
pylint_rcfile_status = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'cfg', pylint_config_file_status)
beta_msgs = get_beta_msgs()
branch_base = get_branch_base()
extra_params_cmd = get_extra_params(odoo_version)
extra_info = "extra_params_cmd %s " % extra_params_cmd
print(extra_info)
conf = ["--config-file=%s" % (pylint_rcfile)]
conf = ["--config-file=%s" % (pylint_rcfile_status)]
cmd = conf + modules_cmd + extra_params_cmd

real_errors = main(cmd, standalone_mode=False)
Expand Down Expand Up @@ -229,7 +241,6 @@ def is_installable_module(path):
return manifest_path
return False


def get_subpaths(paths, depth=1):
"""Get list of subdirectories
if `__init__.py` file doesn't exists in root path, then
Expand Down
22 changes: 22 additions & 0 deletions travis/test_pylint
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Use the following types of pylint configuration files:
2) Pull request
3) Version
4) Beta
5) Stable
6) Mature


1) Global
Expand Down Expand Up @@ -40,6 +42,26 @@ Use the following types of pylint configuration files:
status.

File name: `travis_run_pylint_beta.cfg`

5) Beta - level 1

Used for enable checks just for modules with deployment_status==Beta where
other ones checks are disabled

File name: `travis_run_pylint_beta.cfg`

5) Stable - level 2

Used for enable checks just for modules with deployment_status==Stable

File name: `travis_run_pylint_stable.cfg`


5) Mature - level 3

Used for enable checks just for modules with deployment_status==Mature

File name: `travis_run_pylint_mature.cfg`
"""


Expand Down