-
-
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
plugins: handle URL callbacks in new rule system #1904
Conversation
Well this is exciting.
I hope this means only the URL-related bits 😂
I'm not sure about this. Maybe I'll understand why when I actually have time to review the patch, but at first glance it sounds arbitrary. AFAIK it exists to make handing both URLs and commands/rules with the same callable. |
This pull request introduces 1 alert when merging cea2bfc into a5a6e2d - view on LGTM.com new alerts:
|
Yes! Only for the URL callback related keys in bot.memory.
I'd be on board with that, but the Lines 205 to 215 in 65fb76a
That something that I can probably change, and I'd suggest that in another PR. This one is already quite big. And I reassert that I'm so glad that you took the time to raise this, because I didn't think about it, and it's a great opportunity to improve even further. Thank you. ❤️ |
cea2bfc
to
39a378d
Compare
This pull request introduces 1 alert when merging 39a378d into a5a6e2d - view on LGTM.com new alerts:
|
39a378d
to
890674f
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 like where this is headed. Blanket comments:
- Use of capital C in "URL Callback" vs. "URL callback" is inconsistent both across this patch and across the existing code/docs. Could be worth a global, case-sensitive find-and-replace if you get bored late one night and don't want to do any "real" coding. 😁
- "an URL" vs. "a URL" (we spoke about this one on IRC a bit)
@dgw I'll have a look at the Travis error on the |
@Exirel The |
Welp, turns out right now is right before bed. I'm not sure what to do now, since 19:19 is too early to sleep… 😝 |
8d38424
to
0d6f8ec
Compare
It's ready for the review! I'll edit the description. @dgw I noted a bug that I should fix directly for the default branch, and not in this PR. But I've added it here so I can actually test live with my working dir. |
See also #1906 for the hotfix. |
0d6f8ec
to
dd6328e
Compare
Commenting before review, lest I forget: Don't we space-separate names in the commit message? You have e.g. Hopefully I'll finish a review of this tonight or tomorrow. |
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.
All of this (which is mostly more docstring stuff), plus the nitpick about commit message formatting I commented earlier.
7e4164e
to
d65435b
Compare
@dgw some new stuffs in here! I request a new review! ❤️ |
This pull request introduces 1 alert when merging d65435b into a33caf1 - view on LGTM.com new alerts:
|
Oh yes, that's because I have to import manually the right function depending on the Python's version: in 2.7, the function to inspect a function's parameters is not the same as the one in 3.3+. So this alarm can be ignored, and will be removed automatically when we drop support for Python 2.7. |
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.
❤️ making match
optional for URL callables, best change ever
@dgw ready to squash whenever you want. |
This pull request introduces 1 alert when merging 3c35180 into ee3fcb2 - view on LGTM.com new alerts:
|
@Exirel I looked at "changes since [my] last review" and I'm happy. Squash away, at least locally, so you can move on to that documentation thing you wanted to tackle (tomorrow? IIRC) |
Co-authored-by: dgw <dgw@technobabbl.es>
3c35180
to
db5bf69
Compare
This pull request introduces 1 alert when merging db5bf69 into ee3fcb2 - view on LGTM.com new alerts:
|
OK on this one, I think we are good. I could potentially work on deprecating the memory/url_callback thing, but that can be left to another PR. |
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.
GitHub still says I've viewed all the changes, so I'll take that as confirmation that I don't need to look again now that the fixup commits are squashed. If any uncaught issues pop up, we're far enough from release that I think we'll catch them.
Description
TL;DR:
bot.memory['url_callbacks']
is deprecated (but not marked as such in this PR)match
parameter is obsolete and shouldn't be used anymore - it still work, but not needed anymoreplugin.url_lazy(loader)
that takes a loader and it builds regexes when it needs toThe idea is to have
url
andurl_lazy
to be part of the rule system: the bot ask its rule manager to register them, based on what they have. As a result, URL callback are like every other rules: they can take advantage of all the decorators insopel.plugin
and its feature such as output prefix and rate limiting.In effect, that makes the
bot.memory['url_callbacks']
deprecated. This PR takes care of being backward compatible, and we'll have to decide when we want to remove it. (I think Sopel 9 is a good target?)However, I had to take a difficult decision for the
trigger
and thematch
parameters: now, thetrigger
object is based on thematch
object, making thematch
parameter obsolete. (as they contain the same information) I don't think that's a problem, as thetrigger
object still contains the full IRC line, and it couldn't be used reliably anyway because it would know about the first URL in the IRC message anyway.Note that doesn't break callable that are supposed to be both a rule/command and a URL callback, because it's not possible: the loader doesn't allow it, and the rule/command status of the callable takes precedence.
Checklist
make qa
(runsmake quality
andmake test
)Related issues/PRs
@url
callables ignore some other plugin decorators #1816