-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
config: small refactoring and unit tests for types #1933
Conversation
aba9563
to
163eb72
Compare
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.
I've gone through most of this, but could use a bit of background on what you were trying to accomplish with the FilenameAttribute
changes. Without context, I just see removing a bunch of stuff that doesn't appear to be replaced with new code doing the same thing. (Looking at magic __set__
/__get__
methods and env-var handling, specifically.)
Surely there's a connection between these changes and the ones above in BaseValidated
etc., that I'm just not seeing. 🙁 And if that's not the code-review equivalent of "it's not you, it's me", I don't know what is. 😅
Sidebar: Now that FilenameAttribute
creating the file/directory it's set to has been shoved in my face, I'm not sure I like that behavior. I'll add that to my list of things to think about, and write up an issue if I still don't like it after investigating.
Before:
After:
If I could, I'd wreak havoc on
Yeah I hate that too, but there are plugins (at least one is built-in IIRC) that expects this behaviour. It annoys me. This whole config annoys me. |
Seems like something that could be changed for… what would you say to 9.0? Though I guess, as usual, it's a trade-off between maintaining backward compatibility with older code that implements custom config types (probably rare) and making the current code more straightforward. Yeah, what else is new. 😁 But honestly, just because implementing custom config setting types seems like such an obscure thing to do, I'm not sure it's worth the effort of making sure warnings about a Grand Interface Change track across documentation and changelogs for multiple Sopel releases. I need more of a cost/benefit analysis than exists right now; "wreak havoc" doesn't tell me much except hint that it'd be a breaking change. 😝 Abstraction layers aren't inherently bad if there's a purpose for them. We do use SQLAlchemy, after all…
Maybe for 8.0 we can plan an extra kwarg for |
Basically, all I need is to add 2 mandatory parameters to Except, if they do it right, they should have this signature at the moment:
So in theory, I could add the 2 parameters I want. However, since Sopel's own subclasses don't follow this interface, I'm not sure what other people have done. Did they follow the initial interface? Did they follow what Sopel does? That's what I call "wreak havoc" on that code: making sure the code gets its shit together. |
664c6f5
to
ca43ae8
Compare
Oh, here is the main issue I have right now with what Sopel does:
So here, I've to use my new |
@dgw any news on that one? |
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.
Even after switching my diff view from Unified to Split, I'm still only about 90% sure I understand all the changes. But there's a hefty new test suite to verify behavior, so while you have a chance to address my one actionable nitpick I'll go run the tests on current master
and see if anything that shouldn't be broken, is.
Edit: Only the test_filename_parse*
tests fail on master
, because the signature changed. Good enough for me.
Co-authored-by: dgw <dgw@technobabbl.es>
ca43ae8
to
7c8fd58
Compare
And done. |
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.
I don't know how I keep forgetting about this PR. Let's go, though.
Description
All I wanted was to add a new type of attribute (something like a
FlagAttribute
to simplify how boolean attributes are handled in config). But then, I discovered an interface I really don't like.So instead I wrote some unit-test, refactored some bit. I would like to go further, but I need some approval first.
Also, all these tests are still good and shouldn't go to waste or kept in a forgotten local branch.
Checklist
make qa
(runsmake quality
andmake test
)