| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 with open(filename, 'rb') as file: | 46 with open(filename, 'rb') as file: |
| 47 if sys.version_info[0] >= 3: | 47 if sys.version_info[0] >= 3: |
| 48 for token in tokenize.tokenize(file.readline): | 48 for token in tokenize.tokenize(file.readline): |
| 49 tokeneater(*token) | 49 tokeneater(*token) |
| 50 else: | 50 else: |
| 51 tokenize.tokenize(file.readline, tokeneater) | 51 tokenize.tokenize(file.readline, tokeneater) |
| 52 | 52 |
| 53 return errors | 53 return errors |
| 54 | 54 |
| 55 def _get_reported_errors(self, filename): | 55 def _get_reported_errors(self, filename): |
| 56 output = subprocess.Popen(['flake8', filename], | 56 output = subprocess.Popen(['flake8', '--select=A', filename], |
| 57 stdout=subprocess.PIPE).communicate()[0] | 57 stdout=subprocess.PIPE).communicate()[0] |
| 58 | 58 |
| 59 errors = set() | 59 errors = set() |
| 60 for line in output.decode('utf-8').splitlines(): | 60 for line in output.decode('utf-8').splitlines(): |
| 61 _, lineno, colno, error = line.split(':', 3) | 61 _, lineno, colno, error = line.split(':', 3) |
| 62 errors.add((int(lineno), int(colno), error.split()[0])) | 62 errors.add((int(lineno), int(colno), error.split()[0])) |
| 63 | 63 |
| 64 return errors | 64 return errors |
| 65 | 65 |
| 66 def initialize_options(self): | 66 def initialize_options(self): |
| (...skipping 28 matching lines...) Expand all Loading... |
| 95 failed = True | 95 failed = True |
| 96 | 96 |
| 97 if failed: | 97 if failed: |
| 98 sys.exit(1) | 98 sys.exit(1) |
| 99 | 99 |
| 100 | 100 |
| 101 setup( | 101 setup( |
| 102 name='flake8-eyeo', | 102 name='flake8-eyeo', |
| 103 version='0.1', | 103 version='0.1', |
| 104 py_modules=['flake8_eyeo'], | 104 py_modules=['flake8_eyeo'], |
| 105 install_requires=['flake8>=3.2.1'], | 105 install_requires=[ |
| 106 'flake8>=3.2.1', |
| 107 'flake8-docstrings', |
| 108 'flake8-commas', |
| 109 'pep8-naming', |
| 110 ], |
| 106 entry_points={ | 111 entry_points={ |
| 107 'flake8.extension': [ | 112 'flake8.extension': [ |
| 113 '_ = flake8_eyeo:DefaultConfigOverride', |
| 108 'A = flake8_eyeo:check_ast', | 114 'A = flake8_eyeo:check_ast', |
| 109 'A1 = flake8_eyeo:check_quotes', | 115 'A1 = flake8_eyeo:check_quotes', |
| 110 'A111 = flake8_eyeo:check_redundant_parenthesis', | 116 'A111 = flake8_eyeo:check_redundant_parenthesis', |
| 111 'A303 = flake8_eyeo:check_non_default_encoding', | 117 'A303 = flake8_eyeo:check_non_default_encoding', |
| 112 ], | 118 ], |
| 113 }, | 119 }, |
| 114 cmdclass={'test': TestCommand}, | 120 cmdclass={'test': TestCommand}, |
| 115 ) | 121 ) |
| OLD | NEW |