-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
[Question] Is there any way to specify wildcard match expression for the subjects? #1272
Comments
There is an unreleased version that makes mutant rails aware allowing you to do |
First iteration for primary rails support is adding env variables pre app boot, which is done in: #1274. |
@mbj NP, nothing critical here, just wanted to know if I miss something. I checked the source code and seems that now I understand that if no module is specified, |
@omaik Yes its overall a signalling issue in the wider ruby ecosystem. We have a "flat global mutable object namespace". And unless you use sorbet: "Everything can add classes/modules everywhere". Mutant hence has to be given a "root" to expand from, to not have to read the source locations of every method available to eventually fall within your repository (Which would be very slow at scale). The rails integration I'm working on gives mutant some defaults like a new match expression An alternative for the "owned" namespace detection is to use the local sorbet setup. This is something being worked on in a currently private branch I'll be able to push soon. Mutant is in a funny chicken egg situation, where these features prevent adoption. But until I get more subscribers, I need to keep working hard outside of mutant. So thanks for your patience ;). |
@omaik making progress in smaller steps, I just extracted a descendants matcher primitive that will be part of tonights 0.11.2 release: It allows to match subjects by inheritance tree that does NOT form a namespace topology. As typical rails does not:
You can now match all descendants of application controller via the new match expression: Note this is not rails or controller specific syntax. It works with any inheritance tree. Together with eager loading you should now be able to get much nicer mutant matches. Please be aware that mutant supports multiple match expressions, so you can do:
in the same execution. |
@mbj This is awesome, will check this out. Thank you so much! |
@mbj This feature works as expected and covers 99% of our codebase because almost all classes are inherited from a few base classes. Thanks again! |
@omaik Thanks for the feedback. Much appreciated. |
** Summary:
I have a rails project, on which I want to configure the CI job, to run mutations for all changed classes in incremental mode.
My
.mutant.yml
** Commands that work fine:
** Problem :
I would like to run mutations across ALL classes. Since this is a Rails project, there are many top-level classes(Models, Controllers, etc). It will be painful to specify all of them in the config file, and someone may forget to add there a new class.
Tried something like these, but mutant does not match any subject.
Probably I just doing something wrong and missing obvious stuff, please forgive me for that.
Thanks in advance!
The text was updated successfully, but these errors were encountered: