Convert three assignments to augmented source code #760
Closed
Description
opened on Nov 21, 2021
👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.
diff --git a/bandit/core/context.py b/bandit/core/context.py
index 139deb5..8b2fe26 100644
--- a/bandit/core/context.py
+++ b/bandit/core/context.py
@@ -190,7 +190,7 @@ class Context(object):
elif isinstance(literal, ast.Tuple):
return_tuple = tuple()
for ti in literal.elts:
- return_tuple = return_tuple + (self._get_literal_value(ti),)
+ return_tuple += (self._get_literal_value(ti),)
literal_value = return_tuple
elif isinstance(literal, ast.Set):
diff --git a/bandit/formatters/xml.py b/bandit/formatters/xml.py
index 5225715..1b53853 100644
--- a/bandit/formatters/xml.py
+++ b/bandit/formatters/xml.py
@@ -59,7 +59,7 @@ def report(manager, fileobj, sev_level, conf_level, lines=-1):
classname=issue.fname, name=test)
text = 'Test ID: %s Severity: %s Confidence: %s\n%s\nLocation %s:%s'
- text = text % (issue.test_id, issue.severity, issue.confidence,
+ text %= (issue.test_id, issue.severity, issue.confidence,
issue.text, issue.fname, issue.lineno)
ET.SubElement(testcase, 'error',
more_info=docs_utils.get_url(issue.test_id),
diff --git a/bandit/plugins/injection_wildcard.py b/bandit/plugins/injection_wildcard.py
index 0988129..66386db 100644
--- a/bandit/plugins/injection_wildcard.py
+++ b/bandit/plugins/injection_wildcard.py
@@ -120,7 +120,7 @@ def linux_commands_wildcard_injection(context, config):
argument_string = ''
if isinstance(call_argument, list):
for li in call_argument:
- argument_string = argument_string + ' %s' % li
+ argument_string += ' %s' % li
elif isinstance(call_argument, str):
argument_string = call_argument
Activity