From 2f9c8eae8c723fdf149a60f316483c30503d62ca Mon Sep 17 00:00:00 2001 From: Oula Kuuva Date: Wed, 18 Sep 2024 11:40:41 +0300 Subject: [PATCH 1/4] fix: include flynt in DarkerConfig --- src/darker/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/darker/config.py b/src/darker/config.py index 6b4f90893..b615f2a08 100644 --- a/src/darker/config.py +++ b/src/darker/config.py @@ -37,6 +37,7 @@ class DarkerConfig(BaseConfig, total=False): """Dictionary representing ``[tool.darker]`` from ``pyproject.toml``""" diff: bool + flynt: bool check: bool isort: bool lint: list[str] From 2cf83e7e3fb11661c48f848f326ad8843572456d Mon Sep 17 00:00:00 2001 From: Oula Kuuva Date: Wed, 18 Sep 2024 11:41:03 +0300 Subject: [PATCH 2/4] style: sort DarkerConfig options --- src/darker/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/darker/config.py b/src/darker/config.py index b615f2a08..7a9a062e7 100644 --- a/src/darker/config.py +++ b/src/darker/config.py @@ -36,14 +36,14 @@ class DarkerConfig(BaseConfig, total=False): """Dictionary representing ``[tool.darker]`` from ``pyproject.toml``""" + check: bool diff: bool flynt: bool - check: bool isort: bool + line_length: int lint: list[str] - skip_string_normalization: bool skip_magic_trailing_comma: bool - line_length: int + skip_string_normalization: bool target_version: str formatter: str From ac1ac120d0df38c83ea0c67736f081b830c5c3fa Mon Sep 17 00:00:00 2001 From: Oula Kuuva Date: Tue, 26 Nov 2024 12:24:17 +0200 Subject: [PATCH 3/4] test: flynt cli flags and config option --- src/darker/tests/test_command_line.py | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/darker/tests/test_command_line.py b/src/darker/tests/test_command_line.py index 6d108e32d..4666e1d7b 100644 --- a/src/darker/tests/test_command_line.py +++ b/src/darker/tests/test_command_line.py @@ -112,6 +112,24 @@ def get_darker_help_output(capsys): expect_config=("isort", True), expect_modified=("isort", True), ), + dict( + argv=["."], + expect_value=("flynt", False), + expect_config=("flynt", False), + expect_modified=("flynt", ...), + ), + dict( + argv=["-f", "."], + expect_value=("flynt", True), + expect_config=("flynt", True), + expect_modified=("flynt", True), + ), + dict( + argv=["--flynt", "."], + expect_value=("flynt", True), + expect_config=("flynt", True), + expect_modified=("flynt", True), + ), dict( argv=["."], expect_value=("lint", []), @@ -280,6 +298,7 @@ def test_parse_command_line( dict(config={"stdout": True}, expect_warn=set()), dict(config={"check": True}, expect_warn=set()), dict(config={"isort": True}, expect_warn=set()), + dict(config={"flynt": True}, expect_warn=set()), dict( config={"lint": ["dummy"]}, expect_warn={ @@ -694,6 +713,16 @@ def test_black_config_file_and_options(git_repo, config, options, expect): {}, ), ), + dict( + options=["--flynt", "a.py"], + expect=( + Path("git_root"), + {Path("a.py")}, + Exclusions(isort={"**/*"}), + RevisionRange("HEAD", ":WORKTREE:"), + {}, + ), + ), dict( options=["--config", "my.cfg", "a.py"], expect=( From b5c1e19ed998f0b5a80a941f23705a0b79383903 Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:31:57 +0200 Subject: [PATCH 4/4] docs: update the change log --- CHANGES.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9f03adf0d..e65063939 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,7 +20,7 @@ Added - Invoking Black is now implemented as a plugin. This allows for easier integration of other formatters in the future. There's also a dummy ``none`` formatter plugin. - ``--formatter=none`` now skips running Black. This is useful when you only want to run - Isort or Flynt. + Isort or Flynt_. Removed ------- @@ -42,6 +42,7 @@ Fixed - Pass full environment to Git to avoid the "dubious ownership" error. - Work around a `pathlib.Path.resolve` bug in Python 3.8 and 3.9 on Windows. The work-around should be removed when Python 3.8 and 3.9 are no longer supported. +- Add missing configuration flag for Flynt_. 2.1.1_ - 2024-04-16 @@ -79,7 +80,7 @@ Added - Update to ``ioggstream/bandit-report-artifacts@v1.7.4`` in CI. - Support for Python 3.12 in the package metadata and the CI build. - Update to Black 24.2.x and isort 5.13.x in pre-commit configuration. -- Test against Flynt ``master`` branch in the CI build. +- Test against Flynt_ ``master`` branch in the CI build. - Update to Darkgraylib 1.1.1 to get fixes for README formatting. - Improved "How does it work?" section in the README. - README section on limitations and work-arounds. @@ -189,7 +190,7 @@ Fixed ----- - Use ``git worktree`` to create a repository checkout for baseline linting. This avoids issues with the previous ``git clone`` and ``git checkout`` based approach. -- Disallow Flynt version 0.78 and newer to avoid an internal API incompatibility. +- Disallow Flynt_ version 0.78 and newer to avoid an internal API incompatibility. - In CI builds, run the ``commit-range`` action from the current checkout instead of pointing to a release tag. This fixes workflows when in a release branch. - Linting fixes: Use ``stacklevel=2`` in ``warnings.warn()`` calls as suggested by @@ -678,6 +679,7 @@ Added .. _pygments: https://pypi.org/project/Pygments/ .. _Darkgraylib: https://pypi.org/project/darkgraylib/ .. _Flake8: https://flake8.pycqa.org/ +.. _Flynt: https://pypi.org/project/flynt/ .. _Graylint: https://pypi.org/project/graylint/ .. _Mypy: https://www.mypy-lang.org/ .. _pydocstyle: http://www.pydocstyle.org/