Bug 13093

Summary: Fix pylint reported issues
Product: [Yocto Project Subprojects] Security Response Tool Reporter: David Reyna <david.reyna>
Component: GeneralAssignee: David Reyna <david.reyna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: ross.burton
Version: 2.7   
Target Milestone: 2.7 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description David Reyna 2018-12-19 09:22:28 UTC
These are issues reported from Ross by pylint :


 PYTHONPATH=bin/:lib/ pylint --load-plugins pylint_django -E lib
************* Module lib.srtmain.urls
lib/srtmain/urls.py:102:26: E1101: Instance of 'URLResolver' has no
'regex' member (no-member)
lib/srtmain/urls.py:102:26: E1101: Instance of 'URLPattern' has no
'regex' member (no-member)
************* Module lib.acme.views
lib/acme/views.py:46:24: E0602: Undefined variable 'landing'
(undefined-variable)
************* Module lib.users.views
lib/users/views.py:84:4: E0602: Undefined variable 'url' (undefined-variable)
lib/users/views.py:84:41: E0602: Undefined variable 'views' (undefined-variable)
lib/users/views.py:98:32: E0602: Undefined variable 'landing'
(undefined-variable)
lib/users/views.py:211:64: E1101: Class 'traceback' has no
'format_exc' member (no-member)
lib/users/views.py:211:64: E0602: Undefined variable 'traceback'
(undefined-variable)
************* Module lib.orm.models
lib/orm/models.py:498:31: E0602: Undefined variable
'VulnerabilityProduct' (undefined-variable)
lib/orm/models.py:541:26: E0602: Undefined variable 'key_prime'
(undefined-variable)
lib/orm/models.py:541:36: E0602: Undefined variable 'key_sub'
(undefined-variable)
lib/orm/models.py:657:28: E0602: Undefined variable
'VulnerabilityProduct' (undefined-variable)
lib/orm/models.py:657:95: E0602: Undefined variable
'VulnerabilityProduct' (undefined-variable)
lib/orm/models.py:665:27: E0602: Undefined variable
'VulnerabilityProduct' (undefined-variable)
lib/orm/models.py:665:94: E0602: Undefined variable
'VulnerabilityProduct' (undefined-variable)
lib/orm/models.py:831:11: E0602: Undefined variable 'release_version'
(undefined-variable)
lib/orm/models.py:904:11: E0602: Undefined variable 'vulnerability'
(undefined-variable)
lib/orm/models.py:904:29: E0602: Undefined variable 'vulnerability'
(undefined-variable)
lib/orm/models.py:905:42: E1101: Instance of 'Investigation' has no
'cve' member (no-member)
lib/orm/models.py:980:26: E1101: Instance of 'dict' has no 'iteritems'
member (no-member)
************* Module lib.srtgui.typeaheads
lib/srtgui/typeaheads.py:22:0: E0611: No name 'Project' in module
'orm.models' (no-name-in-module)
************* Module lib.srtgui.widgets
lib/srtgui/widgets.py:465:18: E0602: Undefined variable 'Project'
(undefined-variable)
lib/srtgui/widgets.py:469:18: E1121: Too many positional arguments for
method call (too-many-function-args)
************* Module lib.srtgui.views
lib/srtgui/views.py:724:23: E1120: No value for argument 'context' in
function call (no-value-for-parameter)
lib/srtgui/views.py:802:23: E1120: No value for argument 'context' in
function call (no-value-for-parameter)
Comment 1 David Reyna 2018-12-21 22:48:35 UTC
1. The reported pylint issues have been resolved.

Two exceptions were disabled in "lib/srtgui/urls.py" for code that supports the different APIs between Django-1.11 and Django-2.x.

2. For reference, here was my process for installing and running pylint on my Ubuntu-16.04 host. My host has both Python-2 and Python-3, and the SRTool is designed for Python-3.

 $ sudo apt install pylint3
 $ pip3 install pylint_django
 $ PYTHONPATH=bin/:lib/ pylint3 --load-plugins pylint_django -E lib
Comment 2 David Reyna 2019-01-12 18:31:04 UTC
Implemented and documented.