File tree 3 files changed +14
-1
lines changed 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ Config file
57
57
Settings override mypy's built-in defaults and command line flags
58
58
can override settings.
59
59
60
+ Specifying ``--config-file= `` (with no filename) will ignore *all *
61
+ config files.
62
+
60
63
See :ref: `config-file ` for the syntax of configuration files.
61
64
62
65
``--warn-unused-configs ``
Original file line number Diff line number Diff line change @@ -700,7 +700,9 @@ def add_invertible_flag(flag: str,
700
700
dummy = argparse .Namespace ()
701
701
parser .parse_args (args , dummy )
702
702
config_file = dummy .config_file
703
- if config_file is not None and not os .path .exists (config_file ):
703
+ # Don't explicitly test if "config_file is not None" for this check.
704
+ # This lets `--config-file=` (an empty string) be used to disable all config files.
705
+ if config_file and not os .path .exists (config_file ):
704
706
parser .error ("Cannot find config file '%s'" % config_file )
705
707
706
708
# Parse config file first, so command line can override.
Original file line number Diff line number Diff line change @@ -156,6 +156,14 @@ def f():
156
156
except ZeroDivisionError, err:
157
157
print err
158
158
159
+ [case testNoConfigFile]
160
+ # cmd: mypy main.py --config-file=
161
+ [file mypy.ini]
162
+ [[mypy]
163
+ warn_unused_ignores = True
164
+ [file main.py]
165
+ # type: ignore
166
+
159
167
[case testPerFileConfigSection]
160
168
# cmd: mypy x.py y.py z.py
161
169
[file mypy.ini]
You can’t perform that action at this time.
0 commit comments