Skip to Content.
Sympa Menu

devel - [sympa-developpers] coding style

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Guillaume Rousse <address@concealed>
  • To: address@concealed
  • Subject: [sympa-developpers] coding style
  • Date: Thu, 03 Oct 2013 16:16:27 +0200

Le 02/10/2013 12:11, David Verdin a écrit :
Code formatting

* Let's indent with spaces. 4 spaces width.
* We will not use perltidy in a post-commit hook. it could mess up
carefully hand-crafted code layout.
* We should however run perltydy once before continuing bug fixing, so
that, if some of the layout is messed up, it is at least at a time
when we have to read the code a lot and potentially fix some abusive
line feeds.
I have no objection.
Great!

* do everybody agrees with the following settings?

-bar # Opening brace always on right (* no)
-bbt=1 # Medium block brace tightness
-bt=1 # Medium brace tightness (* 1)
-ce # Cuddled else (* no)
-cti=0 # No extra indentation for closing brackets
-et=4 # Entab leading 4 whitespace (* none)
-i=4 # Indent level is 4 cols
-ci=4 # Continuation indent is 8 cols
-l=78 # Max line witdh is 78 cols
-nolq # Don't outdent long quoted strings
-nsbl # No opening sub brace on new line (* -sbl)
-nsfs # No space before semicolons
-pt=1 # Medium parenthesis tightness (* 1)
-sbt=1 # Medium square bracket tightness (* 1)
-se # Errors to STDERR
#-st # Output to STDOUT
-vt=2 # Maximal vertical tightness
-wba="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||=
.= %= ^= x= || && . ? : and or xor"
# Break after all operators (* not contains "||" and tokens appear after it)
Difference from PBP are:

-ce : Cuddled else (PBP : -nce)

-et=4 : Entab leading 4 whitespace (PBP : none)

-nsbl : No opening sub brace on new line (PBP : -sbl)

-wba : Add following operators
|| && . ? : and or xor


In above, "-et=4" seems to be inconsistent with your proposal.
OK, Let's remove it.

Addition to -wba (by me) sometimes generates a bit misterious
results.
OK, let's remove it.
I'm OK with general coding conventions given here, a bit less with perltidy result with the suggested settings

my $self = {
base => $params{base}
};

turns into

my $self = { base => $params{base} };

Which is an unwanted change.

And I don't understand why

($robot)
stays
($robot)

while

($listname and length $listname)
turns into
( $listname and length $listname )

I prefer the first version personaly, but I'm rather concerned by the lack of consistency.

Please fix those issues before running perltidy.

Alternatively, as perltidy usage will ruin my efforts to carefully indent SQL queries, meaning I'll have to post-process the results anyway, I'm eventually volonteer to fix indentation manually as I've done sofar, in less intrusive manner.
--
Guillaume Rousse
INRIA, Direction des systèmes d'information
Domaine de Voluceau
Rocquencourt - BP 105
78153 Le Chesnay
Tel: 01 39 63 58 31

Attachment: smime.p7s
Description: Signature cryptographique S/MIME




Archive powered by MHonArc 2.6.19+.

Top of Page