mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-08 05:54:17 +00:00
Add indent-size option
This commit is contained in:
parent
e0fa9077ca
commit
d27df24240
3 changed files with 10 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ IGNORE = (
|
||||||
)
|
)
|
||||||
SELECT = ('E', 'F', 'W', 'C90')
|
SELECT = ('E', 'F', 'W', 'C90')
|
||||||
MAX_LINE_LENGTH = 79
|
MAX_LINE_LENGTH = 79
|
||||||
|
INDENT_SIZE = 4
|
||||||
|
|
||||||
TRUTHY_VALUES = set(['true', '1', 't'])
|
TRUTHY_VALUES = set(['true', '1', 't'])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ def register_default_options(option_manager):
|
||||||
- ``--hang-closing``
|
- ``--hang-closing``
|
||||||
- ``--ignore``
|
- ``--ignore``
|
||||||
- ``--max-line-length``
|
- ``--max-line-length``
|
||||||
|
- ``--indent-size``
|
||||||
- ``--select``
|
- ``--select``
|
||||||
- ``--disable-noqa``
|
- ``--disable-noqa``
|
||||||
- ``--show-source``
|
- ``--show-source``
|
||||||
|
|
@ -115,6 +116,12 @@ def register_default_options(option_manager):
|
||||||
'(Default: %default)',
|
'(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(
|
add_option(
|
||||||
'--select', metavar='errors', default=','.join(defaults.SELECT),
|
'--select', metavar='errors', default=','.join(defaults.SELECT),
|
||||||
parse_from_config=True, comma_separated_list=True,
|
parse_from_config=True, comma_separated_list=True,
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ class FileProcessor(object):
|
||||||
self.indent_char = None
|
self.indent_char = None
|
||||||
#: Current level of indentation
|
#: Current level of indentation
|
||||||
self.indent_level = 0
|
self.indent_level = 0
|
||||||
|
#: Number of spaces used for indentation
|
||||||
|
self.indent_size = options.indent_size
|
||||||
#: Line number in the file
|
#: Line number in the file
|
||||||
self.line_number = 0
|
self.line_number = 0
|
||||||
#: Current logical line
|
#: Current logical line
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue