mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 12:36:54 +00:00
Add indent-size option
This commit is contained in:
parent
fd71b86509
commit
ac9c66e80b
4 changed files with 35 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ EXCLUDE = (
|
|||
IGNORE = ("E121", "E123", "E126", "E226", "E24", "E704", "W503", "W504")
|
||||
SELECT = ("E", "F", "W", "C90")
|
||||
MAX_LINE_LENGTH = 79
|
||||
INDENT_SIZE = 4
|
||||
|
||||
TRUTHY_VALUES = {"true", "1", "t"}
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ def register_default_options(option_manager):
|
|||
- ``--per-file-ignores``
|
||||
- ``--max-line-length``
|
||||
- ``--max-doc-length``
|
||||
- ``--indent-size``
|
||||
- ``--select``
|
||||
- ``--disable-noqa``
|
||||
- ``--show-source``
|
||||
|
|
@ -254,6 +255,14 @@ def register_default_options(option_manager):
|
|||
help="Maximum allowed doc line length for the entirety of this run. "
|
||||
"(Default: %(default)s)",
|
||||
)
|
||||
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",
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class FileProcessor(object):
|
|||
self.indent_char = None # type: Optional[str]
|
||||
#: 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue