Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: PyCQA/flake8
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.0.2
Choose a base ref
...
head repository: PyCQA/flake8
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.0.3
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Aug 1, 2022

  1. Copy the full SHA
    25e8ff1 View commit details
  2. Merge pull request #1648 from PyCQA/invalid-syntax-partial-parse

    ignore config files that partially parse as flake8 configs
    asottile authored Aug 1, 2022
    Copy the full SHA
    e76b59a View commit details
  3. Release 5.0.3

    asottile committed Aug 1, 2022
    Copy the full SHA
    ff6569b View commit details
Showing with 21 additions and 3 deletions.
  1. +15 −0 docs/source/release-notes/5.0.3.rst
  2. +1 −0 docs/source/release-notes/index.rst
  3. +1 −1 src/flake8/__init__.py
  4. +1 −1 src/flake8/options/config.py
  5. +3 −1 tests/unit/test_options_config.py
15 changes: 15 additions & 0 deletions docs/source/release-notes/5.0.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
5.0.3 -- 2022-08-01
-------------------

You can view the `5.0.3 milestone`_ on GitHub for more details.

Bugs Fixed
~~~~~~~~~~

- Work around partial reads of configuration files with syntax errors (See
also :issue:`1647`, :pull:`1648`).


.. all links
.. _5.0.3 milestone:
https://github.com/PyCQA/flake8/milestone/45
1 change: 1 addition & 0 deletions docs/source/release-notes/index.rst
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ with the newest releases first.
==================

.. toctree::
5.0.3
5.0.2
5.0.1
5.0.0
2 changes: 1 addition & 1 deletion src/flake8/__init__.py
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.NullHandler())

__version__ = "5.0.2"
__version__ = "5.0.3"
__version_info__ = tuple(int(i) for i in __version__.split(".") if i.isdigit())

_VERBOSITY_TO_LOG_LEVEL = {
2 changes: 1 addition & 1 deletion src/flake8/options/config.py
Original file line number Diff line number Diff line change
@@ -29,9 +29,9 @@ def _find_config_file(path: str) -> Optional[str]:
home_stat = None

dir_stat = _stat_key(path)
cfg = configparser.RawConfigParser()
while True:
for candidate in ("setup.cfg", "tox.ini", ".flake8"):
cfg = configparser.RawConfigParser()
cfg_path = os.path.join(path, candidate)
try:
cfg.read(cfg_path, encoding="UTF-8")
4 changes: 3 additions & 1 deletion tests/unit/test_options_config.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,9 @@ def test_config_file_without_section_is_not_considered(tmp_path):


def test_config_file_with_parse_error_is_not_considered(tmp_path, caplog):
tmp_path.joinpath("setup.cfg").write_text("[error")
# the syntax error here is deliberately to trigger a partial parse
# https://github.com/python/cpython/issues/95546
tmp_path.joinpath("setup.cfg").write_text("[flake8]\nx = 1\n...")

assert config._find_config_file(str(tmp_path)) is None