-
Notifications
You must be signed in to change notification settings - Fork 189
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
feat(MutateArgument): Allow the user to specify which files to mutate. #662
feat(MutateArgument): Allow the user to specify which files to mutate. #662
Conversation
…tationTestProcess
…https://github.com/anhaehne/stryker-net into 421_Should_not_be_a_mutant_for_ConfigureAwait(false)
* Added support for wild cards * Added documentation for the new command line argument
build(deps): bump Microsoft.CodeAnalysis.CSharp in /integrationtest (…
Merged stryker master
@anhaehne The problem is this: You're not normalizing the filePattern, so it will never accurately match. @richardwerkman I'm feeling like our decision to normalize all filepaths to the current filesystem is maybe the wrong choice. Perhaps we should agree on one style of filepaths to be used internally by stryker (including in filters and such) and then only normalize to the current filesystem filepaths when we're interacting with the filesystem. Then in the rest of stryker we can be sure what filepaths should look like, and always convert to "StrykerInternalPathSeperator" or something. |
So should we just normalize all paths to forwardslash ('/') since both windows and *nix understand those? |
If that works, I am okay with that solution. How about you @richardwerkman ? It does mean we need to normalize every single path or path filter going in and out of stryker. We may be missing some cases right now that accidentally work fine but might break if we change how we normalize. |
I've looked at the code of On unix it's just forwards slashes since backwards slashes are not allowed anyways. [2]. When normalizing we should probably just replace both with So |
Ah I did not realize Path.AltDirectorySeparatorChar was / on windows. That is almost what we do already in FilePathUtils.Convert but it would be would be more clean to use AltDirectorySeparatorChar. |
…/anhaehne/stryker-net into 322_Specify_what_files_to_mutate
Ok i found the reason one integration test did work locally on my machine. I renamed a file but only changed the casing, which git obviously didn't care about. 😄 So if there are no more change request we can complete this PR. |
Awesome! 👍 Will take a look as soon as I have time. |
@anhaehne While testing locally on a full framework project from my company stryker crashed in an unexpected way while mutating. The latest released version of stryker does not have this problem. I'm currently investigating whether the problem is with this PR or with master. |
If you got a log or a way to reproduce it, let me know. |
The issue seems to be with master, but since I can't validate whether this change works on my internal project I'm not gonna merge it until we fix master. I don't see any changes neccesary in the PR at this time though so it should get merged after. |
integrationtest/TargetProjects/NetCoreTestProject.XUnit/NetCoreTestProject.XUnit.csproj
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I created a new
IMutantFilter
that allow to specify which files should be in- or excluded as described in #322.The
files-to-excluded
parameter is now marked as deprecated but the changes should be fully backwards compatible. Iffiles-to-excluded
is specified their paths will be converted to exclude file patterns in theStrykerOptions
.New configuration section:
Mutate
To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.
The patterns support globbing syntax to allow wildcards.
You can add an
!
in front of the pattern to exclude all files that match the pattern.When only exclude patterns are provided, all files will be included that do not match any exclude pattern. If both, include and exclude patterns, are provided, only the files that match an include pattern but not also an exclude pattern will be included. The order of the patterns is irrelevant.
Example:
To allow more fine grained filtering you can also specify the span of text that should be in- or excluded. A span is defined by the indices of the first character and the last character.