From b52fd2724b529361c20ff30e7181a59e3bea9e78 Mon Sep 17 00:00:00 2001 From: Kyle King Date: Wed, 18 Dec 2024 07:04:00 -0500 Subject: [PATCH] refactor: finish renaming the stored value to validate --- src/mdformat/_cli.py | 2 +- src/mdformat/_conf.py | 8 ++++---- tests/test_config_file.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mdformat/_cli.py b/src/mdformat/_cli.py index 7234fbd..49635e6 100644 --- a/src/mdformat/_cli.py +++ b/src/mdformat/_cli.py @@ -143,7 +143,7 @@ def run(cli_args: Sequence[str]) -> int: # noqa: C901 for plugin in enabled_parserplugins.values() ) if ( - not opts["no_validate"] + opts["validate"] and not changes_ast and not is_md_equal( original_str, diff --git a/src/mdformat/_conf.py b/src/mdformat/_conf.py index 151a639..a26e2eb 100644 --- a/src/mdformat/_conf.py +++ b/src/mdformat/_conf.py @@ -8,7 +8,7 @@ DEFAULT_OPTS = { "wrap": "keep", - "no_validate": False, + "validate": True, "number": False, "end_of_line": "lf", "exclude": [], @@ -60,9 +60,9 @@ def _validate_values(opts: Mapping, conf_path: Path) -> None: # noqa: C901 if "end_of_line" in opts: if opts["end_of_line"] not in {"crlf", "lf", "keep"}: raise InvalidConfError(f"Invalid 'end_of_line' value in {conf_path}") - if "no_validate" in opts: - if not isinstance(opts["no_validate"], bool): - raise InvalidConfError(f"Invalid 'no_validate' value in {conf_path}") + if "validate" in opts: + if not isinstance(opts["validate"], bool): + raise InvalidConfError(f"Invalid 'validate' value in {conf_path}") if "number" in opts: if not isinstance(opts["number"], bool): raise InvalidConfError(f"Invalid 'number' value in {conf_path}") diff --git a/tests/test_config_file.py b/tests/test_config_file.py index b34d7d9..16e1cc7 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -64,7 +64,7 @@ def test_invalid_toml(tmp_path, capsys): [ ("wrap", "wrap = -3"), ("end_of_line", "end_of_line = 'lol'"), - ("no_validate", "no_validate = 1"), + ("validate", "validate = 'off'"), ("number", "number = 0"), ("exclude", "exclude = '**'"), ("exclude", "exclude = ['1',3]"),