Questions tagged [indentation]
The indentation tag has no summary.
27 questions
4 votes
3 answers
6k views
Why do we still have programming languages that rely on indentation / white space? [duplicate]
A long time ago when starting learning programming I remember a teacher saying that compiler do not care about whitespace and they are useful to make code readable for human beings. It made perfect ...
3 votes
1 answer
4k views
Why tabs are evil in ES6? [closed]
As I have recently started using ES6 in production, I was going through an ES6 style guide (having more than 350 stars on GitHub). This guide mentions at least three times that "Tabs are evil. Don't ...
0 votes
3 answers
6k views
"with open() as" and indentation
I could not find any official recommended indentation for the following idiom (straight from http://effbot.org/zone/python-with-statement.htm): with open(path) as f: data = f.read() do ...
4 votes
5 answers
827 views
C++ auto-indentation (auto-style) in a multi IDE team
Is there a convenient and sustainable way to handle code indentation and style in a team in which multiple IDE's (Emacs, XCode, VS) are used by different programmers? We are using git, so, should we ...
2 votes
1 answer
580 views
Why does nobody use indentation in css? [closed]
I find css quite hard to read sometimes. Indents, depending on the dom structure, would greatly increase readability. Consider the following example: #page { text-align:center; font-weight:...
8 votes
3 answers
233 views
Indentation in a multi-language file [closed]
In files that contain multiple languages (ie. template files), are there any best practises regarding indentation? I mostly use this: <div> IF FOO <div> <p>...
22 votes
8 answers
5k views
At what point is it taboo to have loops within loops?
Just curious. The most I have ever had was a for loop within a for loop, because after reading this from Linus Torvalds: Tabs are 8 characters, and thus indentations are also 8 characters. There ...
2 votes
1 answer
310 views
What is the name/origin for this C code indentation style?
Look at the formatting of the variable declarations. I haven't encountered this indentation style in the past, but lately I stumbled upon two different code examples which use this style. Where does ...
30 votes
3 answers
1k views
Origins of code indentation
I am interested in finding out who introduced code indentation, as well as when and where it was introduced. It seems so critical to code comprehension, but it was not universal. Most Fortran and ...
16 votes
5 answers
9k views
Keep indentation level low [duplicate]
I hear a lot that you should not write functions larger than one screen size, that you should extract things into functions if you call things very often and all these coding guidelines. One of them ...
9 votes
4 answers
2k views
How strict should you be about indentation/white space? [closed]
Our development process is as follows code the task -> someone else QAs code and documentation -> task is merged into trunk. Recently a colleague is refusing to pass the code QA due to issues with ...
15 votes
7 answers
7k views
Should I write compact code or code with lots of spaces? [duplicate]
I have two friends that have completely different schools of thought on how to lay out their code. The first says that code should be well-indented and use lots of spaces and to name variables ...
21 votes
5 answers
10k views
What are the downsides of mixing tabs and spaces? [duplicate]
The advantage of using tabs for indentation is that people can configure their editor to use the tab width they are comfortable with. The only argument against this seems to be that people don't want ...
1 vote
1 answer
2k views
Heredoc or an external template file in my bash script - how it affects readibility/maintanance?
I realise that this question may be down to personal preference but I'm pretty new to Bash / shell scripting so thought it'd be worth some research to see if there's some sort of standard/best ...
25 votes
6 answers
5k views
Reformatting and version control
Code formatting matters. Even indentation matters. And consistency is more important than minor improvements. But projects usually don't have a clear, complete, verifiable and enforced style guide ...