Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: flake8-eyeo/flake8_eyeo.py

Issue 29602819: Issue 5844 - Detect (more) redundant parentheses (Closed) Base URL: https://hg.adblockplus.org/codingtools/
Left Patch Set: Created Nov. 10, 2017, 12:26 a.m.
Right Patch Set: Updated flake8-eyeo/README.md and applied patches to existing codebase Created Jan. 25, 2018, 7:34 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « flake8-eyeo/README.md ('k') | flake8-eyeo/tests/A111.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 self.errors.append((node, 'A202 dead code after ' 102 self.errors.append((node, 'A202 dead code after '
103 '{}'.format(statement))) 103 '{}'.format(statement)))
104 104
105 if isinstance(node, LEAVE_BLOCK): 105 if isinstance(node, LEAVE_BLOCK):
106 leave_node = node 106 leave_node = node
107 107
108 if can_have_unused_expr or not isinstance(node, ast.Expr): 108 if can_have_unused_expr or not isinstance(node, ast.Expr):
109 continue 109 continue
110 if docstring and i == 0 and isinstance(node.value, ast.Str): 110 if docstring and i == 0 and isinstance(node.value, ast.Str):
111 continue 111 continue
112 if isinstance(node.value, (ast.Call, ast.Yield)): 112
113 non_literal_expr_nodes = (ast.Call, ast.Yield)
114 try:
115 non_literal_expr_nodes += (ast.YieldFrom,)
116 except AttributeError:
117 pass
118 if isinstance(node.value, non_literal_expr_nodes):
113 continue 119 continue
114 120
115 self.errors.append((node, 'A203 unused expression')) 121 self.errors.append((node, 'A203 unused expression'))
116 122
117 if pass_node: 123 if pass_node:
118 if not nodes_required or len(nodes) > 1: 124 if not nodes_required or len(nodes) > 1:
119 self.errors.append((pass_node, 'A204 redundant ' 125 self.errors.append((pass_node, 'A204 redundant '
120 'pass statement')) 126 'pass statement'))
121 127
122 if not block_required and not has_non_pass: 128 if not block_required and not has_non_pass:
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 if is_tuple or is_nested_op or is_compare_in_assign: 491 if is_tuple or is_nested_op or is_compare_in_assign:
486 continue 492 continue
487 493
488 yield (pos[0], pos[1], 'A111 redundant parenthesis', None) 494 yield (pos[0], pos[1], 'A111 redundant parenthesis', None)
489 495
490 496
491 for checker in [check_ast, check_non_default_encoding, 497 for checker in [check_ast, check_non_default_encoding,
492 check_quotes, check_redundant_parenthesis]: 498 check_quotes, check_redundant_parenthesis]:
493 checker.name = 'eyeo' 499 checker.name = 'eyeo'
494 checker.version = __version__ 500 checker.version = __version__
LEFTRIGHT

Powered by Google App Engine
This is Rietveld