| 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-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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 return errors | 74 return errors |
| 75 | 75 |
| 76 def initialize_options(self): | 76 def initialize_options(self): |
| 77 pass | 77 pass |
| 78 | 78 |
| 79 def finalize_options(self): | 79 def finalize_options(self): |
| 80 pass | 80 pass |
| 81 | 81 |
| 82 def run(self): | 82 def run(self): |
| 83 import flake8.engine | 83 try: |
| 84 import flake8.engine as api |
| 85 except ImportError: |
| 86 import flake8.api.legacy as api |
| 84 | 87 |
| 85 directory = os.path.dirname(__file__) | 88 directory = os.path.dirname(__file__) |
| 86 filenames = glob.glob(os.path.join(directory, 'tests', '*.py')) | 89 filenames = glob.glob(os.path.join(directory, 'tests', '*.py')) |
| 87 style_guide = flake8.engine.get_style_guide() | 90 style_guide = api.get_style_guide() |
| 88 failed = False | 91 failed = False |
| 89 | 92 |
| 90 for filename in sorted(filenames): | 93 for filename in sorted(filenames): |
| 91 expected = self._get_expected_errors(filename) | 94 expected = self._get_expected_errors(filename) |
| 92 reported = self._get_reported_errors(filename, style_guide) | 95 reported = self._get_reported_errors(filename, style_guide) |
| 93 failures = expected ^ reported | 96 failures = expected ^ reported |
| 94 | 97 |
| 95 if not failures: | 98 if not failures: |
| 96 print(filename + ': OK') | 99 print(filename + ': OK') |
| 97 continue | 100 continue |
| (...skipping 12 matching lines...) Expand all Loading... |
| 110 if failed: | 113 if failed: |
| 111 sys.exit(1) | 114 sys.exit(1) |
| 112 | 115 |
| 113 | 116 |
| 114 setup( | 117 setup( |
| 115 name='flake8-abp', | 118 name='flake8-abp', |
| 116 version='0.1', | 119 version='0.1', |
| 117 py_modules=['flake8_abp'], | 120 py_modules=['flake8_abp'], |
| 118 entry_points={ | 121 entry_points={ |
| 119 'flake8.extension': [ | 122 'flake8.extension': [ |
| 120 'AXXX = flake8_abp:ASTChecker', | 123 'A = flake8_abp:ASTChecker', |
| 121 'A109-A110 = flake8_abp:check_quotes', | 124 'A1 = flake8_abp:check_quotes', |
| 122 'A111 = flake8_abp:check_redundant_parenthesis', | 125 'A111 = flake8_abp:check_redundant_parenthesis', |
| 123 'A303 = flake8_abp:check_non_default_encoding', | 126 'A303 = flake8_abp:check_non_default_encoding', |
| 124 ], | 127 ], |
| 125 }, | 128 }, |
| 126 cmdclass={'test': TestCommand} | 129 cmdclass={'test': TestCommand} |
| 127 ) | 130 ) |
| OLD | NEW |