Blank line between @param and @return

catch - August 17, 2009 - 00:37
Project:Coder
Version:7.x-1.x-dev
Component:Review/Rules
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:coding standards, DX (Developer Experience), Novice
Description

<?php
/**
* Load node objects from the database.
*
* This function should be used whenever you need to load more than one node
* from the database. Nodes are loaded into memory and will not require
* database access if loaded again during the same page request.
*
* @param $nids
*   An array of node IDs.
* @param $conditions
*   An array of conditions on the {node} table in the form 'field' => $value.
* @param $reset
*   Whether to reset the internal node_load cache.
*
* @return
*   An array of node objects indexed by nid.
*/
?>

<?php
/**
* Generate an array which displays a node detail page.
*
* @param $node
*   A node object.
* @param $message
*   A flag which sets a page title relevant to the revision being viewed.
* @return
*   A $page element suitable for use by drupal_page_render().
*/
?>

We have both in core, someone told me to remove the preceding line break in one of my patches, and I assumed it was standard in core so have been passing that around, but clearly we're inconsistent. Would be good to settle one way or the other.

#1

catch - August 17, 2009 - 00:38
Title:Decide on a standard for line breaks before the @return parameter» Decide on a standard for line breaks before @return, after @param

#2

sun - August 17, 2009 - 00:42

An additional blank line between all @param and @return directives helps in readability, especially when quickly scanning code or a patch.

I don't know who advocated the other way, but it doesn't make sense to me.

#3

merlinofchaos - August 17, 2009 - 00:44

I prefer the blank line, and I actually thought that was the standard and was surprised when I was correct.

#4

sun - August 20, 2009 - 21:34
Status:active» reviewed & tested by the community

I think we have an agreement.

#5

webchick - August 21, 2009 - 17:06
Title:Decide on a standard for line breaks before @return, after @param» Document the on a standard for line breaks before @return, after @param
Project:Drupal» Documentation
Version:7.x-dev» <none>
Component:base system» Correction/Clarification
Status:reviewed & tested by the community» active

Looks good to me. Uh. I think this is appropriate?

#6

jhodgdon - August 24, 2009 - 14:42
Status:active» needs work

Ummm.

I think not having a separate blank line has been the standard for a long time. See:

http://drupal.org/node/1354

That is where it should be updated, if everyone has agreed it should be changing. Has "everyone" actually agreed?

#7

sun - October 7, 2009 - 12:48
Project:Documentation» Drupal
Version:<none>» 7.x-dev
Component:Correction/Clarification» documentation
Status:needs work» needs review

"Documentation" project?! No wonder I didn't find this issue anymore. Searched countless of times for it. :-/

For now, let's put it back to Drupal. When there is an agreement (and ideally, core has been patched accordingly), it should move to Coder.

That said, I think we have an agreement already.

#8

jhodgdon - October 7, 2009 - 15:15
Title:Document the on a standard for line breaks before @return, after @param» Document the standard for line breaks before @return, after @param

#9

effulgentsia - October 7, 2009 - 19:52

#10

jhodgdon - October 8, 2009 - 14:03

So the standard is updated. Should we mark this issue fixed, or do you want the entire core code base to be patched before it is marked fixed?

#11

sun - October 8, 2009 - 14:18
Status:needs review» needs work
Issue tags:+Novice

Yeah, we should definitely fix core. A nice little task. However, we should wait until after API freeze, since a patch like that would break every other in the queue ;)

#12

jhodgdon - October 8, 2009 - 14:35

When is API freeze? I thought the code freeze as of Sept 1 was the API freeze, aside from exceptions blessed by webdries?

#13

effulgentsia - October 8, 2009 - 16:23

October 15: http://drupal.org/node/578446. Between Sept freeze and the Oct freeze, new features need to be blessed by webdries, but API changes to implement existing features cleaner is still open.

#14

jhodgdon - October 8, 2009 - 18:49
Status:needs work» fixed

There are more standards than this one that are violated by various functions in Drupal 7. A few months back, I tried to get some patches in to fix things, file by file, but someone insulted me as being too picky (which I didn't appreciate at ALL), and I gave up trying to do wholesale patches that brought large sections of doc into compliance with the standards we've agreed upon.

So I think that we should just go ahead and mark this issue (of figuring out what the standards should be and documenting them, which has been done) as Fixed, and then the doc can slowly brought into compliance with the standards as time goes on.

#15

sun - October 8, 2009 - 21:03
Title:Document the standard for line breaks before @return, after @param» Blank line between @param and @return
Project:Drupal» Coder
Version:7.x-dev» 7.x-1.x-dev
Component:documentation» Review/Rules
Priority:minor» normal
Status:fixed» active

Next home for this issue is Coder module to ensure that this rule is adhered to.

 
 

Drupal is a registered trademark of Dries Buytaert.