Commit graph

92 commits

Author SHA1 Message Date
Anthony Sottile
1ed78d592a handle multiline fstrings in 3.12 2023-07-29 14:33:10 -04:00
Anthony Sottile
43266a2e26 mute FSTRING_MIDDLE tokens 2023-06-12 22:02:26 -04:00
Anthony Sottile
aa002ee4ed require python 3.8.1+ 2022-11-18 11:33:52 -05:00
Anthony Sottile
7a094fa826 ensure results are sorted for file traversal 2022-10-30 15:11:56 -04:00
Anthony Sottile
0d667a7329 enable multiprocessing on other platforms 2022-10-26 22:23:02 -07:00
Anthony Sottile
fba6df88f9 remove --diff option 2022-10-26 20:39:12 -07:00
Albert Tugushev
48b2919130 Display list of available formatters with help for --format 2022-10-15 15:39:05 -04:00
Anthony Sottile
e94fb10940 require python>=3.7 2022-08-05 19:51:08 -04:00
Anthony Sottile
c5225db626 simplify decision engine
- not specified codes (cmdline / config) are now known as being implicit via
  None sentinel
- removed redundant logic for (explicit, explicit) selection
2022-03-22 18:22:20 -07:00
Anthony Sottile
f7ef1a6c8b make --ignore order consistent 2022-02-06 08:36:36 -08:00
Anthony Sottile
4e56fc0f6a pregenerate the pycodestyle plugin to avoid call overhead 2022-01-25 13:52:54 -05:00
Anthony Sottile
23a60dd902 use the actual line contents when processing physical lines 2022-01-22 15:27:53 -05:00
Anthony Sottile
d03b9c97cc add a --require-plugins option 2022-01-22 14:08:32 -05:00
Anthony Sottile
c194d6cc30 combine local_plugin_paths and parse_plugin_options 2022-01-18 20:57:09 -05:00
Anthony Sottile
1b58293ad3 refactor plugin loading options to prepare for --require-plugins 2022-01-10 20:06:26 -05:00
Anthony Sottile
b62edd334a fix extended_default_select from plugin loading 2022-01-01 19:26:43 -05:00
Anthony Sottile
a8333e2bf2 move managing of off_by_default / enable_extensions to plugin loading 2022-01-01 18:33:07 -05:00
Anthony Sottile
50d69150c1 rework plugin loading 2021-12-31 15:09:54 -08:00
Ruairidh MacLeod
d948169292 add check for a missing specified config file 2021-12-24 23:40:31 +00:00
Ruairidh MacLeod
d478d92299 add failing test for missing config file 2021-12-24 23:40:31 +00:00
Anthony Sottile
a7be5e798b fix AttributeError when catatstrophic failure is triggered 2021-12-24 16:38:17 -05:00
Anthony Sottile
f98d52a398 have OptionManager take plugin versions directly 2021-12-08 15:49:17 -05:00
Anthony Sottile
fa8ac82ee2 add integration test for off_by_default plugin 2021-12-07 12:25:24 -08:00
Anthony Sottile
77a054688b refactor run_checks to not take an Optional list of filenames 2021-11-25 15:45:01 -05:00
Anthony Sottile
65c893728e refactor and simplify configuration loading 2021-11-22 19:45:17 -05:00
Anthony Sottile
411ff24392 move from allowlist to blocklist for mypy 2021-11-14 21:48:17 -08:00
Anthony Sottile
bbbe0d8048 improve integration tests 2021-11-14 20:39:45 -08:00
Anthony Sottile
81a4110338 have application return exit code for easier testing 2021-11-14 16:29:18 -08:00
Anthony Sottile
8d3afe40e1 use return value of parse_args directly 2021-11-14 15:39:14 -08:00
Anthony Sottile
bb3c8d2607 improve coverage a bit 2021-11-14 09:39:33 -08:00
Anthony Sottile
d34581b83f test using python3.10 2021-08-15 19:00:43 -04:00
Ian Stapleton Cordasco
85c2be3b52 Handle new SyntaxError tuple on 3.10
Closes #1372
2021-08-15 18:26:27 -04:00
Jouke Witteveen
efc15cf4f1 Automatically create output directories 2021-05-10 16:41:01 +02:00
Anthony Sottile
456e98486e short circuit on ast error before tokenization error 2021-04-18 10:08:11 -07:00
Anthony Sottile
af1668bf04 extend black formatting to tests as well 2021-04-18 09:23:48 -07:00
Anthony Sottile
3f10c04fd0 fix mypy errors 2021-04-07 08:28:11 -07:00
Anthony Sottile
3b57778160 fix links in code 2021-04-03 18:21:02 -07:00
Anthony Sottile
358ae85120 automatic: pyupgrade --py36-plus 2021-03-30 17:37:13 -07:00
Anthony Sottile
40aba49d0d upgrade pycodestyle to 2.7.0 2021-03-14 11:58:03 -07:00
Anthony Sottile
0efbb5dbcb Merge branch 'no_show_source' into 'master'
Add option to disable show-source for calling tools

See merge request pycqa/flake8!441
2020-10-02 23:40:04 +00:00
Anthony Sottile
ee9c2874a9 fix skipping of physical checks when file does not end in newline 2020-09-12 12:03:23 -07:00
Nekokatt
e6a5f6a663 Support linting when missing sem_open syscall
Platforms such as Termux on Android, and other exotic devices
do not provide a sem_open implementation on the OS level. This
is problematic, as the error resulting from this occurs when
calling multiprocessing.Pool, throwing an unhandled ImportError.

The issue itself is outlined in https://bugs.python.org/issue3770.

This change allows devices missing this system call to respond
to the missing feature by falling back to synchronous execution,
which appears to be the default behaviour if the multiprocessing
module is not found.

This change also adds a potential fix for developers working
on platforms where multiprocessing itself cannot be imported.
The existing code would set the name referencing the import to
None, but there are no clear checks to ensure this does not
result in an AttributeError later when multiprocessing.Pool
has accession attempts.

Existing users should see no difference in functionality, as they
will assumably already be able to use flake8, so will not be
missing this sem_open call.

Users on devices without the sem_open call will now be able
to use flake8 where they would be unable to before due to
unhandled ImportErrors.
2020-08-27 15:41:25 -07:00
Miro Hrončok
91b09d5b37 Tests: Add a value to mocked entry_points, so pytest 6+ can log it
Pytest 6.0.0rc1 attempts to log a repr of our mocked entry_point,
but it fails, becasue the repr metohod expects a valua attribute:

Reproducer:

    $ tox -e py38 --force-dep 'pytest==6.0.0rc1'
    ...
    Traceback (most recent call last):
      File "/usr/lib/python3.8/logging/__init__.py", line 1081, in emit
        msg = self.format(record)
      File "/usr/lib/python3.8/logging/__init__.py", line 925, in format
        return fmt.format(record)
      File "/usr/lib/python3.8/logging/__init__.py", line 664, in format
        record.message = record.getMessage()
      File "/usr/lib/python3.8/logging/__init__.py", line 369, in getMessage
        msg = msg % self.args
      File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/flake8/plugins/manager.py", line 44, in __repr__
        self.name, self.entry_point.value
      File "/tmp/flake8/.tox/py38/lib/python3.8/site-packages/mock/mock.py", line 632, in __getattr__
        raise AttributeError("Mock object has no attribute %r" % name)
    AttributeError: Mock object has no attribute 'value'
2020-07-20 17:49:12 +02:00
Anthony Sottile
b40af6737e Add option to disable show-source for calling tools 2020-06-19 10:01:04 -07:00
Eric N. Vander Weele
a68d4d0172 processor: Catch SyntaxError also when generating tokens for a file
`tokenize.generate_tokens()` can also raise `SyntaxError` in addition to
`tokenize.TokenError`.
2020-06-02 11:38:44 -07:00
Anthony Sottile
31c2f9f366 treat --extend-exclude as a file list 2020-05-21 16:41:02 -07:00
Eric N. Vander Weele
e6d8a90e5d options: Forward --output-file to be reparsed for BaseFormatter
This fixes a regression introduced in daca2c8 and b14d47b.

The --output-file` option was consumed by the preliminary option parser.
However, the `BaseFormatter` class needs the option for setting the
output filename.  This special cases this option to ensure it gets
re-parsed and respected when specified on the CLI.
2020-05-11 22:17:52 -07:00
Anthony Sottile
609010ce7a Fix logical checks which report position out of bounds 2020-05-07 11:16:00 -07:00
Anthony Sottile
93a17a806d instrument coverage on tests and require 100% coverage there 2020-03-23 12:15:29 -07:00
Anthony Sottile
28797a57d8 Allow noqa to apply to lines due to continuation 2020-03-17 22:12:56 -07:00