I'm writing a doc-comment review for coder.

Since coder has no function for context sensitive rules I needed to iterate over all source-lines myself using a callback-type rule. I then check for doc-comments for each function, and if each parameter/return value is properly documented. Works fine until here.

When I have an error to report I currently call "_coder_error". This leaves me with two problems: "_coder_error" expects a rule to report the error, so the message is always the same, despite the fact that the errors were quite different (undocumented function, missing parameter etc.). The other problem is "_coder_error" is (according to drupal coding standards) a private function (trailing underscore) and hence should not be called from the outside. Messing with the results array myself is out of the question due to the whole key-magic in "_coder_error". Why not use "$results[]=" here instead of "$results[$key]=" - I don't understand the need for this magic-key.

What is the best-practice here? Any suggestions?

-Poldy

CommentFileSizeAuthor
#2 coder_docwriters_love.tar_.gz1.35 KBPoldy

Comments

stella’s picture

Check out the Coder Tough Love module : http://drupal.org/project/coder_tough_love

Poldy’s picture

StatusFileSize
new1.35 KB

Thank you, that was exactly what I needed as reference. Maybe you should consider linking to that module as an example.

Anyway, I finished my "Check for doc-comment" review. I would love to see it in coder itself , since I think it will be helpful to others as well.

Attached is the code so far - as an add-on-module for coder, comments welcome.

Poldy

Poldy’s picture

Status: Active » Closed (fixed)