Commit graph

28 commits

Author SHA1 Message Date
Anthony Sottile
567cafc15a py310+ 2025-10-16 10:01:02 -04:00
Max R
5fab0d1887 Update hooks and use autopep8 + add-trailing-comma instead of black 2025-07-20 19:13:24 -04:00
Anthony Sottile
aa002ee4ed require python 3.8.1+ 2022-11-18 11:33:52 -05:00
Anthony Sottile
0d667a7329 enable multiprocessing on other platforms 2022-10-26 22:23:02 -07:00
Anthony Sottile
e94fb10940 require python>=3.7 2022-08-05 19:51:08 -04: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
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
Anthony Sottile
77a054688b refactor run_checks to not take an Optional list of filenames 2021-11-25 15:45:01 -05:00
Ian Stapleton Cordasco
85c2be3b52 Handle new SyntaxError tuple on 3.10
Closes #1372
2021-08-15 18:26:27 -04:00
Anthony Sottile
af1668bf04 extend black formatting to tests as well 2021-04-18 09:23:48 -07:00
Anthony Sottile
358ae85120 automatic: pyupgrade --py36-plus 2021-03-30 17:37:13 -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
609010ce7a Fix logical checks which report position out of bounds 2020-05-07 11:16:00 -07:00
Anthony Sottile
28797a57d8 Allow noqa to apply to lines due to continuation 2020-03-17 22:12:56 -07:00
Anthony Sottile
bfb79b46c8 Ensure that a not-found file produces an error
- this restores a flake8 2.x behaviour that was lost in the refactor
2020-01-16 12:53:37 -08:00
Anthony Sottile
d3c95f00d0 Switch from entrypoints to importlib_metadata 2019-11-28 17:30:52 -08:00
Thomas Grainger
9ba6677c4a support extend-exclude Fixes #535 2019-07-08 20:12:47 +00:00
Anthony Sottile
fb7e9338cd mypy now passes 2019-05-19 17:31:04 -07:00
Tom Milligan
2803d0a810
checker: allow physical checks to return multiple results, add tests 2018-12-10 17:42:53 +00:00
Anthony Sottile
ff15ba0865 Replace setuptools with entrypoints 2018-11-05 11:08:37 -08:00
Ian Cordasco
32f4b65b6b
Fix docstring violations 2017-05-12 20:34:15 -05:00
Ian Cordasco
5248cf3c2d
Enable users who want to track all files processed
This adds two new methods to the BaseFormatter class:

- beginning
- finished

These will indicate when Flake8 begins and finishes processing a file.

Closes #251
2016-12-20 19:08:11 -06:00
Ian Cordasco
e14d0e6352
Serialize Checkers PluginTypeManager to a dict
It seems likely that the multiprocessing module on Windows is not
capable of serializing an object with the structure that we have and
preserving the attributes we dynamically set on plugins (like the
FlakesChecker). To avoid issues like this with all plugins (although
we have only found this on Windows with the FlakesChecker), let's try
serializing the Checkers PluginTypeManager to a dictionary so that the
only object that a Queue is really trying to serialize/deserialize is
the FlakesChecker itself.

Related to #179
2016-08-03 16:48:39 -05:00
Fabian Neundorf
ad3b486909 Sort reports by line and column
Originally the reports have been sorted by column and message (without the
error code), so it didn't order after the line number.

Closes #196
2016-07-28 19:25:13 +02:00
Ian Cordasco
5f9c0bde23
Relocate integration style checker tests 2016-07-24 20:04:48 -05:00