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

Delta Between Two Patch Sets: flake8-eyeo/tests/A111.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/flake8_eyeo.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 def redundant_parenthesis(x, y, z): 1 def redundant_parenthesis(x, y, z):
2 # * A111 2 # * A111
3 while (x): 3 while (x):
4 # * A111 4 # * A111
5 if ((x or y) and z): 5 if ((x or y) and z):
6 pass 6 pass
7 # * A111 7 # * A111
8 elif (x == max(y, z)): 8 elif (x == max(y, z)):
9 pass 9 pass
10 else: 10 else:
11 return 11 return
12 12
13 # * A111 13 # * A111
14 for (a, b, c) in y: 14 for (a, b, c) in y:
15 # * A111 15 # * A111
tlucas 2017/11/15 09:06:17 If i'm not mistaken, the *'s column should match t
rosie 2017/12/07 01:51:26 Done.
16 result = (a + b + c) 16 result = (a + b + c)
17 # * A111 17 # * A111
18 return result or ('foo') 18 return result or ('foo')
19 19
20 # A111 20 # A111
21 (a, b, c) = x 21 (a, b, c) = x
22 del a, b, c 22 del a, b, c
23 23
24 24
25 def mandatory_parenthesis(x, y, z): 25 def mandatory_parenthesis(x, y, z):
26 if (): 26 if ():
27 return 27 return
28 if (x, y, z): 28 if (x, y, z):
29 return 29 return
30 30
31 if (x or y) and z: 31 if (x or y) and z:
32 return 32 return
33 if x and (y or z): 33 if x and (y or z):
34 return 34 return
35 35
36 if (x or 36 if (x or
37 y): 37 y):
38 return 38 return
39 39
40 40
41 def acceptable_parenthesis(x, y, z): 41 def acceptable_parenthesis(x, y, z):
42 a = (x == y) 42 a = (x == y)
43 b = (x or y == z) 43 b = (x or y == z)
44 c = (x + y) / z 44 c = (x + y) / z
45 d = (x and y) or z 45 d = (x and y) or z
46 return (a, b, c, d) 46 return (a, b, c, d)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld