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

Side by Side Diff: flake8-eyeo/flake8_eyeo.py

Issue 29624606: Noissue - Fixed false positive A203 when using "yield from" (Closed)
Patch Set: Created Nov. 29, 2017, 9:40 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 self.errors.append((node, 'A202 dead code after ' 95 self.errors.append((node, 'A202 dead code after '
96 '{}'.format(statement))) 96 '{}'.format(statement)))
97 97
98 if isinstance(node, LEAVE_BLOCK): 98 if isinstance(node, LEAVE_BLOCK):
99 leave_node = node 99 leave_node = node
100 100
101 if can_have_unused_expr or not isinstance(node, ast.Expr): 101 if can_have_unused_expr or not isinstance(node, ast.Expr):
102 continue 102 continue
103 if docstring and i == 0 and isinstance(node.value, ast.Str): 103 if docstring and i == 0 and isinstance(node.value, ast.Str):
104 continue 104 continue
105 if isinstance(node.value, (ast.Call, ast.Yield)): 105
106 non_literal_expr_nodes = (ast.Call, ast.Yield)
107 try:
108 non_literal_expr_nodes += (ast.YieldFrom,)
Sebastian Noack 2017/11/29 21:51:37 This change prevents and A203 to be (incorrectly)
109 except AttributeError:
110 pass
111 if isinstance(node.value, non_literal_expr_nodes):
106 continue 112 continue
107 113
108 self.errors.append((node, 'A203 unused expression')) 114 self.errors.append((node, 'A203 unused expression'))
109 115
110 if pass_node: 116 if pass_node:
111 if not nodes_required or len(nodes) > 1: 117 if not nodes_required or len(nodes) > 1:
112 self.errors.append((pass_node, 'A204 redundant ' 118 self.errors.append((pass_node, 'A204 redundant '
113 'pass statement')) 119 'pass statement'))
114 120
115 if not block_required and not has_non_pass: 121 if not block_required and not has_non_pass:
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return [(pos, 'A111 redundant parenthesis for {} ' 472 return [(pos, 'A111 redundant parenthesis for {} '
467 'statement'.format(statement))] 473 'statement'.format(statement))]
468 474
469 return [] 475 return []
470 476
471 477
472 for checker in [check_ast, check_non_default_encoding, 478 for checker in [check_ast, check_non_default_encoding,
473 check_quotes, check_redundant_parenthesis]: 479 check_quotes, check_redundant_parenthesis]:
474 checker.name = 'eyeo' 480 checker.name = 'eyeo'
475 checker.version = __version__ 481 checker.version = __version__
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld