Use this rule to control the indentation.
2 or 4,
representing the number of spaces in an indentation level) or to consistent to allow any number,
as long as it remains the same within the file.- as part of the indentation). Possible values: true,
false, whatever and consistent. consistent
requires either all block sequences to be indented, or none to be. {@code whatever} means
either indenting or not indenting individual block sequences is OK.true to enable, false to disable.Examples
With spaces = 1
the following code snippet would PASS:
history:
- name: Unix
date: 1969
- name: Linux
date: 1991
nest:
recurse:
- haystack:
needle
With spaces = 4
the following code snippet would PASS:
history:
- name: Unix
date: 1969
- name: Linux
date: 1991
nest:
recurse:
- haystack:
needle
the following code snippet would FAIL:
history:
- name: Unix
date: 1969
- name: Linux
date: 1991
nest:
recurse:
- haystack:
needle
With spaces = consistent
the following code snippet would PASS:
history:
- name: Unix
date: 1969
- name: Linux
date: 1991
nest:
recurse:
- haystack:
needle
the following code snippet would FAIL:
some:
Russian:
dolls
With spaces = 2 and indent-sequences = false
the following code snippet would PASS:
list:
- flying
- spaghetti
- monster
the following code snippet would FAIL:
list:
- flying
- spaghetti
- monster
With spaces = 2 and indent-sequences = whatever
the following code snippet would PASS:
list:
- flying:
- spaghetti
- monster
- not flying:
- spaghetti
- sauce
With spaces = 2 and indent-sequences = consistent
the following code snippet would PASS:
- flying:
- spaghetti
- monster
- not flying:
- spaghetti
- sauce
the following code snippet would FAIL:
- flying:
- spaghetti
- monster
- not flying:
- spaghetti
- sauce
With spaces = 4 and check-multi-line-strings = true
the following code snippet would PASS:
Blaise Pascal:
Je vous écris une longue lettre parce que
je n'ai pas le temps d'en écrire une courte.
the following code snippet would PASS:
Blaise Pascal: Je vous écris une longue lettre parce que
je n'ai pas le temps d'en écrire une courte.
the following code snippet would FAIL:
Blaise Pascal: Je vous écris une longue lettre parce que
je n'ai pas le temps d'en écrire une courte.
the following code snippet would FAIL:
C code:
void main() {
printf("foo");
}
the following code snippet would PASS:
C code:
void main() {
printf("bar");
}