Skip to content

Commit 0c2e777

Browse files
committed
fix(cli): scope config interpolation to radon section
1 parent 293ac3f commit 0c2e777

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

radon/cli/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,19 @@ def toml_config():
7878
@staticmethod
7979
def file_config():
8080
'''Return any file configuration discovered'''
81-
config = configparser.ConfigParser()
81+
config = configparser.RawConfigParser()
8282
for path in (os.getenv('RADONCFG', None), 'radon.cfg'):
8383
if path is not None and os.path.exists(path):
8484
config.read_file(open(path))
8585
config.read_dict(FileConfig.toml_config())
8686
config.read(['setup.cfg', os.path.expanduser('~/.radon.cfg')])
87+
88+
if config.has_section(CONFIG_SECTION_NAME):
89+
section = dict(config.items(CONFIG_SECTION_NAME))
90+
interpolated_config = configparser.ConfigParser()
91+
interpolated_config[CONFIG_SECTION_NAME] = section
92+
config = interpolated_config
93+
8794
return config
8895

8996

0 commit comments

Comments
 (0)