Hi all developers!

Gert did quite some efforts preparing the grounds for an uncrustify [1]
configuration in our CodeStyle wiki page.  I have also done several
tests with both astyle [2] and uncrustify, to see what would be most
simple for us to use and cover our needs.  I ended up with throwing out
astyle in the end, as it seems to do some weird stuff in some nested
if() situations (it didn't add the expected braces at the expected
places).  Uncrustify on the other hand is very flexible with an option
set which makes the numerous OpenVPN options look like a short list.

Next thing was that I spent time tweaking Gert's proposal and reviewing
it together with Steffan and Arne.  And I think we have a reasonable
configuration now.  And we're not even using that many options :)

------------------------------------------------------
indent_columns=4
indent_with_tabs=0
align_with_tabs=false
cmt_convert_tab_to_spaces=true
indent_braces=false
indent_else_if=false
indent_switch_case=4
indent_label=1
pp_space=remove
sp_before_sparen=add
sp_inside_sparen=remove
sp_cond_colon=add
sp_cond_question=add
sp_bool=add
sp_else_brace=add
sp_brace_else=add
pos_arith=Lead
nl_if_brace=add
nl_brace_else=remove
nl_elseif_brace=remove
nl_else_brace=remove
nl_else_if=remove
nl_func_type_name=add
nl_before_case=true
nl_assign_leave_one_liners=true
nl_enum_leave_one_liners=true
nl_brace_fparen=add
nl_max=4
nl_after_func_proto=2
code_width=80
ls_code_width=false
mod_full_brace_if=add
mod_full_brace_if_chain=false
mod_add_long_ifdef_endif_comment=20
mod_add_long_ifdef_else_comment=5
mod_remove_extra_semicolon=true
cmt_c_nl_end=true
cmt_star_cont=true
------------------------------------------------------

This is fairly inline with the initial agreement from the 2014 Munich
hackathon [3] and the summarized CodeStyle wiki page [4].

This proposal allows for the "open bracing" question, which allows
'} else {'  and '} else if () {'.


So now the bike shed debate opens up ... Is this something we can get
consensus around?

And a few examples of reformatted files:

 tun.c: <https://paste.fedoraproject.org/501999/81229253/>
 ssl.c: <https://paste.fedoraproject.org/502010/22971814/>


[1] <http://uncrustify.sourceforge.net/>
[2] <http://astyle.sourceforge.net/>
[3] <http://community.openvpn.net/openvpn/wiki/MunichHackathon2014>
[4] <https://community.openvpn.net/openvpn/wiki/CodeStyle>


-- 
kind regards,

David Sommerseth
OpenVPN Technologies, Inc


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to