From 9938c92fd72deda1156aca79946d7996a5365eaa Mon Sep 17 00:00:00 2001 From: Andrew Zhou Date: Fri, 8 May 2020 08:01:42 -0500 Subject: [PATCH] Add error on non-list target-version in config file (#1284) --- black.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/black.py b/black.py index ff4f098..b3f387a 100644 --- a/black.py +++ b/black.py @@ -296,6 +296,12 @@ def read_pyproject_toml( if not config: return None + target_version = config.get("target_version") + if target_version is not None and not isinstance(target_version, list): + raise click.BadOptionUsage( + "target-version", f"Config key target-version must be a list" + ) + default_map: Dict[str, Any] = {} if ctx.default_map: default_map.update(ctx.default_map) -- 2.39.5