Commit 24e9578f authored by Jérome Perrin's avatar Jérome Perrin

pylint: don't report __traceback_info__ as unused variable

this is a "magic" local variable used to add more debugging information
in zope traceback, it's not supposed to be used directly so it was a
false positive in our case.

This extends the default value of --dummy-variable-rgx that was defined
to _$|dummy in pylint 1.4.4 (
https://github.com/PyCQA/pylint/blob/pylint-1.4.4/pylint/checkers/variables.py#L296
)
parent 37c3fc43
Pipeline #27356 failed with stage
in 0 seconds
......@@ -293,7 +293,7 @@ class NodeBudgetVariation(BudgetVariation):
found = False
for node_url in category_list:
if node_url != '%s/budget_special_node/none' % base_category:
__traceback_info__ = (node_url, ) # pylint: disable=unused-variable
__traceback_info__ = (node_url, )
if uid_based_axis:
query_dict.setdefault(axis, []).append(
portal_categories.getCategoryValue(node_url,
......
......@@ -1320,7 +1320,7 @@ return True
("image/png", "", pngmessage, png, XSMALL_PNG_IMAGE_ICON_DATA),
("image/png", "png", svgtopngmessage, svg, None),
]:
__traceback_info__ = (content_type, "?format=" + ext) # pylint: disable=unused-variable
__traceback_info__ = (content_type, "?format=" + ext)
self.assertEqual(
message.get("Content-Location"),
obj.absolute_url() + "?format=" + ext,
......
......@@ -188,7 +188,7 @@ def substituteRequest(
request_from_container = request_container.REQUEST
request_container.REQUEST = inner_request
try:
__traceback_info__ = inner_request # pylint: disable=unused-variable
__traceback_info__ = inner_request
yield inner_request
finally:
request_container.REQUEST = request_from_container
......
......@@ -96,7 +96,7 @@ class StripeConnector(XMLObject):
auth=((self.getPassword() or "").strip(), ''),
timeout=self.getTimeout() or TIMEOUT)
if not response.ok:
__traceback_info__ = ( # pylint:disable=unused-variable
__traceback_info__ = (
response.request.url,
response.request.body,
response.text
......@@ -117,7 +117,7 @@ class StripeConnector(XMLObject):
auth=((self.getPassword() or "").strip(), ''),
timeout=self.getTimeout() or TIMEOUT)
if not response.ok:
__traceback_info__ = ( # pylint:disable=unused-variable
__traceback_info__ = (
response.request.url,
response.request.body,
response.text
......
......@@ -484,7 +484,7 @@ class SyncMLSubscription(XMLObject):
signature.appendPartialData(incoming_data)
incoming_data = signature.getPartialData()
signature.setPartialData(None)
__traceback_info__ = (gid, document, incoming_data, action['command']) # pylint: disable=unused-variable
__traceback_info__ = (gid, document, incoming_data, action['command'])
# Browse possible actions
if action["command"] == 'Add':
status_code = "item_added" # Default status code for addition
......
......@@ -23,7 +23,7 @@ for test_node in list_node:
if ping_date <= old_date:
test_node.invalidate()
elif validation_state == 'invalidated':
__traceback_info__ = test_node # pylint:disable=unused-variable
__traceback_info__ = test_node
if test_node.getSpecialise():
test_node.getSpecialiseValue().cleanupInvalidatedTestNode(test_node)
......
......@@ -323,7 +323,7 @@ class ExplanationCache:
try:
result = cache[reference_date_key]
if result is self: # use self as marker to detect infinite recursion
__traceback_info__ = (business_process.getPath(), trade_phase, # pylint: disable=unused-variable
__traceback_info__ = (business_process.getPath(), trade_phase,
reference_date_method_id, delay_mode)
raise ValueError('No reference date is defined, probably due to missing Trade Model Path in Business Process')
return result
......
......@@ -514,6 +514,9 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
# The default considers only six.moves, let's consider six module
# completely to avoid `Redefining built-in 'basestring'` for example
'--redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,builtins,io',
# Don't report __traceback_info__ and __traceback_supplement__ as
# unused variables
'--dummy-variables-rgx=_$|dummy|__traceback_info__|__traceback_supplement__',
]
if portal_type == 'Interface Component':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment