summaryrefslogtreecommitdiff
path: root/src/flake8
diff options
context:
space:
mode:
authorvalentin <valentin@too.gy>2017-01-18 13:42:11 +0100
committerAnthony Sottile <asottile@umich.edu>2021-03-14 11:53:03 -0700
commitac9c66e80bed84e78fbb803e6dd9e33cc4c741ca (patch)
treec526d34301f1f56706d856fdc02063230a188097 /src/flake8
parentfd71b8650988d1ac74fd262ed96d11da1966c412 (diff)
downloadflake8-ac9c66e80bed84e78fbb803e6dd9e33cc4c741ca.tar.gz
Add indent-size option
Diffstat (limited to 'src/flake8')
-rw-r--r--src/flake8/defaults.py1
-rw-r--r--src/flake8/main/options.py9
-rw-r--r--src/flake8/processor.py2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/flake8/defaults.py b/src/flake8/defaults.py
index 1d32bd7..d590857 100644
--- a/src/flake8/defaults.py
+++ b/src/flake8/defaults.py
@@ -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"}
diff --git a/src/flake8/main/options.py b/src/flake8/main/options.py
index a0f066f..0a6ad45 100644
--- a/src/flake8/main/options.py
+++ b/src/flake8/main/options.py
@@ -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",
diff --git a/src/flake8/processor.py b/src/flake8/processor.py
index b675c99..75b8de7 100644
--- a/src/flake8/processor.py
+++ b/src/flake8/processor.py
@@ -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