Skip to Content.
Sympa Menu

comanage-dev - Re: [comanage-dev] Updated Coding Guidelines

Subject: COmanage Developers List

List archive

Re: [comanage-dev] Updated Coding Guidelines


Chronological Thread 
  • From: Benn Oshrin <>
  • To: comanage-dev <>
  • Subject: Re: [comanage-dev] Updated Coding Guidelines
  • Date: Tue, 20 Dec 2011 20:36:03 -0500

I'm not sure we need a cutoff width, I'd be inclined to just have indentation standards that encourage left-compactness. Sometimes lines need to be longer than 80 char and I don't see a reason to force a line break.

On 12/20/11 8:32 PM, Marie Huynh wrote:
What should the cutoff width be then? The standard 80?

On Tue, Dec 20, 2011 at 4:58 PM, Benn Oshrin
<
<mailto:>>
wrote:

The problem with the first example (not that you can tell in my
quoting of it) is that it tends to quickly shift things over to the
right, which can be a problem is you need to debug code on an device
that doesn't have a screen the size of a car.

I also happen to find the second one easier to read, but that's just
personal preference...


On 12/20/11 7:29 PM, Marie Huynh wrote:

I find the first one easier to read than the second, which is what I
think the current coding style says it should look like:

var $belongsTo = array("Cou", // A CO Org
Person To is
attached to one COU
"CoPerson" => array('className' => 'CoPerson',
'foreignKey' => 'co_person_id'
), // A CO Org
Person To is attached to one CO Person


var $belongsTo = array(
"Cou", // A CO Org Person To is attached to one COU
"CoPerson" => array(
'className' => 'CoPerson',
'foreignKey' => 'co_person_id'
), // A CO Org Person To is attached to one CO Person


Thoughts?

On Tue, Dec 20, 2011 at 2:54 PM, Marie Huynh

<

<mailto:>

<mailto:

<mailto:>>>
wrote:
>
> See diff. I didn't think the arrays with one item were hard
to read
so I left those.
>
>
> On Mon, Dec 19, 2011 at 10:31 PM, Marie Huynh

<

<mailto:>

<mailto:

<mailto:>>>
wrote:
>>
>> + $this->redirect(array('action' => 'add'));
>>
>> Does this array need to be defined before being passed?
>>
>> - echo '<a class="deletebutton"
title="' .
_txt('op.delete') . '" onclick="javascript:js___confirm_delete(\'' .
_jtxt(Sanitize::html($id['__identifier'])) . '\', \'' .
$html->url(array('controller' => 'identifiers', 'action' =>
'delete',
$id['id'], 'co' => $cur_co['Co']['id'])) . '\')";>' .
_txt('op.delete')
. '</a>' . "\n";
>> - echo $html->link(_txt('op.edit'),
>> + print '<a class="deletebutton"
title="' .
_txt('op.delete') . '" onclick="javascript:js___confirm_delete(\'' .
_jtxt(Sanitize::html($id['__identifier'])) . '\', \'' .
$html->url(array('controller' => 'identifiers', 'action' =>
'delete',
$id['id'], 'co' => $cur_co['Co']['id'])) . '\')";>' .
_txt('op.delete')
. '</a>' . "\n";
>> + print $html->link(_txt('op.edit'),
>>
>> I used :%s/echo/print/gc. Do I need to fix the rest of the
file too
even if this ticket doesn't touch those parts?
>>
>> On Sat, Dec 17, 2011 at 5:51 PM, Benn Oshrin

<

<mailto:>

<mailto:

<mailto:>>>
wrote:
>>>
>>> On 12/16/11 3:17 PM, Marie Huynh wrote:
>>>>
>>>> If we're going back to fix old code anyway, why not do it
all at the
>>>> same time and run it through one of these formatters
before tagging?
>>>>
>>>>

http://coding.__smashingmagazine.com/2007/07/__12/time-savers-code-__beautifier-and-formatter/

<http://coding.smashingmagazine.com/2007/07/12/time-savers-code-beautifier-and-formatter/>
>>>>
>>>> Sure, they won't fix everything, but it's better than
doing it all
by hand.
>>>
>>>
>>> Here are my thoughts on this...
>>>
>>> I don't have a moral objection to using one of these, and
if anyone
wants to, by all means go ahead.
>>>
>>> I think all code commits (not just tagged releases) should be
properly formatted. It's too easy to introduce bugs after testing
otherwise, especially if we're relying on automated formatters. It's
best to test stuff while the test cases are still fresh in your
mind.
>>>
>>> Furthermore, I suspect if we defer reformatting, it'll never
happen, and the codebase will become even more disjoint than it
already is.
>>>
>>> On top of that, if there are problems with the new
guidelines, we
should discover them sooner rather than later.
>>>
>>> I'm sensitive to concerns about falling behind schedule,
but there
are only about 20 rules encoded in the new guidelines. It should
take
maybe an hour to do the reformatting, and going forward the
incremental
cost should be trivial.
>>>
>>> -Benn-
>>
>>
>







Archive powered by MHonArc 2.6.16.

Top of Page