From 3d305e15ef6329613dfea843eda0d5cc280017ed Mon Sep 17 00:00:00 2001 From: Ryan Miguel Date: Tue, 18 Oct 2022 23:16:57 -0700 Subject: [PATCH] Forbid the combination of unique and ignore case options per maintainers comments in #794. Removes a test that is no longer valid now that this combination is no longer supported. Closes #794. --- pre_commit_hooks/file_contents_sorter.py | 5 +++++ tests/file_contents_sorter_test.py | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pre_commit_hooks/file_contents_sorter.py b/pre_commit_hooks/file_contents_sorter.py index c5691f0..7477657 100644 --- a/pre_commit_hooks/file_contents_sorter.py +++ b/pre_commit_hooks/file_contents_sorter.py @@ -65,6 +65,11 @@ def main(argv: Sequence[str] | None = None) -> int: ) args = parser.parse_args(argv) + if args.ignore_case and args.unique: + print('ERROR: usage of --unique and --ignore-case is unsupported. \ + Please update your configuration.') + return FAIL + retv = PASS for arg in args.filenames: diff --git a/tests/file_contents_sorter_test.py b/tests/file_contents_sorter_test.py index 5e79e40..119d8a2 100644 --- a/tests/file_contents_sorter_test.py +++ b/tests/file_contents_sorter_test.py @@ -68,12 +68,6 @@ from pre_commit_hooks.file_contents_sorter import PASS ( b'fee\nFie\nFoe\nfum\n', ['--unique', '--ignore-case'], - PASS, - b'fee\nFie\nFoe\nfum\n', - ), - ( - b'fee\nfee\nFie\nFoe\nfum\n', - ['--unique', '--ignore-case'], FAIL, b'fee\nFie\nFoe\nfum\n', ),