Skip to content

Commit

Permalink
feat: remove deprecated options in [tool.darker]
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Aug 9, 2024
1 parent 811616f commit 7f3dc76
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Added
- Do not reformat renamed files.
- CI workflow to post recent project activity in a discussion. Triggered manually.

Removed
-------
- In the Darker configuration file under ``[tool.darker]``, the Black configuration
options ``skip_string_normalization`` and ``skip_magic_trailing_comma`` are no longer
valid. Use ``[tool.black]`` instead.

Fixed
-----
- Update ``darkgray-dev-tools`` for Pip >= 24.1 compatibility.
Expand Down
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@ command line options

*New in version 1.7.0:* The ``-f`` / ``--flynt`` command line option

*New in version 2.1.1:* In ``[tool.darker]``, deprecate the the Black options
``skip_string_normalization`` and ``skip_magic_trailing_comma``
*New in version 3.0.0:* In ``[tool.darker]``, remove the the Black options
``skip_string_normalization`` and ``skip_magic_trailing_comma`` (previously deprecated
in version 2.1.1)

.. _Black documentation about pyproject.toml: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
.. _isort documentation about config files: https://timothycrosley.github.io/isort/docs/configuration/config_files/
Expand Down
30 changes: 7 additions & 23 deletions src/darker/tests/test_command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,6 @@ def test_parse_command_line(
dict(config={"check": True}, expect_warn=set()),
dict(config={"isort": True}, expect_warn=set()),
dict(config={"lint": ["pylint"]}, expect_warn=set()),
dict(
config={"skip_string_normalization": True},
expect_warn={
"The configuration option `skip_string_normalization` in [tool.darker] is"
" deprecated and will be removed in Darker 3.0."
},
),
dict(
config={"skip_magic_trailing_comma": True},
expect_warn={
"The configuration option `skip_magic_trailing_comma` in [tool.darker] is"
" deprecated and will be removed in Darker 3.0."
},
),
dict(config={"line_length": 88}, expect_warn=set()),
dict(config={"target_version": "py37"}, expect_warn=set()),
dict(
Expand All @@ -273,23 +259,21 @@ def test_parse_command_line(
"check": True,
"isort": True,
"lint": ["pylint"],
"skip_string_normalization": True,
"skip_magic_trailing_comma": True,
"line_length": 88,
"target_version": "py37",
},
expect_warn={
"The configuration option `skip_magic_trailing_comma` in [tool.darker] is"
" deprecated and will be removed in Darker 3.0.",
"The configuration option `skip_string_normalization` in [tool.darker] is"
" deprecated and will be removed in Darker 3.0.",
},
expect_warn=set(),
),
)
def test_parse_command_line_deprecated_option(
tmp_path, monkeypatch, config, expect_warn
):
"""`parse_command_line` warns about deprecated configuration options."""
"""`parse_command_line` warns about deprecated configuration options.
Currently no options are under deprecation, but this test is kept here as a
placeholder so it's easy to add new tests when new deprecated options are added.
"""
monkeypatch.chdir(tmp_path)
(tmp_path / "pyproject.toml").write_text(toml.dumps({"tool": {"darker": config}}))
with patch("darker.command_line.warnings.warn") as warn:
Expand Down

0 comments on commit 7f3dc76

Please sign in to comment.