[Geany-devel] On coding style

Lex Trotman elextr at xxxxx
Mon Sep 7 23:54:11 UTC 2009


2009/9/7 Nick Treleaven <nick.treleaven at btinternet.com>:
> On Mon, 7 Sep 2009 08:35:30 +1000
> Lex Trotman <elextr at gmail.com> wrote:
>
>> How much of the changes are manual and how much is done by the
>
> Dunno, Enrico?
>
>> fix_alignment script & is it safe to just run this every time
>> pre-commit?
>
> In the commit message IIRC I mentioned this is 'work in progress', I
> probably need to make some changes before this is reliable for all of
> src/ and plugins/.


Sorry to jump the gun.  I think I said in a previous post I advise my
consulting clients to specify their coding standard by nominating a
formatter and the options to be used.  Other than picking a really
stupid one, it doesn't matter what you actually pick so long as you
always use it.

For those reading this and wondering why so much worry about coding
style, humans are good at recognising patterns and notice divergences.
 When we are coding, debugging and maintaining code, if we are
continually distracted by divergences from pattern due to coding
style, we are less likely to notice the divergences due to real issues
in the code.

So coding style *is* important and should be machine enforced, hence I
think Nicks script is a great idea.

>
>> Several of the things you changed I had thought I had right, so maybe
>> hacking.html needs to be more explicit rather than just "like the rest
>> of the code".
>> Then I could have saved you  some work :-)
>
> Well, we did tell you about a space after if and no space after an
> opening bracket ;-)

I thought I had got most of them :-( but then I-am-not-a-mach-ine,
oops that just slipped out, and I was passing the Turing test until
then ;-)

>
> There is also the issue of a small amount of existing code sometimes
> being formatted wrongly, but hopefully with scripts we can iron out
> these.
>
>> At least the things not addressed by the script should be listed, eg
>> when and if {} is used around single if clauses etc.
>
> It seems we might need to write a clear style guide, although
> personally I think it's pretty easy to copy the existing code style. It
> would be quicker to read though.

Its not always easy to determine whats important from examples of
existing style or to correctly deduce it.  For example I was *sure*
you didn't put spaces around == and != although you did for other
binary operators.  I am not sure why I formed that conviction but
clearly it was wrong.

Cheers
Lex

>
> Regards,
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list