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

Exclude specified paths from mutants generation #58

Closed
dmoka opened this issue Aug 5, 2022 · 4 comments · Fixed by #65
Closed

Exclude specified paths from mutants generation #58

dmoka opened this issue Aug 5, 2022 · 4 comments · Fixed by #65
Assignees
Labels
next Likely to be worked on soon

Comments

@dmoka
Copy link
Contributor

dmoka commented Aug 5, 2022

I believe that it would be handy to exclude specified paths from the mutants generation.

Let's say that I want to exclude things like configuration logic or some test helper logic files, located within the src directory. Right now the default behaviour of cargo mutants command is that it tries to generate mutants for every file in the src directory and in their child directories.

I could envision having a command line parameter as follows:

cargo mutants --exclude <regexes-for-paths-to-be-excluded>

Use case scenario:

Prerequisite:

Git clone test repo

Steps:

  1. Go to the main directory of the cloned repo
  2. Execute the following command
cargo mutants --exclude "(\/src\/tests)" "(\/src\/config)"

Expected behaviour:

Every file which is located in either /src/tests or /src/config directories are excluded from mutants generation.

Actual behaviour:

Because of the default behaviour of cargo-mutants (and due to the non-existency of this command line parameter) there are mutants generated for the files both in /src/tests and /src/config

@sourcefrog
Copy link
Owner

Yep. There is already -f to say which files you do want to test. We could usefully and easily add the opposite. I think it should be a glob (as -f is) not a regexp.

@dmoka
Copy link
Contributor Author

dmoka commented Aug 6, 2022

You are right, glob is indeed a much better one for paths.

I believe that it would be a nice first-issue for me, would be glad to pick this task up. Is it fine by you?

@sourcefrog
Copy link
Owner

That would be great, thanks! You should be able to work off the existing -f implementation.

@sourcefrog sourcefrog added the next Likely to be worked on soon label Aug 7, 2022
@dmoka
Copy link
Contributor Author

dmoka commented Aug 8, 2022

PR has been created, ready to be reviewed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next Likely to be worked on soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants