diff options
| author | Eric N. Vander Weele <ericvw@gmail.com> | 2020-01-07 12:39:21 -0500 |
|---|---|---|
| committer | Eric N. Vander Weele <ericvw@gmail.com> | 2020-01-07 12:54:47 -0500 |
| commit | a5c17c1a19bd0478a8e7543d13cce8fdd30488f2 (patch) | |
| tree | d538e15de3f224205a9ccbde7ef90781b47c658d /src | |
| parent | 4395b0560523c57e732c66e3f9ad9bb916aa3c1b (diff) | |
| download | flake8-a5c17c1a19bd0478a8e7543d13cce8fdd30488f2.tar.gz | |
config: Add 'ignore_config_files' parameter to ConfigFileFinder
The `--isolated` flag is passed into `MergedConfigParser.parse()` and
the module-level function `config.get_local_plugins()`. Since both of
these places utilize the `ConfigFileFinder` object and isolation
pertains to how the `ConfigFileFinder` should behave with respect to
isolation, this incremental change more directly associates the
`ConfigFileFinder` and configuration file isolate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/main/application.py | 4 | ||||
| -rw-r--r-- | src/flake8/options/config.py | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 791d5af..7ea3fbb 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -335,7 +335,9 @@ class Application(object): prelim_opts, remaining_args = self.parse_preliminary_options(argv) flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file) config_finder = config.ConfigFileFinder( - self.program, prelim_opts.append_config + self.program, + prelim_opts.append_config, + ignore_config_files=prelim_opts.isolated, ) self.find_plugins( config_finder, prelim_opts.config, prelim_opts.isolated diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py index e1952be..e921f6e 100644 --- a/src/flake8/options/config.py +++ b/src/flake8/options/config.py @@ -16,19 +16,26 @@ __all__ = ("ConfigFileFinder", "MergedConfigParser") class ConfigFileFinder(object): """Encapsulate the logic for finding and reading config files.""" - def __init__(self, program_name, extra_config_files): - # type: (str, List[str]) -> None + def __init__( + self, program_name, extra_config_files, ignore_config_files=False + ): + # type: (str, List[str], bool) -> None """Initialize object to find config files. :param str program_name: Name of the current program (e.g., flake8). :param list extra_config_files: Extra configuration files specified by the user to read. + :param bool ignore_config_files: + Determine whether to ignore configuration files or not. """ # The values of --append-config from the CLI extra_config_files = extra_config_files or [] self.extra_config_files = utils.normalize_paths(extra_config_files) + # The value of --isolated from the CLI. + self.ignore_config_files = ignore_config_files + # Platform specific settings self.is_windows = sys.platform == "win32" self.xdg_home = os.environ.get( |
