Skip to content

Commit

Permalink
Remove custom validation and just use nargs
Browse files Browse the repository at this point in the history
  • Loading branch information
trallnag committed Jan 1, 2025
1 parent f63a5e9 commit 992cdc4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/filter_pre_commit_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
parser.add_argument(
"filters",
type=str,
nargs="*",
nargs="+",
help=(
"What to filter out, i.e. what should not show up in the resulting "
"list. In the `id` mode, these are the hook identifiers themselves to "
Expand All @@ -95,9 +95,6 @@
mode: Literal["id", "tag"] = args.mode
filters: list[str] = args.filters

if not filters:
parser.error("No filters provided.")

with open(args.config) as pre_commit_config:
pre_commit_config_content: str = pre_commit_config.read()

Expand Down
2 changes: 1 addition & 1 deletion tests/test_filter_pre_commit_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_filter_empty() -> None:

result = run_with()
assert result.returncode != 0
assert "No filters provided." in result.stderr
assert "the following arguments are required: filters" in result.stderr


def test_unknown_fail_default() -> None:
Expand Down

0 comments on commit 992cdc4

Please sign in to comment.