summaryrefslogtreecommitdiff
path: root/pylint/utils.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-11-04 12:43:40 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2015-11-04 12:43:40 +0200
commit82d8b837b9f7559ea2dbe3090939d70d91dc5ab8 (patch)
tree27739b7fbb774a0bc63e4da270380fa0e7bea74c /pylint/utils.py
parent185ee278f064a3e444a54bf1998d343beb9683a3 (diff)
downloadpylint-82d8b837b9f7559ea2dbe3090939d70d91dc5ab8.tar.gz
Add ChangeLog entry for too-many-nested-blocks and fix the errors in pylint.
Diffstat (limited to 'pylint/utils.py')
-rw-r--r--pylint/utils.py49
1 files changed, 26 insertions, 23 deletions
diff --git a/pylint/utils.py b/pylint/utils.py
index 2f8de80..9cf4405 100644
--- a/pylint/utils.py
+++ b/pylint/utils.py
@@ -568,29 +568,32 @@ class FileState(object):
for msgid, lines in six.iteritems(msg_state):
for lineno, state in list(lines.items()):
original_lineno = lineno
- if first <= lineno <= last:
- # Set state for all lines for this block, if the
- # warning is applied to nodes.
- if msgs_store.check_message_id(msgid).scope == WarningScope.NODE:
- if lineno > firstchildlineno:
- state = True
- first_, last_ = node.block_range(lineno)
- else:
- first_ = lineno
- last_ = last
- for line in range(first_, last_+1):
- # do not override existing entries
- if not line in self._module_msgs_state.get(msgid, ()):
- if line in lines: # state change in the same block
- state = lines[line]
- original_lineno = line
- if not state:
- self._suppression_mapping[(msgid, line)] = original_lineno
- try:
- self._module_msgs_state[msgid][line] = state
- except KeyError:
- self._module_msgs_state[msgid] = {line: state}
- del lines[lineno]
+ # pylint: disable=superfluous-parens
+ if not (first <= lineno <= last):
+ continue
+ # Set state for all lines for this block, if the
+ # warning is applied to nodes.
+ if msgs_store.check_message_id(msgid).scope == WarningScope.NODE:
+ if lineno > firstchildlineno:
+ state = True
+ first_, last_ = node.block_range(lineno)
+ else:
+ first_ = lineno
+ last_ = last
+ for line in range(first_, last_+1):
+ # do not override existing entries
+ if line in self._module_msgs_state.get(msgid, ()):
+ continue
+ if line in lines: # state change in the same block
+ state = lines[line]
+ original_lineno = line
+ if not state:
+ self._suppression_mapping[(msgid, line)] = original_lineno
+ try:
+ self._module_msgs_state[msgid][line] = state
+ except KeyError:
+ self._module_msgs_state[msgid] = {line: state}
+ del lines[lineno]
def set_msg_status(self, msg, line, status):
"""Set status (enabled/disable) for a given message at a given line"""