[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code formatting discussion/proposal

Hi Leho,

On Sat, Jul 11, 2015 at 12:28 PM, Leho Kraav <..hidden..> wrote:
On 06.07.2015 13:04, Erik Huelsmann wrote:
> Hi all,
> I'm going through our code quite randomly at the moment while
> investigating the multi-currency changes.
> What stands out at me is that we have:
>   * different indenting methods (tabs vs spaces)
>   * different intenting styles (2,  3, 4+ spaces)
>   * different widths: 80 on most files, but I've seen anything above too
>   * single vs double underscores as separators in tokens
>   * etc
> I'm sorry, but it's starting to disturb me (quite a bit). So, here's my
> proposal:

Without going through all of the replies yet, I'd like to recommend
standing on some giant's shoulders with this and I mean using a standard
that's maintained by a bigger body (this is always going to be in
movement and requires attention) and has a well-maintained
IDE-integration implementation available for fully automated checking
and processing.

Ok. Sounds good. I'm not used to go with that approach, coming from a background where each and every project sets its own formatting rules (for e.g. C).

WordPress-based example:

Hmm. But isn't WordPress just one example of a project that uses PHP5? Aren't there lots of other projects that use different PHP5 code formatting rules (if any)? Maybe you didn't mean to say what I think you did, but like with PHP5, there are loads of Perl projects which use different formatting. I know of some projects that enforce it through 'perltidy'. But even if we go with 'perltidy', there are millions of ways to configure 'perltidy'.

On the SQL front it's even worse, I think, because with Perl, there's Larry who has some (minimal) guidelines on how he would like Perl to be formatted. With SQL, there's no one person providing global direction. What's more: there are hundreds of SQL IDEs.

The reason that I proposed creating Emacs and Vim configuration files is because I think that those are closest to what the people in the project use at the moment. And anybody coding on a Unix variant (or coding on Windows *coming* from a unix variant) is pretty likely to know how to deal with either Emacs or Vim. From what I understand from the code formatting helpers in Emacs and Vim, they have heuristics based code parsers built in which help indenting code. They get it correctly most of the time.

which works on top of more generic PHP tokenizer system

I'm definitely never looking back towards anything weaker.

The Perl style guide is here: http://perldoc.perl.org/perlstyle.html we could adopt it, but I think we're pretty far away from what it says at the moment (nor am I aware to which level e.g. Emacs currently supports formatting according to *that* style...). Is a style guide as the one for Perl what you refer to?



http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
Ledger-smb-devel mailing list