Verified Commit 58cb0919 authored by Jelmer Vernooij's avatar Jelmer Vernooij

Import upstream version 3.6.0, md5 178485aed0799655d0cbf2e3bdcfaddc

parents 61375eee b6bd3a8d
Metadata-Version: 1.1
Metadata-Version: 1.2
Name: flake8
Version: 3.5.0
Version: 3.6.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Ian Stapleton Cordasco
Author-email: graffatcolmingov@gmail.com
Author: Tarek Ziade
Author-email: tarek@ziade.org
Maintainer: Ian Stapleton Cordasco
Maintainer-email: graffatcolmingov@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: ========
Flake8
========
......@@ -83,7 +84,7 @@ Description: ========
===========
Flake8 was created by Tarek Ziadé and is currently maintained by `Ian Cordasco
<https://coglib.com/~icordasc/>`_
<http://www.coglib.com/~icordasc/>`_
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
......@@ -98,5 +99,7 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
......@@ -74,4 +74,4 @@ Maintenance
===========
Flake8 was created by Tarek Ziadé and is currently maintained by `Ian Cordasco
<https://coglib.com/~icordasc/>`_
<http://www.coglib.com/~icordasc/>`_
......@@ -297,4 +297,4 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
......@@ -2,7 +2,7 @@
Contributing to Flake8
========================
There are many ways to contriubte to |Flake8|, and we encourage them all:
There are many ways to contribute to |Flake8|, and we encourage them all:
- contributing bug reports and feature requests
......
......@@ -83,9 +83,9 @@ Before releasing, the following tox test environments must pass:
- Python 2.7 (a.k.a., ``tox -e py27``)
- Python 3.4 (a.k.a., ``tox -e py34``)
- Python 3.6 (a.k.a., ``tox -e py36``)
- Python 3.5 (a.k.a., ``tox -e py35``)
- Python 3.7 (a.k.a., ``tox -e py37``)
- PyPy (a.k.a., ``tox -e pypy``)
......
......@@ -4,7 +4,7 @@
Writing Code for Flake8
=========================
The maintainers of |Flake8| unsurprisingly have some opinions about the styl
The maintainers of |Flake8| unsurprisingly have some opinions about the style
of code maintained in the project.
At the time of this writing, |Flake8| enables all of PyCodeStyle's checks, all
......@@ -141,7 +141,7 @@ As a result, of the above, we do not:
- Import only the objects we're using
- Add commnts explaining that an import is a standard library module or
- Add comments explaining that an import is a standard library module or
something else
......
......@@ -88,7 +88,7 @@ All options available as of Flake8 3.1.0::
--config=CONFIG Path to the config file that will be the authoritative
config source. This will cause Flake8 to ignore all
other configuration files.
--isolated Ignore all found configuration files.
--isolated Ignore all configuration files.
--benchmark Print benchmark information about this run of Flake8
--bug-report Print information necessary when preparing a bug
report
......
......@@ -182,6 +182,6 @@ fact that pep8 or pycodestyle is not installed.
.. links
.. _flake8-polyfill: https://pypi.io/project/flake8-polyfill/
.. _flake8-polyfill: https://pypi.org/project/flake8-polyfill/
.. |polyfill| replace:: ``flake8-polyfill``
......@@ -33,7 +33,7 @@ Let's do that next.
return 'Example formatter: {0!r}'.format(error)
With that we're done. Obviously this isn't a very useful formatter, but it
should highlight the simplicitly of creating a formatter with Flake8. If we
should highlight the simplicity of creating a formatter with Flake8. If we
wanted to instead create a formatter that aggregated the results and returned
XML, JSON, or subunit we could also do that. |Flake8| interacts with the
formatter in two ways:
......
......@@ -25,7 +25,6 @@ like:
.. code-block:: python
from __future__ import with_statement
import setuptools
requires = [
......@@ -130,6 +129,14 @@ like::
Finally, if all of your plugin's error codes start with just ``X`` then it
would look like the original example.
|Flake8| requires each entry point to be unique amongst all plugins installed
in the users environment. Selecting an entry point that is already used can
cause plugins to be deactivated without warning!
**Please Note:** Your entry point does not need to be exactly 4 characters
as of |Flake8| 3.0. *Consider using an entry point with 3 letters followed
by 3 numbers (i.e.* ``ABC123`` *).*
.. _Entry Points:
https://pythonhosted.org/setuptools/pkg_resources.html#entry-points
https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points
......@@ -5,7 +5,7 @@
- McCabe complexity warnings are prefixed by a ``C`` instead of a ``W``
- Flake8 supports extensions through entry points
- Due to the above support, we **require** setuptools
- We publish the `documentation <https://flake8.readthedocs.org/>`_
- We publish the `documentation <https://flake8.readthedocs.io/>`_
- Fixes #13: pep8, pyflakes and mccabe become external dependencies
- Split run.py into main.py, engine.py and hooks.py for better logic
- Expose our parser for our users
......
......@@ -30,4 +30,4 @@
.. _GitLab#35: https://gitlab.com/pycqa/flake8/issues/35
.. _GitLab!18: https://gitlab.com/pycqa/flake8/merge_requests/18
.. _GitLab!20: https://gitlab.com/pycqa/flake8/merge_requests/20
.. _VCS hooks docs: https://flake8.readthedocs.org/en/latest/vcs.html
.. _VCS hooks docs: https://flake8.readthedocs.io/en/latest/user/using-hooks.html
3.6.0 -- 2018-10-23
-------------------
You can view the `3.6.0 milestone`_ on GitLab for more details.
New Dependency Information
~~~~~~~~~~~~~~~~~~~~~~~~~~
- pycodestyle has been updated to >= 2.4.0, < 2.5.0 (See also `GitLab#381`_,
`GitLab#415`_, `GitLab!212`_, `GitLab!230`_, `GitLab!231`_)
- Pyflakes has been updated to >= 2.0.0, < 2.1.0 (See also `GitLab#422`_,
`GitLab!239`_)
- flake8 requires python 2.x >= 2.7 or python 3.x >= 3.4 (See also
`GitLab!225`_)
Features
~~~~~~~~
- Add ``paths`` to allow local plugins to exist outside of ``sys.path`` (See
also `GitLab#379`_, `GitLab!211`_)
- Copy ``setup.cfg`` files to the temporary git hook execution directory (See
also `GitLab!215`_)
- Only skip a file if ``# flake8: noqa`` is on a line by itself (See also
`GitLab#453`_, `GitLab!219`_)
- Provide a better user experience for broken plugins (See also `GitLab!221`_)
- Report ``E902`` when a file passed on the command line does not exist (See
also `GitLab#405`_, `GitLab!227`_)
- Add ``--extend-ignore`` for extending the default ``ignore`` instead of
overriding it (See also `GitLab!233`_)
Bugs Fixed
~~~~~~~~~~
- Respect a formatter's newline setting when printing (See also `GitLab!222`_)
- Fix leaking of processes in the legacy api (See also `GitLab#410`_,
`GitLab!228`_)
- Fix a ``SyntaxWarning`` for an invalid escape sequence (See also
`GitLab!244`_)
- Fix ``DeprecationWarning`` due to import of ``abc`` classes from the
``collections`` module (See also `GitLab!249`_)
- Defer ``setuptools`` import to improve flake8 startup time (See also
`GitLab#365`_, `GitLab!250`_)
- Fix inconsistent line endings in ``FileProcessor.lines`` when running under
python 3.x (See also `GitLab#457`_, `GitLab!255`_)
.. all links
.. _3.6.0 milestone:
https://gitlab.com/pycqa/flake8/milestones/21
.. issue links
.. _GitLab#365:
https://gitlab.com/pycqa/flake8/issues/365
.. _GitLab#379:
https://gitlab.com/pycqa/flake8/issues/379
.. _GitLab#381:
https://gitlab.com/pycqa/flake8/issues/381
.. _GitLab#405:
https://gitlab.com/pycqa/flake8/issues/405
.. _GitLab#410:
https://gitlab.com/pycqa/flake8/issues/410
.. _GitLab#415:
https://gitlab.com/pycqa/flake8/issues/415
.. _GitLab#422:
https://gitlab.com/pycqa/flake8/issues/422
.. _GitLab#453:
https://gitlab.com/pycqa/flake8/issues/453
.. _GitLab#457:
https://gitlab.com/pycqa/flake8/issues/457
.. merge request links
.. _GitLab!211:
https://gitlab.com/pycqa/flake8/merge_requests/211
.. _GitLab!212:
https://gitlab.com/pycqa/flake8/merge_requests/212
.. _GitLab!215:
https://gitlab.com/pycqa/flake8/merge_requests/215
.. _GitLab!219:
https://gitlab.com/pycqa/flake8/merge_requests/219
.. _GitLab!221:
https://gitlab.com/pycqa/flake8/merge_requests/221
.. _GitLab!222:
https://gitlab.com/pycqa/flake8/merge_requests/222
.. _GitLab!225:
https://gitlab.com/pycqa/flake8/merge_requests/225
.. _GitLab!227:
https://gitlab.com/pycqa/flake8/merge_requests/227
.. _GitLab!228:
https://gitlab.com/pycqa/flake8/merge_requests/228
.. _GitLab!230:
https://gitlab.com/pycqa/flake8/merge_requests/230
.. _GitLab!231:
https://gitlab.com/pycqa/flake8/merge_requests/231
.. _GitLab!233:
https://gitlab.com/pycqa/flake8/merge_requests/233
.. _GitLab!239:
https://gitlab.com/pycqa/flake8/merge_requests/239
.. _GitLab!244:
https://gitlab.com/pycqa/flake8/merge_requests/244
.. _GitLab!249:
https://gitlab.com/pycqa/flake8/merge_requests/249
.. _GitLab!250:
https://gitlab.com/pycqa/flake8/merge_requests/250
.. _GitLab!255:
https://gitlab.com/pycqa/flake8/merge_requests/255
......@@ -9,6 +9,7 @@ with the newest releases first.
==================
.. toctree::
3.6.0
3.5.0
3.4.1
3.4.0
......
......@@ -267,6 +267,27 @@ example:
These configurations will allow you to select your own custom reporter plugin
that you've designed or will utilize your new check classes.
If your package is installed in the same virtualenv that |Flake8| will run
from, and your local plugins are part of that package, you're all set; |Flake8|
will be able to import your local plugins. However, if you are working on a
project that isn't set up as an installable package, or |Flake8| doesn't run
from the same virtualenv your code runs in, you may need to tell |Flake8| where
to import your local plugins from. You can do this via the ``paths`` option in
the ``local-plugins`` section of your config:
.. code-block:: ini
[flake8:local-plugins]
extension =
MC1 = myflake8plugin:MyChecker1
paths =
./path/to
Relative paths will be interpreted relative to the config file. Multiple paths
can be listed (comma separated just like ``exclude``) as needed. If your local
plugins have any dependencies, it's up to you to ensure they are installed in
whatever Python environment |Flake8| runs in.
.. note::
These plugins otherwise follow the same guidelines as regular plugins.
......@@ -54,6 +54,9 @@ generates its own :term:`error code`\ s for ``pyflakes``:
+------+---------------------------------------------------------------------+
| F707 | an ``except:`` block as not the last exception handler |
+------+---------------------------------------------------------------------+
| F721 | doctest syntax error |
| F722 | syntax error in forward type annotation |
+------+---------------------------------------------------------------------+
+------+---------------------------------------------------------------------+
| F811 | redefinition of unused ``name`` from line ``N`` |
+------+---------------------------------------------------------------------+
......@@ -69,6 +72,9 @@ generates its own :term:`error code`\ s for ``pyflakes``:
+------+---------------------------------------------------------------------+
| F841 | local variable ``name`` is assigned to but never used |
+------+---------------------------------------------------------------------+
+------+---------------------------------------------------------------------+
| F901 | ``raise NotImplemented`` should be ``raise NotImplementedError`` |
+------+---------------------------------------------------------------------+
Note that some of these entries behave differently on Python 2 and Python 3,
for example F812 is specific to Python 2 only.
......
......@@ -107,6 +107,10 @@ And you should see something like:
--ignore=errors Comma-separated list of errors and warnings to ignore
(or skip). For example, ``--ignore=E4,E51,W234``.
(Default: E121,E123,E126,E226,E24,E704)
--extend-ignore=errors
Comma-separated list of errors and warnings to add to
the list of ignored ones. For example, ``--extend-
ignore=E4,E51,W234``.
--max-line-length=n Maximum allowed line length for the entirety of this
run. (Default: 79)
--select=errors Comma-separated list of errors and warnings to enable.
......@@ -134,7 +138,7 @@ And you should see something like:
--config=CONFIG Path to the config file that will be the authoritative
config source. This will cause Flake8 to ignore all
other configuration files.
--isolated Ignore all found configuration files.
--isolated Ignore all configuration files.
--builtins=BUILTINS define more built-ins, comma separated
--doctests check syntax of the doctests
--include-in-doctest=INCLUDE_IN_DOCTEST
......
......@@ -56,6 +56,8 @@ Index of Options
- :option:`flake8 --ignore`
- :option:`flake8 --extend-ignore`
- :option:`flake8 --max-line-length`
- :option:`flake8 --select`
......@@ -416,6 +418,37 @@ Options and their Descriptions
ignore = E121,E123
.. option:: --extend-ignore=<errors>
:ref:`Go back to index <top>`
Specify a list of codes to add to the list of ignored ones. Similar
considerations as in :option:`--ignore` apply here with regard to the
value.
The difference to the :option:`--ignore` option is, that this option can be
used to selectively add individual codes without overriding the default
list entirely.
Command-line example:
.. prompt:: bash
flake8 --extend-ignore=E4,E51,W234 dir/
This **can** be specified in config files.
Example config file usage:
.. code-block:: ini
extend-ignore =
E4,
E51,
W234
extend-ignore = E4,E51,W234
.. option:: --max-line-length=<n>
:ref:`Go back to index <top>`
......
......@@ -59,8 +59,8 @@ documented this for you.
.. _PyPI:
https://pypi.io/
https://pypi.org/
.. _flake8-docstrings:
https://pypi.io/project/flake8-docstrings/
https://pypi.org/project/flake8-docstrings/
.. _flake8-future:
https://pypi.io/project/flake8-future/
https://pypi.org/project/flake8-future/
......@@ -5,11 +5,12 @@ test = pytest
universal = 1
[metadata]
license_file = LICENSE
requires-dist =
enum34; python_version<"3.4"
configparser; python_version<"3.2"
pyflakes >= 1.5.0, < 1.7.0
pycodestyle >= 2.0.0, < 2.4.0
pyflakes >= 2.0.0, < 2.1.0
pycodestyle >= 2.4.0, < 2.5.0
mccabe >= 0.6.0, < 0.7.0
[egg_info]
......
......@@ -21,8 +21,8 @@ requires = [
# http://flake8.pycqa.org/en/latest/faq.html#why-does-flake8-use-ranges-for-its-dependencies
# And in which releases we will update those ranges here:
# http://flake8.pycqa.org/en/latest/internal/releases.html#releasing-flake8
"pyflakes >= 1.5.0, < 1.7.0",
"pycodestyle >= 2.0.0, < 2.4.0",
"pyflakes >= 2.0.0, < 2.1.0",
"pycodestyle >= 2.4.0, < 2.5.0",
"mccabe >= 0.6.0, < 0.7.0",
"setuptools >= 30",
]
......@@ -74,6 +74,7 @@ setuptools.setup(
"flake8.options",
"flake8.plugins",
],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
install_requires=requires,
extras_require=extras_require,
entry_points={
......@@ -85,7 +86,7 @@ setuptools.setup(
],
'flake8.extension': [
'F = flake8.plugins.pyflakes:FlakesChecker',
# PEP-0008 checks provied by PyCQA/pycodestyle
# PEP-0008 checks provided by PyCQA/pycodestyle
PEP8_PLUGIN('tabs_or_spaces'),
PEP8_PLUGIN('tabs_obsolete'),
PEP8_PLUGIN('trailing_whitespace'),
......@@ -108,7 +109,8 @@ setuptools.setup(
PEP8_PLUGIN('module_imports_on_top_of_file'),
PEP8_PLUGIN('compound_statements'),
PEP8_PLUGIN('explicit_line_join'),
PEP8_PLUGIN('break_around_binary_operator'),
PEP8_PLUGIN('break_after_binary_operator'),
PEP8_PLUGIN('break_before_binary_operator'),
PEP8_PLUGIN('comparison_to_singleton'),
PEP8_PLUGIN('comparison_negative'),
PEP8_PLUGIN('comparison_type'),
......@@ -118,6 +120,8 @@ setuptools.setup(
PEP8_PLUGIN('python_3000_raise_comma'),
PEP8_PLUGIN('python_3000_not_equal'),
PEP8_PLUGIN('python_3000_backticks'),
PEP8_PLUGIN('python_3000_invalid_escape_sequence'),
PEP8_PLUGIN('python_3000_async_await_keywords'),
],
'flake8.report': [
'default = flake8.formatting.default:Default',
......@@ -139,6 +143,7 @@ setuptools.setup(
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
],
......
Metadata-Version: 1.1
Metadata-Version: 1.2
Name: flake8
Version: 3.5.0
Version: 3.6.0
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Ian Stapleton Cordasco
Author-email: graffatcolmingov@gmail.com
Author: Tarek Ziade
Author-email: tarek@ziade.org
Maintainer: Ian Stapleton Cordasco
Maintainer-email: graffatcolmingov@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: ========
Flake8
========
......@@ -83,7 +84,7 @@ Description: ========
===========
Flake8 was created by Tarek Ziadé and is currently maintained by `Ian Cordasco
<https://coglib.com/~icordasc/>`_
<http://www.coglib.com/~icordasc/>`_
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
......@@ -98,5 +99,7 @@ Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
......@@ -77,6 +77,7 @@ docs/source/release-notes/3.3.0.rst
docs/source/release-notes/3.4.0.rst
docs/source/release-notes/3.4.1.rst
docs/source/release-notes/3.5.0.rst
docs/source/release-notes/3.6.0.rst
docs/source/release-notes/index.rst
docs/source/user/configuration.rst
docs/source/user/error-codes.rst
......@@ -133,6 +134,7 @@ tests/fixtures/config_files/cli-specified-without-inline-comments.ini
tests/fixtures/config_files/cli-specified.ini
tests/fixtures/config_files/config-with-hyphenated-options.ini
tests/fixtures/config_files/local-config.ini
tests/fixtures/config_files/local-plugin-path.ini
tests/fixtures/config_files/local-plugin.ini
tests/fixtures/config_files/no-flake8-section.ini
tests/fixtures/config_files/user-config.ini
......@@ -146,6 +148,7 @@ tests/fixtures/example-code/inline-ignores/E731.py
tests/integration/test_aggregator.py
tests/integration/test_checker.py
tests/integration/test_plugins.py
tests/integration/subdir/aplugin.py
tests/unit/test_application.py
tests/unit/test_base_formatter.py
tests/unit/test_checker_manager.py
......
......@@ -9,7 +9,8 @@ F = flake8.plugins.pyflakes:FlakesChecker
pycodestyle.ambiguous_identifier = pycodestyle:ambiguous_identifier
pycodestyle.bare_except = pycodestyle:bare_except
pycodestyle.blank_lines = pycodestyle:blank_lines
pycodestyle.break_around_binary_operator = pycodestyle:break_around_binary_operator
pycodestyle.break_after_binary_operator = pycodestyle:break_after_binary_operator
pycodestyle.break_before_binary_operator = pycodestyle:break_before_binary_operator
pycodestyle.comparison_negative = pycodestyle:comparison_negative
pycodestyle.comparison_to_singleton = pycodestyle:comparison_to_singleton
pycodestyle.comparison_type = pycodestyle:comparison_type
......@@ -24,8 +25,10 @@ pycodestyle.missing_whitespace = pycodestyle:missing_whitespace
pycodestyle.missing_whitespace_after_import_keyword = pycodestyle:missing_whitespace_after_import_keyword
pycodestyle.missing_whitespace_around_operator = pycodestyle:missing_whitespace_around_operator
pycodestyle.module_imports_on_top_of_file = pycodestyle:module_imports_on_top_of_file
pycodestyle.python_3000_async_await_keywords = pycodestyle:python_3000_async_await_keywords
pycodestyle.python_3000_backticks = pycodestyle:python_3000_backticks
pycodestyle.python_3000_has_key = pycodestyle:python_3000_has_key
pycodestyle.python_3000_invalid_escape_sequence = pycodestyle:python_3000_invalid_escape_sequence
pycodestyle.python_3000_not_equal = pycodestyle:python_3000_not_equal
pycodestyle.python_3000_raise_comma = pycodestyle:python_3000_raise_comma
pycodestyle.tabs_obsolete = pycodestyle:tabs_obsolete
......
pyflakes<1.7.0,>=1.5.0
pycodestyle<2.4.0,>=2.0.0
pyflakes<2.1.0,>=2.0.0
pycodestyle<2.5.0,>=2.4.0
mccabe<0.7.0,>=0.6.0
setuptools>=30
......
......@@ -10,31 +10,21 @@ This module
"""
import logging
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
"""Shim for version of Python < 2.7."""
def emit(self, record):
"""Do nothing."""
pass
import sys
LOG = logging.getLogger(__name__)
LOG.addHandler(NullHandler())
LOG.addHandler(logging.NullHandler())
# Clean up after LOG config
del NullHandler
__version__ = '3.5.0'
__version_info__ = tuple(int(i) for i in __version__.split('.') if i.isdigit())
__version__ = "3.6.0"
__version_info__ = tuple(
int(i) for i in __version__.split(".") if i.isdigit()
)
# There is nothing lower than logging.DEBUG (10) in the logging library,
# but we want an extra level to avoid being too verbose when using -vv.
_EXTRA_VERBOSE = 5
logging.addLevelName(_EXTRA_VERBOSE, 'VERBOSE')
logging.addLevelName(_EXTRA_VERBOSE, "VERBOSE")
_VERBOSITY_TO_LOG_LEVEL = {
# output more than warnings but not debugging info
......@@ -45,8 +35,10 @@ _VERBOSITY_TO_LOG_LEVEL = {
3: _EXTRA_VERBOSE,
}
LOG_FORMAT = ('%(name)-25s %(processName)-11s %(relativeCreated)6d '
'%(levelname)-8s %(message)s')
LOG_FORMAT = (
"%(name)-25s %(processName)-11s %(relativeCreated)6d "
"%(levelname)-8s %(message)s"
)
def configure_logging(verbosity, filename=None, logformat=LOG_FORMAT):
......@@ -67,8 +59,8 @@ def configure_logging(verbosity, filename=None, logformat=LOG_FORMAT):
log_level = _VERBOSITY_TO_LOG_LEVEL[verbosity]
if not filename or filename in ('stderr', 'stdout'):
fileobj = getattr(sys, filename or 'stderr')
if not filename or filename in ("stderr", "stdout"):
fileobj = getattr(sys, filename or "stderr")
handler_cls = logging.StreamHandler
else:
fileobj = filename
......@@ -78,5 +70,6 @@ def configure_logging(verbosity, filename=None, logformat=LOG_FORMAT):
handler.setFormatter(logging.Formatter(logformat))
LOG.addHandler(handler)
LOG.setLevel(log_level)
LOG.debug('Added a %s logging handler to logger root at %s',
filename, __name__)
LOG.debug(
"Added a %s logging handler to logger root at %s", filename, __name__
)
......@@ -13,7 +13,7 @@ from flake8.main import application as app
LOG = logging.getLogger(__name__)
__all__ = ('get_style_guide',)
__all__ = ("get_style_guide",)
def get_style_guide(**kwargs):
......@@ -29,7 +29,8 @@ def get_style_guide(**kwargs):
application = app.Application()
application.parse_preliminary_options_and_args([])
flake8.configure_logging(
application.prelim_opts.verbose, application.prelim_opts.output_file)
application.prelim_opts.verbose, application.prelim_opts.output_file
)
application.make_config_finder()
application.find_plugins()
application.register_plugin_options()
......@@ -113,18 +114,22 @@ class StyleGuide(object):
:rtype:
bool
"""
return (self._file_checker_manager.is_path_excluded(filename) or
(parent and
self._file_checker_manager.is_path_excluded(
os.path.join(parent, filename))))
return self._file_checker_manager.is_path_excluded(filename) or (
parent
and self._file_checker_manager.is_path_excluded(
os.path.join(parent, filename)
)
)
def init_report(self, reporter=None):
"""Set up a formatter for this run of Flake8."""
if reporter is None:
return
if not issubclass(reporter, formatter.BaseFormatter):
raise ValueError("Report should be subclass of "
"flake8.formatter.BaseFormatter.")
raise ValueError(
"Report should be subclass of "
"flake8.formatter.BaseFormatter."
)
self._application.formatter = None
self._application.make_formatter(reporter)
self._application.guide = None
......@@ -197,6 +202,6 @@ class Report(object):
list
"""
return [
'{} {} {}'.format(s.count, s.error_code, s.message)
"{} {} {}".format(s.count, s.error_code, s.message)
for s in self._stats.statistics_for(violation)
]
This diff is collapsed.
......@@ -2,39 +2,26 @@
import re
EXCLUDE = (
'.svn',
'CVS',
'.bzr',
'.hg',
'.git',
'__pycache__',
'.tox',
'.eggs',
'*.egg',
".svn",
"CVS",
".bzr",
".hg",
".git",
"__pycache__",
".tox",
".eggs",
"*.egg",
)
IGNORE = (
'E121',
'E123',
'E126',
'E226',
'E24',
'E704',
'W503',
'W504',
)
SELECT = ('E', 'F', 'W', 'C90')
IGNORE = ("E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504")
SELECT = ("E", "F", "W", "C90")
MAX_LINE_LENGTH = 79
TRUTHY_VALUES = {'true', '1', 't'}
TRUTHY_VALUES = {"true", "1", "t"}
# Other constants
WHITESPACE = frozenset(' \t')