Configuration methods do not have consistent naming
suaviloquence opened this issue · comments
Question on method naming: it seems like we now have a
set_level()
method where before we had awith_log_level()
method. Is this divergence intentional, or should we instead have eitherset_log_level()
orwith_log_level()
as before? Similar question about with the otherset_...()
methods, as opposed to the existingwith_...()
methods' naming convention.
The
GlobalConfig::set_level
method already existed before this PR, so I left it unchanged. Additionally, since we used to have that and theset_color_choice
method, I used theset_
prefix forGlobalConfig
setters. I agree that it's not consistent betweenGlobalConfig
andCheck
, but they are both internally consistent. Should we use the same prefix for everything? If so, in here, or in a different PR?
Originally posted by @suaviloquence in #737 (comment)
If we want all the methods to be consistent across Check
and GlobalConfig
, we need to choose:
- do we want the
with_
(found inCheck
) prefix or theset_
(fromGlobalConfig
) prefix? - do we want
set_log_level
orset_level
?
I definitely prefer log_level
over level
, and I have a slight preference for set
over with
. What do others think?
Sounds good, let's go with that!
Probably best to make this change now, before the next release, so that we only break the API once. Would you mind posting the updated migration guide together with the PR?
I can do that. One other thing: do we want to standardize the calling convention? Currently only set_level
takes an owned Self
(and it doesn't use it, we could use a &mut self
). If we copy the Check
convention, setter methods go fn(&mut self, ...) -> &mut self
which I think makes a lot of sense.
Sounds good to me!