-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Reduce reference of IO globals #500
Conversation
8d6cda4
to
3cea008
Compare
I agree that the state this PR is resulting in is clearly showing a smell. Still I think this state is better than before: The PR addresses the problem that mutant at various location interacted with IO globals, and the only way to spec these was A): Running the IO operation and observing the mostly global state change B) hooking the IO global via a message expectation, resulting in observable inconsistencies under parallelization (rspec does not do this, but xspec will!)
Exactly. That is planned at the next step. But before I want to "lift" the IO globals into the config object, to get a clear "index" on what the wrapping class needs to provide. See this PR as a small intermediary.
Its much easier to go from "config object holds globals" to "we have a mutant specific IO object we can pass around" than from "IO globals are everywhere" to the desired state. There will be some other PRs that reduce more IO global use, the code base still references With that arguments: @dkubb Ready for the next pass. |
661f686
to
b41f1fe
Compare
c4c887e
to
ba07692
Compare
@@ -204,7 +204,11 @@ class Config | |||
integration: Integration::Null, | |||
isolation: Mutant::Isolation::Fork, | |||
jobs: Mutant.ci? ? CI_DEFAULT_PROCESSOR_COUNT : ::Parallel.processor_count, | |||
kernel: Kernel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you've audited the code to make sure it doesn't refer to anything outside of the Mutant
namespace, besides here of course?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No direct references to Kernel
exist inside the mutant namespaces anymore, correct. But other IO globals are still referenced and need future iterations, this PR is only the first step.
I extracted this PR out of a bigger change, as other changes need refactorings to be applied first.
@mbj I finished a pass over this code. |
ba07692
to
ece8edd
Compare
@dkubb Ready for the next pass. |
@@ -153,14 +164,14 @@ def add_debug_options(opts) | |||
end | |||
opts.on('--version', 'Print mutants version') do | |||
puts("mutant-#{VERSION}") | |||
Kernel.exit(EXIT_SUCCESS) | |||
config.kernel.exit(EXIT_SUCCESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the default status code for Kernel.exit
success? If so, then the EXIT_SUCCESS
argument isn't required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to remove the EXIT_SUCCESS
constant altogether?
ba22f2b
to
8d4c326
Compare
@mbj I finished a pass over this PR. |
432f03c
to
540edf8
Compare
Depends on #508 |
59e81fb
to
5262a1e
Compare
e74414f
to
9194723
Compare
I noted remaining globals as I looked through mutant. I don't think this is exhaustive and it doesn't cover implicit usage like with Kernel:
|
@backus Yeah, I'm ware this PR is not exhaustive. Its intend to slice small portions each time I find motivations. In So not all of the globals in your list have to be changed, as there are AFAIK no message expectations on for example |
Ah yeah I understood that. I just wanted to have some idea of what is still left and I also wanted to know if you are actually planning to kill all of these constant references too. |
Longterm yes.Currently I cut the iteration into a small one to get it merged as an iterative improvement before it grew to big. I'll do followups to focus on the globals I've to place message expectations on. This is the blocker for making mutant hosted on
NP |
9194723
to
fe1deba
Compare
8e1c08e
to
f45d276
Compare
@@ -13,7 +13,11 @@ class Config | |||
:includes, | |||
:isolation, | |||
:jobs, | |||
:kernel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mbj not a blocker, but should this Array of Symbols be defined using %i[...]
?
f45d276
to
9ab35de
Compare
No description provided.