diff --git a/radon/cli/__init__.py b/radon/cli/__init__.py index 3af5138..7c7b3ab 100644 --- a/radon/cli/__init__.py +++ b/radon/cli/__init__.py @@ -4,7 +4,6 @@ import os import sys from contextlib import contextmanager - from mando import Program try: # Python 3.11+ @@ -78,12 +77,19 @@ def toml_config(): @staticmethod def file_config(): '''Return any file configuration discovered''' - config = configparser.ConfigParser() + config = configparser.RawConfigParser() for path in (os.getenv('RADONCFG', None), 'radon.cfg'): if path is not None and os.path.exists(path): config.read_file(open(path)) config.read_dict(FileConfig.toml_config()) config.read(['setup.cfg', os.path.expanduser('~/.radon.cfg')]) + + if config.has_section(CONFIG_SECTION_NAME): + section = dict(config.items(CONFIG_SECTION_NAME)) + interpolated_config = configparser.ConfigParser() + interpolated_config[CONFIG_SECTION_NAME] = section + config = interpolated_config + return config