Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A couple of commits on March 7th introduced the #cache property in $coder_args. This allowed review methods to prevent Coder from caching review results. The problem is that $coder_args itself was never editable by review methods, because it wasn't passed on as a reference to do_coder_reviews(). The attached patches fixes this problem for versions 6.x-2.x and 7.x-1.x.
Comment | File | Size | Author |
---|---|---|---|
editable_coder_args_71_00.patch | 719 bytes | Xano | |
editable_coder_args_62_00.patch | 632 bytes | Xano |
Comments
Comment #1
stella CreditAttribution: stella commentedI'm not sure that patch would solve that particular problem though as the individual methods (e.g. do_coder_review_regex()) can't modify that array and it isn't modified anywhere in the function. I'd also be a bit concerned about one review method modifying the settings for the following reviews. What about just implementing
hook_coder_review_args_alter()
?Comment #2
XanoIt definitely works, but I hadn't noticed that one review method gets the same arguments as are passed on to the other methods. You explicitly added the #cache property for this in Chicago. I must have misunderstood its use then.
While writing those patches I thought it would be best to allow modules to set #cache in hook_reviews() directly. What do you think?
Comment #3
XanoBump.
Comment #4
stella CreditAttribution: stella commentedNo, not in hook_reviews(). That's not how I envisaged it and it would require a larger architecture change to allow them to do that. The caching get and set happens at a much higher level and can't be currently set on a per rule basis. I'm not sure that's even such a good idea as we'd have to cache on a per-module per-file per-review per-rule basis which would require a lot of cache get/set checks and would also kinda negate the benefit of caching.
I still think hook_coder_review_args_alter() is the best place.
Comment #5
douggreen CreditAttribution: douggreen commentedThis patch seems to have stalled. Is there still any interest in the alter suggestion from stella?
Comment #6
Xano