If you couldn't tell, the way I get to know the code of new modules is go through line-by-line and fix a bunch of little inconsistencies with them. ;)
So there are a few kind of odd-ball things in the .module file as well:
- The help hook has HTML entities in it; Drupal supports unicode, so it should just use the proper characters for the curly quotes. But let's just make them straight quotes like throughout the rest of the module, hm? :)
- The help hook also returns $output ."\n";.. nah. Just $ouput is fine.
- The module implements hook_access, but is not a node module. Therefore this hook will never fire. Removed it.
- There were calls to "theme_table" ... this should be "theme('table' ...)" so that themes can override the default output.
- Has a closing ?>. We keep those off so people don't have weird "header already sent" problems saving their module through web-based control panels and such.
- A bunch of minor coding-standards related changes. I gave up half way through... They mostly boiled down to:
- Indentation is all over the map.
- Inline comments should use // and not /* */ .. make commenting out a block of code for debugging purposes easier.
- Inline comment should also be capitalized and end in a period.
Here's the start of a patch, anyway... not sure if I'll be able to finish the rest off.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | sitedoc-coding-standards-150629-1.patch | 23.61 KB | webchick |
Comments
Comment #1
webchickpatch.
Comment #2
nancydruI have made many (maybe most) of the changes. It's funny, I changed all the "theme('table'" code to theme_table because I misread the the code in theme.inc and thought I would be saving a few cycles.
Think I got most of the comments that I felt would be improved your way. Some I left because I feel they are better the way I have them.
Indentation is mostly unchanged because, as the module's maintainer, my concept of readability should be taken over some arbitrary standard that, IMHO, actually ruins readability. When I see core uniformly adopt these standards, then I might reconsider my position on this.
Comment #3
nancydru