Skip to content

Warn when both pyproject.toml and .codespellrc configure codespell - #4032

Merged
larsoner merged 1 commit into
codespell-project:mainfrom
ekanshul:warn-dual-config
Sep 22, 2026
Merged

larsoner merged 1 commit into
codespell-project:mainfrom
ekanshul:warn-dual-config

Conversation

@ekanshul

Copy link
Copy Markdown
Contributor

Fixes #3999

If both pyproject.toml ([tool.codespell]) and .codespellrc ([codespell]) are present, only the later file is applied. The TOML file was not listed in "Used config files:" either, so the override was easy to miss.

This change:

  • includes pyproject.toml in the used-config list when it has a codespell table
  • prints a warning that .codespellrc takes precedence
  • keeps the warning behind --quiet-level=32 (same bit as other config-file messages)

A test covers the warning and the quiet-level suppression.

.codespellrc already overrides pyproject.toml, but the TOML file was
omitted from the used-config list so the conflict was silent. Report
both files and warn that the INI file wins.

Fixes codespell-project#3999
@larsoner

Copy link
Copy Markdown
Member

Nice, thanks @ekanshul

@larsoner
larsoner merged commit 65bd200 into codespell-project:main Sep 22, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Warn if pyproject.toml and .codespellrc found

2 participants