This is a highly subjective topic, but you can take some cues from 1000 years of typographic history.
Research has been done on whitespace in typography, but less so on code. But you can assume many of the basic findings in legibility and comprehension apply to code as well. This study, Reading Online Text: A Comparison of Four White Space Layouts, shows that proper vertical spacing with large margins increases comprehension, but slows speed. For code, it could be safely assumed that comprehension is more important than speed. So you could objectively say, more space is better for code. But when you get into specifics of tab size and brace positioning it gets highly subjective. In code, margins are indentation, paragraphs are functions and code blocks, and periods are line breaks, braces, parens, etc.
When you start asking programmers what format of whitespace is more readable, though, answers are all across the spectrum. The best you can do is look for generalities that seem to be universal.
Such as:
- put whitespace before and after blocks of code, like functions and classes
- put whitespace before and after logical groupings of code within blocks
- long blocks of code with no vertical whitespace are more difficult to read
- long blocks of code with no indentation are more difficult to read
- long lines of code with no horizontal whitespace are more difficult to read
I think most programmers will agree with those statements.
Example (pseudo-code):
thisismore(difficult<toread)because,itsall-smushed{together}
this-is-less ( difficult < to-read ) because, it's-not-all - smushed { together }
To touch on your last four points:
Variable Naming:
This is as subjective as whitespace, but again you can look to typography for clues. Typography has serif fonts, capital letters starting sentences, periods ending sentences, and a space after periods. All of these things are to allow your eyes to transition between words and sentences. With variables, clarity is important, so they are often multi-word names. For your eyes to easily read them, something needs to alert them that a new word has started.
This is harder to read (for most people):
Than these:
- my-long-variable-name
- myLongVariableName
- my_long_variable_name
- MY_LONG_VARIABLE_NAME
Now which of those is best or most readable is subjective, and may always be. But what's important is that something separate the words.
Horizontal Indentation:
Code that is not indented at all is more difficult to read than code that is. Too small an indentation and your eyes have trouble distinguishing blocks. Too large and you waste space and add no more clarity. Somewhere between four and eight seems to be right based on the eleventy-bazillion lines of code written using those sizes.
Horizontal Alignment:
Again, typography to the rescue. Lists of things aligned in columns are easier to read. For list item data that are longer than one or two words or numbers (like sentences), bulleted lists are used. For textual data, left-aligned columns are used. For numeric data, right-aligned columns are used. You can apply these principals to code. Bulleted lists can be seen as code-blocks, all aligned to the same indentation level. Variables are textual data, so left alignment would be easiest to read. If the values you were assigning were numeric, right alignment would be best.
This is more difficult to read (for most people):
var oneVariable = 10023, a = 370,
p = 4,
answerToLife = 42,
openThePodBayDoorHal = false;
Than this:
var oneVariable = 10023,
a = 370,
p = 4,
answerToLife = 42,
openThePodBayDoorHal = false;
And this is probably easiest:
var oneVariable = 10023,
a = 370,
p = 4,
answerToLife = 42,
openThePodBayDoorHal = false;
Vertical Spacing:
Imagine this whole post with no spacing between paragraphs. Almost everyone can agree that would be harder to read and understand. Now, many could argue that more space between sections would be even better. In typography, sections are delineated with headers that have a larger font size and more vertical space (like you see in HTML with H1, etc). In code, we have one font size, so we have to work with whitespace and whatever bracing concept the language uses (if any). Like horizontal spacing, more is better than less. Specifics about exactly what that means is subjective, but with most languages, programmers settle into a convention for that language that most people use. If you are defining your own language (or coding standard), then you can set the convention.
The most important thing, not matter what the standard is, is that it is used consistently throughout all your code. This is way more important than the specifics of the standard. Consistently formatted code is much easier no matter what the standard.
Search for typography readability studies for more information.