Skip to content

Commit

Permalink
Merge pull request #746 from okuuva/745-include-flynt-in-darkerconfig
Browse files Browse the repository at this point in the history
fix: include flynt in darkerconfig
  • Loading branch information
akaihola authored Dec 15, 2024
2 parents 05fdba2 + b5c1e19 commit f88e8cb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand All @@ -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
Expand Down Expand Up @@ -79,7 +80,7 @@ Added
- Update to ``ioggstream/[email protected]`` 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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
7 changes: 4 additions & 3 deletions src/darker/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@
class DarkerConfig(BaseConfig, total=False):
"""Dictionary representing ``[tool.darker]`` from ``pyproject.toml``"""

diff: bool
check: bool
diff: bool
flynt: 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

Expand Down
29 changes: 29 additions & 0 deletions src/darker/tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", []),
Expand Down Expand Up @@ -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={
Expand Down Expand Up @@ -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=(
Expand Down

0 comments on commit f88e8cb

Please sign in to comment.