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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stella’s picture

I'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()?

Xano’s picture

Status: Needs review » Needs work

It 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?

Xano’s picture

Bump.

While writing those patches I thought it would be best to allow modules to set #cache in hook_reviews() directly. What do you think?

stella’s picture

No, 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.

douggreen’s picture

Status: Needs work » Closed (won't fix)

This patch seems to have stalled. Is there still any interest in the alter suggestion from stella?

Xano’s picture

Assigned: Xano » Unassigned