Skip to content

The toml formatter sorts non-toml files (such as poetry.lock)! #294

@thclark

Description

@thclark

It's possible for files to appear as valid TOML without being TOML. For example the poetry.lock file in many python projects is an internal file format to poetry but is based on TOML.

It's important not to format files that aren't TOML, but this pre-commit hook applies itself to every single file in your commit. If any file accidentally happens to be valid toml then it will get reworked.

In the case of poetry.lock files this creates an incredibly nasty hell because it's already challenging to resolve merge conflicts in these files. Doing so during a rebase requires regeneration of the file; which of course won't be to format. Then you end up with 500 merge conflicts against the next commit that touches it.

I can imagine there would be an unbelievable number of side effects and bugs that could result from this arbitrarily rearranging contents of potentially any file!

Proposed solution

The toml file formatter should only operate on .toml files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions