36 Commits

Author SHA1 Message Date
Yves-Gwenael Bourhis
66144165ff Use the python real executable
Use the real python executable as shebang
Use exec instead of execfile if using python 3

Change-Id: I8acea40851c7e9dc248751be967859b2b9430af7
Closes-Bug: #1836580
2019-07-17 16:23:33 +02:00
Akihiro Motoki
949802264e pylint: fix cyclic-import
openstack_dashboard/api nova.py and cinder.py are imported
by each other. To avoid cyclic imports, some imports are placed
inside functions now, but it would be nice if we can move them
to a separate module and nova.py/cinder.py can import it.

This commit tries to achieve this by moving some stuffs in nova.py
into a separate module named _nova.py.
The module name starts with an underscore to clarify
it is intended to use only in openstack_dashboard.api.

Change-Id: If91cf4f30d2ddab471757129c2a74b26b6d38b1e
2019-02-09 21:08:48 +09:00
Akihiro Motoki
a984ae43e5 pylint: fix raising-non-exception error
django.http.HttpResponseNotFound is not an exception.
Django recommends to return it. @rest_utils.ajax can handle it.

Change-Id: I26f82da022a2c2725d62cc136c5da8eafc0ac26f
2019-01-20 05:48:09 +09:00
Akihiro Motoki
9518f7a5e7 pylint: fix unexpected-keyword-arg error
horizon/forms/fields.py:
ThemableCheckboxSelectMultiple.__init__ does not have
arguments "name" and "value". They were specified before somehow.

openstack_dashboard/dashboards/project/instances/forms.py:
messages.error() does not have "redirect" argument.
We need to redirect explicitly.

Change-Id: Ib51abf136fb49e3be65005c5f48715f004379178
2019-01-17 03:29:56 +09:00
Zuul
64542397d8 Merge "pylint: fix too-many-nested-blocks/redefined-argument-from-local" 2019-01-16 17:57:15 +00:00
Zuul
60dd57655b Merge "pylint: fix some refactor recommendations" 2019-01-16 17:57:12 +00:00
Zuul
d9e992a4cb Merge "pylint: fix redundant-keyword-arg error" 2019-01-16 17:57:09 +00:00
Zuul
272256e00f Merge "pylint: Ignore existing misplaced-bare-raise error" 2019-01-16 17:57:07 +00:00
Akihiro Motoki
0d39a5c33a pylint: Ignore existing misplaced-bare-raise error
Change-Id: I8bb2b64cb51f297cac53bf042d4d2bd1fdb0a159
2019-01-17 00:51:04 +09:00
Akihiro Motoki
150dcc3fb0 pylint: fix redundant-keyword-arg error
pylint complains 'name' argument is redundant
in positional and keyword arguments.
The existence of 'name' in kwargs is checked before passing to
api.keystone.tenant_create, so we can pass 'name' as part of kwargs.

Change-Id: Ice09cecb21217b042d44a8c1dda7a4736e2b391b
2019-01-17 00:47:31 +09:00
Akihiro Motoki
7c585e2643 pylint: fix some refactor recommendations
openstack_dashboard/dashboards/project/security_groups/forms.py:393:13: R1714: Consider merging these comparisons with "in" to "rule_menu in ('tcp', 'udp')" (consider-using-in)
openstack_dashboard/api/rest/json_encoder.py:61:15: R0124: Redundant comparison - o != o (comparison-with-itself)
openstack_dashboard/api/keystone.py:904:15: R1714: Consider merging these comparisons with "in" to 'default in (role.id, role.name)' (consider-using-in)
horizon/templatetags/truncate_filter.py:30:7: R1716: Simplify chained comparison between the operands (chained-comparison)

Change-Id: I6cf8602f88c4027ff12aaa4ea5a9f2069ae2e2a6
2019-01-17 00:44:19 +09:00
Akihiro Motoki
9578949638 pylint: fix too-many-nested-blocks/redefined-argument-from-local
openstack_dashboard/dashboards/project/cgroups/workflows.py:313:8: R1702: Too many nested blocks (6/5) (too-many-nested-blocks)
openstack_auth/plugin/base.py:221:12: R1704: Redefining argument with the local name 'domain_name' (redefined-argument-from-local)
horizon/tables/formset.py:59:16: R1704: Redefining argument with the local name 'column' (redefined-argument-from-local)

Change-Id: Ifeb192efac83c0b2d5399c51f66c8fb8f8969fc0
2019-01-17 00:41:20 +09:00
Akihiro Motoki
ac7ac272b3 pylint: fix several coding convention violations
openstack_dashboard/context_processors.py:94:15: C0122: Comparison should be link['url'] != 'horizon:project:api_access:openrcv2' (misplaced-comparison-constant)
openstack_dashboard/settings.py:467:4: C0412: Imports from package horizon are not grouped (ungrouped-imports)
openstack_dashboard/enabled/_1370_project_vg_snapshots.py:9:0: C0301: Line too long (86/80) (line-too-long)
openstack_dashboard/enabled/_1360_project_volume_groups.py:9:0: C0301: Line too long (85/80) (line-too-long)
openstack_dashboard/usage/base.py:62:8: W0106: Expression "[instance_list.extend(u.server_usages) for u in self.usage_list]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:43:12: W0106: Expression "[public_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/dashboards/project/images/utils.py:75:12: W0106: Expression "[community_images.append(image) for image in images]" is assigned to nothing (expression-not-assigned)
openstack_dashboard/api/glance.py:47:4: C0412: Imports from package glanceclient are not grouped (ungrouped-imports)
openstack_dashboard/api/cinder.py:60:4: C0412: Imports from package cinderclient are not grouped (ungrouped-imports)
openstack_auth/user.py:358:4: E0211: Method has no argument (no-method-argument)
openstack_auth/user.py:362:4: E0211: Method has no argument (no-method-argument)
openstack_dashboard/api/keystone.py:75:4: C0412: Imports from package keystoneclient are not grouped (ungrouped-imports)
horizon/loaders.py:43:16: W0706: The except handler raises immediately (try-except-raise)
horizon/themes.py:174:8: W0706: The except handler raises immediately (try-except-raise)

Change-Id: I40cf3ffbc4519657e11180d2e2fe7401387c5556
2019-01-17 00:05:27 +09:00
Zuul
c9536342c2 Merge "pylint: fix len-as-condition warning" 2019-01-16 14:25:39 +00:00
Zuul
32f5338a4f Merge "pylint: fix useless-super-delegation warning" 2019-01-16 14:25:24 +00:00
Zuul
5dcf0db34b Merge "pylint: fix trailing-comma-tuple warning" 2019-01-16 14:25:21 +00:00
Zuul
d0a1a16415 Merge "pylint: fix unnecessary-pass warning" 2019-01-16 14:25:19 +00:00
Zuul
e62a6bff13 Merge "pylint: fix simplifiable-if-statement/expression" 2019-01-16 14:25:17 +00:00
Akihiro Motoki
4dd8e3d407 pylint: fix bad-mcs-classmethod-argument warning
Change-Id: Idfa421774ac23f673007fe7a7381c5199ccda5e0
2019-01-16 13:16:55 +09:00
Akihiro Motoki
f6e1338cde pylint: fix unnecessary-pass warning
Change-Id: Ie2e5c6482a19553f6c73c50555d65834bb62ca9e
2019-01-16 13:10:16 +09:00
Akihiro Motoki
a8edb5059d pylint: fix simplifiable-if-statement/expression
Change-Id: I9af66f886c47d3d2be61cba22b6c84460a178b8e
2019-01-16 13:08:08 +09:00
Akihiro Motoki
786fb183e8 pylint: fix trailing-comma-tuple warning
Change-Id: I72fa6cacef70e80f95b76e2aa3cefbffad73edb5
2019-01-16 13:06:55 +09:00
Akihiro Motoki
e9f75a7bcb pylint: fix useless-super-delegation warning
Change-Id: Iddea27e720dc7184fa3d524a2a465732f18d4dee
2019-01-16 13:05:09 +09:00
Akihiro Motoki
c076db20c8 pylint: fix len-as-condition warning
Change-Id: Ib89c1854ad42b96e4caf281160d568fe98430afe
2019-01-16 12:56:20 +09:00
Akihiro Motoki
3143edef01 pylint: fix import-error
It seems pylint cannot handle distutils imports
and shows "import-error" error. I believe it sounds
reasonable to ignore this case.

Change-Id: Ia08b4fbf8c3270aa37cd88967add8258f6b26377
2019-01-16 00:00:58 +09:00
Akihiro Motoki
6ce323307d pylint: fixes several errors
openstack_dashboard/hooks.py:16:0: E0611: No name 'command' in module 'distutils' (no-name-in-module)

openstack_dashboard/dashboards/project/networks/ports/sg_base.py:52:12: E1111: Assigning result of a function call, where the function has no return (assignment-from-no-return)
BaseSecurityGroupsAction._get_initial_security_groups() is now marked
as abstract method because this method must be implemented in subclasses.
BaseSecurityGroupsAction.handle() is now dropped because there is
no difference from the parent class (horizon.workflows.Action).

openstack_auth/views.py:211:4: E1206: Not enough arguments for logging format string (logging-too-few-args)
openstack_auth/views.py:269:8: E1206: Not enough arguments for logging format string (logging-too-few-args)
openstack_auth/plugin/base.py:237:20: E1206: Not enough arguments for logging format string (logging-too-few-args)

horizon/base.py:166:24: E1133: Non-iterable value self.policy_rules is used in an iterating context (not-an-iterable)
horizon/tabs/base.py:489:40: E1133: Non-iterable value self.table_classes is used in an iterating context (not-an-iterable)

Change-Id: I0b045d04af251854b5017c9f698e3b40503a0724
2019-01-16 00:00:07 +09:00
Zuul
6299fdbdc0 Merge "pylint: fix several warnings" 2019-01-15 11:22:36 +00:00
Zuul
f1fb3d168c Merge "pylint: ignore access-member-before-definition explicitly" 2019-01-15 11:22:29 +00:00
Zuul
071b5c9fa9 Merge "pylint: Drop non-existing IPAddressField" 2019-01-15 11:22:27 +00:00
Akihiro Motoki
f3bd271fc9 pylint: fix bad-super-call
Change-Id: Ia81e5c8b77dbfcb48630b1736d581cdff73278ef
2019-01-15 01:11:33 +09:00
Akihiro Motoki
51251d9d67 pylint: Drop non-existing IPAddressField
horizon/forms/__init__.py exposed IPAddressField via __all__,
but IPAddressField does not exist in Django code.
It addresses pylint undefined-all-variable error.

Change-Id: I5e5cc802c0d75e91fad769cc381368b532561476
2019-01-15 01:07:04 +09:00
Akihiro Motoki
86d1826a29 pylint: ignore access-member-before-definition explicitly
In case of Cell.status property, the code has a good readability,
so it sounds reasonable to ignore access-member-before-definition,
although access-member-before-definition itself is a useful check.

Change-Id: Ic6f2ec42bac41c62265e6b0e744c256007093ce6
2019-01-15 01:05:49 +09:00
Akihiro Motoki
6e1348d05f pylint: fix several warnings
openstack_dashboard/theme_settings.py:63:8: W1201: Specify string format arguments as logging function parameters (logging-not-lazy)
openstack_dashboard/settings.py:412:24: W0122: Use of exec (exec-used)
openstack_dashboard/dashboards/identity/domains/workflows.py:476:44: W0640: Cell variable group_id defined in loop (cell-var-from-loop)
openstack_dashboard/dashboards/identity/projects/workflows.py:906:49: W0640: Cell variable group_id defined in loop (cell-var-from-loop)
openstack_dashboard/dashboards/admin/networks/views.py:42:0: W0404: Reimport 'views' (imported line 28) (reimported)
openstack_dashboard/api/swift.py:204:0: W0102: Dangerous default value {} as argument (dangerous-default-value)
openstack_dashboard/api/swift.py:214:0: W0102: Dangerous default value {} as argument (dangerous-default-value)
openstack_dashboard/api/cinder.py:248:30: W0631: Using possibly undefined loop variable 'cinder_url' (undefined-loop-variable)
openstack_auth/backend.py:123:28: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/backend.py:129:39: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/backend.py:131:39: W0631: Using possibly undefined loop variable 'plugin' (undefined-loop-variable)
openstack_auth/views.py:39:0: W0611: Unused Login imported from openstack_auth.forms (unused-import)
horizon/exceptions.py:348:8: W0125: Using a conditional statement with a constant value (using-constant-test)
horizon/tables/base.py:353:12: W0715: Exception arguments suggest string formatting might be intended (raising-format-tuple)

Change-Id: Icf4f22abda77c9dbf98c780de876b7836c31d669
2019-01-15 00:22:27 +09:00
Akihiro Motoki
59beb951a3 pylint: Fix consider-using-(dict|set)-comprehension
Change-Id: I81c694c17106c179a53326a12e78cfa899872970
2019-01-13 00:59:05 +09:00
Akihiro Motoki
220b1346bd Enable pylint in horizon
tests.py files are excluded from targets checked by pylint
because it takes longer and longer time to check them somehow.

pylint 2.2.x is supported only in Python 3 and we already switched
our pep8 basepython to python3, so pylint and astroid are installed
only for python3. This seems the easiest way to ensure py27 env works.

literal-comparison error in openstack_dashboard/api/nova.py
is also fixed in this commit as it is simple enough.

Change-Id: Ic8868a44b296dba457be721716ca6f9d37ad9369
2019-01-12 22:41:20 +09:00
Joe Heck
6d633a9ec7 updating run_tests.sh to mimic other openstack projects, pep8, pylint, coverage 2011-08-31 14:41:36 -07:00