Skip to content

Commit 2524aa0

Browse files
Accept duplicate entries in INI config files
Rationale: 1. The `-D` command line option can be specified multiple times. It makes sense to be able to specify the respective config file option `dictionary` multiple times too. 2. While specifying an option multiple times might be an error, the setting strict to `True` catches duplicates only within a single INI file, not across multiple INI files. If we are serious about handling duplicate options, we should therefore handle that manually, distinguishing options that can be duplicated or not.
1 parent 55fe256 commit 2524aa0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

codespell_lib/_codespell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def parse_options(
541541
cfg_files = ["setup.cfg", ".codespellrc"]
542542
if options.config:
543543
cfg_files.append(options.config)
544-
config = configparser.ConfigParser(interpolation=None)
544+
config = configparser.ConfigParser(interpolation=None, strict=False)
545545

546546
# Read toml before other config files.
547547
toml_files = []
@@ -571,7 +571,7 @@ def parse_options(
571571
# Collect which config files are going to be used
572572
used_cfg_files = []
573573
for cfg_file in cfg_files:
574-
_cfg = configparser.ConfigParser()
574+
_cfg = configparser.ConfigParser(interpolation=None, strict=False)
575575
_cfg.read(cfg_file)
576576
if _cfg.has_section("codespell"):
577577
used_cfg_files.append(cfg_file)

0 commit comments

Comments
 (0)