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

Side by Side Diff: flake8-eyeo/tests/A111.py

Issue 29602819: Issue 5844 - Detect (more) redundant parentheses (Closed) Base URL: https://hg.adblockplus.org/codingtools/
Patch Set: Created Nov. 10, 2017, 12:26 a.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 | « flake8-eyeo/flake8_eyeo.py ('k') | 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 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
14 for (a, b, c) in y:
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)
17 # * A111
18 return result or ('foo')
19
20 # A111
21 (a, b, c) = x
22 del a, b, c
23
13 24
14 def mandatory_parenthesis(x, y, z): 25 def mandatory_parenthesis(x, y, z):
15 if (): 26 if ():
16 return 27 return
17 if (x, y, z): 28 if (x, y, z):
18 return 29 return
19 30
20 if (x or y) and z: 31 if (x or y) and z:
21 return 32 return
22 if x and (y or z): 33 if x and (y or z):
23 return 34 return
24 35
25 if (x or 36 if (x or
26 y): 37 y):
27 return 38 return
39
40
41 def acceptable_parenthesis(x, y, z):
42 a = (x == y)
43 b = (x or y == z)
44 c = (x + y) / z
45 d = (x and y) or z
46 return (a, b, c, d)
OLDNEW
« no previous file with comments | « flake8-eyeo/flake8_eyeo.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld