standardize indentation at 2 spaces

Update the linter rules to require 2 spaces. Update our dumper to emit
2 spaces.

Change-Id: Idef3574021845bccfc92c75425bc0f40b32b0026
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-07-28 16:35:24 -04:00
parent cd690c2e35
commit 4891bea8c5
2 changed files with 11 additions and 0 deletions

View File

@ -78,6 +78,13 @@ class PrettySafeDumper(yaml.dumper.SafeDumper):
else:
return super(PrettySafeDumper, self).represent_undefined(data)
# Override this method to always indent. Otherwise when a list is
# emitted, the items nested under it are not and we have inconsistent
# formatting.
# https://stackoverflow.com/questions/25108581/python-yaml-dump-bad-indentation
def increase_indent(self, flow=False, indentless=False):
return super(PrettySafeDumper, self).increase_indent(flow, False)
# NOTE(harlowja): at some point this may not be needed...
# See: http://pyyaml.org/ticket/29

View File

@ -7,3 +7,7 @@ rules:
max: 200
level: warning
allow-non-breakable-words: true
indentation:
spaces: 2