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

Delta Between Two Patch Sets: flake8-abp/flake8_abp.py

Issue 29342824: Issue 4044 - Added handling for __future__ unicode_literals import to check_quotes() (Closed)
Left Patch Set: changed logical if else to match suggestion from sebastian Created June 2, 2016, 1:18 a.m.
Right Patch Set: removed redundant comment Created June 2, 2016, 5:45 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-abp/README.md ('k') | flake8-abp/tests/A109.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-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if line_number <= 2 and re.search(r'^\s*#.*coding[:=]', physical_line): 372 if line_number <= 2 and re.search(r'^\s*#.*coding[:=]', physical_line):
373 return (0, 'A303 non-default file encoding') 373 return (0, 'A303 non-default file encoding')
374 374
375 check_non_default_encoding.name = 'abp-non-default-encoding' 375 check_non_default_encoding.name = 'abp-non-default-encoding'
376 check_non_default_encoding.version = __version__ 376 check_non_default_encoding.version = __version__
377 377
378 378
379 def check_quotes(logical_line, tokens, previous_logical, checker_state): 379 def check_quotes(logical_line, tokens, previous_logical, checker_state):
380 first_token = True 380 first_token = True
381 381
382 # check if in unicode_literals mode
Sebastian Noack 2016/06/02 11:41:01 I feel that comment is kinda redundant. IMO it doe
383 token_strings = [t[1] for t in tokens] 382 token_strings = [t[1] for t in tokens]
384 future_import = token_strings[:3] == ['from', '__future__', 'import'] 383 future_import = token_strings[:3] == ['from', '__future__', 'import']
385 384
386 if future_import and 'unicode_literals' in token_strings: 385 if future_import and 'unicode_literals' in token_strings:
387 checker_state['has_unicode_literals'] = True 386 checker_state['has_unicode_literals'] = True
388 387
389 for kind, token, start, end, _ in tokens: 388 for kind, token, start, end, _ in tokens:
390 if kind == tokenize.INDENT or kind == tokenize.DEDENT: 389 if kind == tokenize.INDENT or kind == tokenize.DEDENT:
391 continue 390 continue
392 391
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 if tokens[i + 1][:2] != (tokenize.OP, ':'): 476 if tokens[i + 1][:2] != (tokenize.OP, ':'):
478 break 477 break
479 478
480 return [(pos, 'A111 redundant parenthesis for {} ' 479 return [(pos, 'A111 redundant parenthesis for {} '
481 'statement'.format(statement))] 480 'statement'.format(statement))]
482 481
483 return [] 482 return []
484 483
485 check_redundant_parenthesis.name = 'abp-redundant-parenthesis' 484 check_redundant_parenthesis.name = 'abp-redundant-parenthesis'
486 check_redundant_parenthesis.version = __version__ 485 check_redundant_parenthesis.version = __version__
LEFTRIGHT

Powered by Google App Engine
This is Rietveld