forked from sahib/rmlint
-
Notifications
You must be signed in to change notification settings - Fork 0
Add --match-relative-path duplicate filter and document ASCII-only case matching semantics
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b0499e
Initial plan
Copilot 15607d9
Add match-relative-path option with docs and tests
Copilot 14dc992
Address review feedback and finalize match-relative-path changes
Copilot 3299dc9
Clarify UTF-8 behavior for ASCII-only case-insensitive matching
Copilot 0d8ddb3
Add deeper and unequal-depth match-relative-path tests
Copilot e85305e
Update lib/file.c
dictcp d88a0f3
Add explicit file-input regression test for match-relative-path
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/usr/bin/env python3 | ||
| # encoding: utf-8 | ||
| from tests.utils import * | ||
|
|
||
|
|
||
| def test_positive_match_relative_path(usual_setup_usual_teardown): | ||
| create_file('xxx', 'base_a/snap/test') | ||
| create_file('xxx', 'base_b/snap/test') | ||
|
|
||
| head, *data, footer = run_rmlint( | ||
| '--match-relative-path {t}/base_a {t}/base_b'.format(t=TESTDIR_NAME), | ||
| use_default_dir=False | ||
| ) | ||
|
dictcp marked this conversation as resolved.
|
||
| assert footer['total_files'] == 2 | ||
| assert footer['total_lint_size'] == 3 | ||
| assert footer['duplicates'] == 1 | ||
|
|
||
|
|
||
| def test_negative_match_relative_path(usual_setup_usual_teardown): | ||
|
dictcp marked this conversation as resolved.
|
||
| create_file('xxx', 'base_a/snap1/test') | ||
| create_file('xxx', 'base_b/snap2/test') | ||
|
|
||
| head, *data, footer = run_rmlint( | ||
| '--match-relative-path {t}/base_a {t}/base_b'.format(t=TESTDIR_NAME), | ||
| use_default_dir=False | ||
| ) | ||
| assert footer['total_files'] == 2 | ||
| assert footer['total_lint_size'] == 0 | ||
| assert footer['duplicates'] == 0 | ||
|
|
||
|
|
||
| def test_negative_match_relative_path_unequal_depth(usual_setup_usual_teardown): | ||
| create_file('xxx', 'base_a/snap/test') | ||
| create_file('xxx', 'base_b/deeper/snap/test') | ||
|
|
||
| head, *data, footer = run_rmlint( | ||
| '--match-relative-path {t}/base_a {t}/base_b'.format(t=TESTDIR_NAME), | ||
| use_default_dir=False | ||
| ) | ||
| assert footer['total_files'] == 2 | ||
| assert footer['total_lint_size'] == 0 | ||
| assert footer['duplicates'] == 0 | ||
|
|
||
|
|
||
| def test_positive_match_relative_path_depth_4(usual_setup_usual_teardown): | ||
| create_file('xxx', 'base_a/l1/l2/l3/test') | ||
| create_file('xxx', 'base_b/l1/l2/l3/test') | ||
|
|
||
| head, *data, footer = run_rmlint( | ||
| '--match-relative-path {t}/base_a {t}/base_b'.format(t=TESTDIR_NAME), | ||
| use_default_dir=False | ||
| ) | ||
| assert footer['total_files'] == 2 | ||
| assert footer['total_lint_size'] == 3 | ||
| assert footer['duplicates'] == 1 | ||
|
|
||
|
|
||
| def test_negative_match_relative_path_explicit_files(usual_setup_usual_teardown): | ||
| path_a = create_file('xxx', 'base_a/file_a') | ||
| path_b = create_file('xxx', 'base_b/file_b') | ||
|
|
||
| head, *data, footer = run_rmlint( | ||
| '--match-relative-path', path_a, path_b, | ||
| use_default_dir=False | ||
| ) | ||
| assert footer['total_files'] == 2 | ||
| assert footer['total_lint_size'] == 0 | ||
| assert footer['duplicates'] == 0 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.