Add indent-size option

This commit is contained in:
valentin 2017-01-18 13:42:11 +01:00
parent e0fa9077ca
commit d27df24240
3 changed files with 10 additions and 0 deletions

View file

@ -24,6 +24,7 @@ IGNORE = (
)
SELECT = ('E', 'F', 'W', 'C90')
MAX_LINE_LENGTH = 79
INDENT_SIZE = 4
TRUTHY_VALUES = set(['true', '1', 't'])

View file

@ -19,6 +19,7 @@ def register_default_options(option_manager):
- ``--hang-closing``
- ``--ignore``
- ``--max-line-length``
- ``--indent-size``
- ``--select``
- ``--disable-noqa``
- ``--show-source``
@ -115,6 +116,12 @@ def register_default_options(option_manager):
'(Default: %default)',
)
add_option(
'--indent-size', type='int', metavar='n',
default=defaults.INDENT_SIZE, parse_from_config=True,
help='Number of spaces used for indentation (Default: %default)',
)
add_option(
'--select', metavar='errors', default=','.join(defaults.SELECT),
parse_from_config=True, comma_separated_list=True,

View file

@ -76,6 +76,8 @@ class FileProcessor(object):
self.indent_char = None
#: Current level of indentation
self.indent_level = 0
#: Number of spaces used for indentation
self.indent_size = options.indent_size
#: Line number in the file
self.line_number = 0
#: Current logical line