-
-
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: Warn if unexpected settings exist #1570
Comments
It could just validate |
Huh, actually that It has nothing to do with the per-channel stuff, and everything to do with the fact that, pre-6.0, the config sections were lawless lands that could contain whatever you might toss in. Sopel 6 brought validation of config attributes and the All of that is by way of saying, cool, whoever implements this can just do the same kind of check. 😁 |
...introduced this control-flow one too that has been hanging around this whole time! 😅 Lines 198 to 200 in a813671
... figured it was something like that, since of course per-channel config didn't exist 😁 I got about 5-6 years back in the revision history before I gave up trying to put it all together. Regardless, I'm glad it stuck around and now can directly apply! |
That's a nice control flow bug. Parentheses are useful, hmm? It's close to the password-censoring logic, too, which (after our adventure yesterday) should probably also censor any option ending in "secret". Off topic, but hey—I know you like making little PRs. 😝 |
It's a serious problem 😬
@Exirel pointed it out in review for #1556 😄 so the fix is in there. Let me know if it should go in a smaller PR for merge sooner...
Okay. But what about settings that don't The other option is to add a boolean attribute to |
probably overkill just for |
Pretty definitely overkill. We should take further discussion of that to a new issue, though, if it needs bikeshedding (and it seems to). |
This feature is a fine candidate for a minor release, and doesn't need to block 7.0. |
@Exirel This would definitely help users out a lot when configuring plugins, e.g. if they mistype a setting name. Yes, we can encourage the use of |
So, I've something in progress for that, but I need #1933 to be merged to prevent possible merge conflict with the test directory. |
When loading the config file, Sopel should warn the user if it finds a setting name that isn't defined in the
StaticSection
for that section. (Obviously, this logic will have to ignore the per-channel config sections added in #1235—or handle those, too, since they also have clearly defined properties.)Such a warning should not prevent starting the bot or halt/block loading the module to whom the setting belongs; it should be purely informational.
This would very much help users avoid typos after manually editing their config files, and aid in debugging issues like the one @HumorBaby and I just spent literally hours on—which turned out to be the result of a misnamed setting in the
.cfg
file Sopel was using. (The fact that the incorrect name made more sense than the correct one is a bug for another repo.)The text was updated successfully, but these errors were encountered: