Fix for pylint no-self-use error

Pylint reports the following after re-enabling R0201.

************* Module bandit.core.config
R:174, 4: Method could be a function (no-self-use)
************* Module bandit.core.metrics
R: 84, 4: Method could be a function (no-self-use)
************* Module bandit.core.test_set
R: 41, 4: Method could be a function (no-self-use)
************* Module bandit.core.tester
R: 95, 4: Method could be a function (no-self-use)

Change-Id: Ie27fabe517259c3896ee2b302ab7e40aaacc71ab
This commit is contained in:
Eric Brown 2016-11-28 12:37:15 -08:00
parent 3cf14c773e
commit 06681f0e98
5 changed files with 11 additions and 8 deletions

View File

@ -171,7 +171,8 @@ class BanditConfig():
'data plugins')
return bad_calls_list, bad_imports_list
def convert_legacy_blacklist_tests(self, profiles, bad_imports, bad_calls):
@staticmethod
def convert_legacy_blacklist_tests(profiles, bad_imports, bad_calls):
'''Detect old blacklist tests, convert to use new builtin.'''
def _clean_set(name, data):
if name in data:

View File

@ -81,7 +81,8 @@ class Metrics(object):
c.update(self.data[fname])
self.data['_totals'] = dict(c)
def _get_issue_counts(self, scores):
@staticmethod
def _get_issue_counts(scores):
"""Get issue counts aggregated by confidence/severity rankings.
:param scores: list of scores to aggregate / count

View File

@ -38,7 +38,8 @@ class BanditTestSet():
self.plugins.extend(self._load_builtins(filtering, profile))
self._load_tests(config, self.plugins)
def _get_filter(self, config, profile):
@staticmethod
def _get_filter(config, profile):
extman = extension_loader.MANAGER
inc = set(profile.get('include', []))

View File

@ -92,7 +92,8 @@ class BanditTester():
LOG.debug("Returning scores: %s", scores)
return scores
def report_error(self, test, context, error):
@staticmethod
def report_error(test, context, error):
what = "Bandit internal error running: "
what += "%s " % test
what += "on file %s at line %i: " % (

View File

@ -13,8 +13,7 @@
# C0103: invalid-name
# C1001: old-style-class
# E1101: no-member
# R0201: no-self-use
# R0204: redefined-variable-typ
# R0204: redefined-variable-type
# R0902: too-many-instance-attributes
# R0911: too-many-return-statements
# R0912: too-many-branches
@ -31,7 +30,7 @@
# W0613: unused-argument
# W0621: redefined-outer-name
# W0703: broad-except
disable=C0111,C0301,C0325,C1001,F0401,W0511,W0142,W0622,C0103,E1101,R0201,R0204,R0902,R0911,R0912,R0913,R0914,R0915,W0110,W0141,W0201,W0401,W0603,W0212,W0612,W0613,W0621,W0703
disable=C0111,C0301,C0325,C1001,F0401,W0511,W0142,W0622,C0103,E1101,R0204,R0902,R0911,R0912,R0913,R0914,R0915,W0110,W0141,W0201,W0401,W0603,W0212,W0612,W0613,W0621,W0703
[Basic]
# Variable names can be 1 to 31 characters long, with lowercase and underscores
@ -73,4 +72,4 @@ ignore-comments=yes
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
ignore-imports=yes