Skip to content

Commit

Permalink
refactor: finish renaming the stored value to validate
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKing committed Dec 18, 2024
1 parent 1b19f1f commit b52fd27
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/mdformat/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/mdformat/_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

DEFAULT_OPTS = {
"wrap": "keep",
"no_validate": False,
"validate": True,
"number": False,
"end_of_line": "lf",
"exclude": [],
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"),
Expand Down

0 comments on commit b52fd27

Please sign in to comment.