Skip to content
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

Filter --tag broken #142

Closed
kirides opened this issue Sep 7, 2023 · 1 comment · Fixed by #143
Closed

Filter --tag broken #142

kirides opened this issue Sep 7, 2023 · 1 comment · Fixed by #143
Assignees
Labels
bug Something isn't working

Comments

@kirides
Copy link
Contributor

kirides commented Sep 7, 2023

Describe the bug
Filtering a spec by tag using --tag A --tag B is currently broken as it only accepts the last filter entered.

Instead it should keep all paths that contain any of the tags.

Additional context

This is due to the following check constantly overriding previous results:
exclude = method.Value.Tags?.Exists(x => x == tag) != true;

The code may be rewritten, to remove the looping over includeTags by using the following:

var exclude = method.Value.Tags?.Exists(includeTags.Contains) != true;

Also, previously the enumerated collections were cloned, to not break the enumeration, after the rewrite the enumerators are reused (.ToArray() was removed)

7025d61#diff-275851d6772d6a0a03b9aaf63017c87331d0334e274deeebd199fe8cd07cc521R34

7025d61#diff-275851d6772d6a0a03b9aaf63017c87331d0334e274deeebd199fe8cd07cc521R37

deleting from an collection that is currently enumerated is undefined behavior

@kirides kirides added the bug Something isn't working label Sep 7, 2023
kirides added a commit to kirides/refitter that referenced this issue Sep 7, 2023
@christianhelle
Copy link
Owner

Good catch @kirides

My bad for breaking this 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants