I like to think that I’m pretty laid back when it comes to dealing with other people’s coding practices. I really don’t care where you put your braces (as long as it’s consistant) and you can indent things as far as you want.
There are, however, two non-negotiable and invarient rules of code formatting. If I ever have to edit code that breaks these then I get very unhappy. Here are the rules:
- There are no tab characters in the code (your editor should convert all indents to spaces)
- Lines of code should be no longer than 80 characters (but you should really aim to keep it to 72 or less)
The increasing use of “modern” IDEs (and I’m looking at you, Eclipse) seem to encourage people to break these rules. And that makes me sad.
Update: Bah! It seems that just about everyone where I’m currently working likes the idea of tabs in source code. Philistines!
Here here. ‘set expandtab’ is one of the first things in my .vimrc :-)
Heh, I break both of these. Although my rule for tabs is strict: only for indentation, only at the start of line. Lining up things like assignments vertically is always done with spaces.And when I need to indent so far that I can’t reasonably keep lines under 80 cols without unnatural contortions, I break that rule too. Though I’ll try to keep the indentation in check. In lines without large indentation level it is almost always possible to keep them under 80 cols without any gnashing of teeth.I have toyed with the idea of :set expandtab and leaving tabs behind, though…
Just run python\Tools\Scripts\untabify.py over everything. That’ll learn them.Wait – you *are* using Python, aren’t you?
Using python? Of course not. But there’s always perltidy.
Perl, tidy? *That’s* an oxymoron if ever I’ve heard one. ;-)