diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-10-25 14:42:45 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-10-26 06:48:45 +0200 |
commit | 17d69269580161456c12c1112b7129f4a5cbb807 (patch) | |
tree | d601ccb4d18b1436e28f32fa1f75647deaf9132b /pylint/config/find_default_config_files.py | |
parent | b6597225fbbc336b5fb30a36ba21b3866d2a9fdb (diff) | |
download | pylint-git-17d69269580161456c12c1112b7129f4a5cbb807.tar.gz |
Move the find_pylintrc function in find_default_config_files.py
Diffstat (limited to 'pylint/config/find_default_config_files.py')
-rw-r--r-- | pylint/config/find_default_config_files.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py index 843aa8648..dd051f9c6 100644 --- a/pylint/config/find_default_config_files.py +++ b/pylint/config/find_default_config_files.py @@ -3,6 +3,7 @@ import configparser import os +from typing import Iterator, Optional import toml from toml import TomlDecodeError @@ -30,7 +31,7 @@ def _cfg_has_config(path): return any(section.startswith("pylint.") for section in parser.sections()) -def find_default_config_files(): +def find_default_config_files() -> Iterator[str]: """Find all possible config files.""" rc_names = ("pylintrc", ".pylintrc") config_names = rc_names + ("pyproject.toml", "setup.cfg") @@ -67,3 +68,11 @@ def find_default_config_files(): if os.path.isfile("/etc/pylintrc"): yield "/etc/pylintrc" + + +def find_pylintrc() -> Optional[str]: + """search the pylint rc file and return its path if it find it, else None""" + for config_file in find_default_config_files(): + if config_file.endswith("pylintrc"): + return config_file + return None |