Skip to content

io: Report warning via warn_print when silently ignoring invalid config in toml/yaml remove_from_list #1841

@nathanjmcdougall

Description

@nathanjmcdougall

In src/usethis/_file/toml/io_.py and src/usethis/_file/yaml/io_.py, the remove_from_list method silently returns when it encounters invalid config (e.g., a non-dict parent or non-list value at the target key). The user receives no feedback that their configuration was ignored.

We should call warn_print to inform the user that invalid config was detected and skipped, using the error messages already provided via the err= arguments to validate_or_raise.

Affected files:

  • src/usethis/_file/toml/io_.py (lines ~429-440)
  • src/usethis/_file/yaml/io_.py (lines ~457-468)

This is a pre-existing issue that predates the validate_or_raise refactoring — the original code also silently returned on invalid config.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions