| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 prefixes, quote, text = match.groups() | 390 prefixes, quote, text = match.groups() |
| 391 prefixes = prefixes.lower() | 391 prefixes = prefixes.lower() |
| 392 | 392 |
| 393 if 'u' in prefixes: | 393 if 'u' in prefixes: |
| 394 yield (start, 'A112 use "from __future__ import ' | 394 yield (start, 'A112 use "from __future__ import ' |
| 395 'unicode_literals" instead of ' | 395 'unicode_literals" instead of ' |
| 396 'prefixing literals with "u"') | 396 'prefixing literals with "u"') |
| 397 | 397 |
| 398 if first_token and re.search(r'^(?:(?:def|class)\s|$)', | 398 if first_token and re.search(r'^(?:(?:def|class)\s|$)', |
| 399 previous_logical): | 399 previous_logical): |
| 400 if quote != '"""': | 400 pass # Ignore docstrings |
| 401 yield (start, 'A109 use triple double ' | |
| 402 'quotes for docstrings') | |
| 403 elif start[0] != end[0]: | 401 elif start[0] != end[0]: |
| 404 pass | 402 pass # Ignore multiline strings |
| 405 elif 'r' in prefixes: | 403 elif 'r' in prefixes: |
| 406 if quote != "'" and not (quote == '"' and "'" in text): | 404 if quote != "'" and not (quote == '"' and "'" in text): |
| 407 yield (start, 'A110 use single quotes for raw string') | 405 yield (start, 'A110 use single quotes for raw string') |
| 408 else: | 406 else: |
| 409 prefix = '' | 407 prefix = '' |
| 410 if sys.version_info[0] >= 3: | 408 if sys.version_info[0] >= 3: |
| 411 if 'b' in prefixes: | 409 if 'b' in prefixes: |
| 412 prefix = 'b' | 410 prefix = 'b' |
| 413 else: | 411 else: |
| 414 u_literals = checker_state.get('has_unicode_literals') | 412 u_literals = checker_state.get('has_unicode_literals') |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return [(pos, 'A111 redundant parenthesis for {} ' | 469 return [(pos, 'A111 redundant parenthesis for {} ' |
| 472 'statement'.format(statement))] | 470 'statement'.format(statement))] |
| 473 | 471 |
| 474 return [] | 472 return [] |
| 475 | 473 |
| 476 | 474 |
| 477 for checker in [ASTChecker, check_non_default_encoding, | 475 for checker in [ASTChecker, check_non_default_encoding, |
| 478 check_quotes, check_redundant_parenthesis]: | 476 check_quotes, check_redundant_parenthesis]: |
| 479 checker.name = 'eyeo' | 477 checker.name = 'eyeo' |
| 480 checker.version = __version__ | 478 checker.version = __version__ |
| OLD | NEW |