Skip to content

Commit 0e8dbe2

Browse files
authored
Merge pull request #842 from akaihola/better-missing-black-error
Improve run-time error when Black missing
2 parents c393977 + 932a2d6 commit 0e8dbe2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/darker/formatters/black_wrapper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
import black # noqa: F401 # pylint: disable=unused-import
1111
except ImportError as exc:
1212
logger.warning(
13+
"Since Darker 3.0.0, Black is no longer installed by default. "
1314
"To re-format code using Black, install it using e.g."
1415
" `pip install 'darker[black]'` or"
1516
" `pip install black`"
1617
)
1718
logger.warning(
1819
"To use a different formatter or no formatter, select it on the"
19-
" command line (e.g. `--formatter=none`) or configuration"
20+
" command line (e.g. `--formatter=ruff`) or configuration"
2021
" (e.g. `formatter=none`)"
2122
)
2223
MESSAGE = "Can't find the Black package"

src/darker/tests/test_formatters_black.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ def test_formatter_without_black(caplog):
8484
record.msg for record in caplog.records if record.levelname == "WARNING"
8585
] == [
8686
# warning 1:
87+
"Since Darker 3.0.0, Black is no longer installed by default. "
8788
"To re-format code using Black, install it using e.g."
8889
" `pip install 'darker[black]'` or `pip install black`",
8990
# warning 2:
9091
"To use a different formatter or no formatter, select it on the command line"
91-
" (e.g. `--formatter=none`) or configuration (e.g. `formatter=none`)",
92+
" (e.g. `--formatter=ruff`) or configuration (e.g. `formatter=none`)",
9293
]
9394

9495

0 commit comments

Comments
 (0)