Skip to content

Provide an option to apply changes and exit non-zero if changes were made #531

@chadrik

Description

@chadrik

Context

Similar to this ticket and this one filed for the ruff formatter, it would be valuable to apply changes and return 1 . Currently we can only choose one or the other.

All of the arguments in favor of this behavior are in the linked tickets, but here's a summary from my POV:

Proposal

Since ruff is such a popular linter, I propose that we add a flag with the same name: --exit-non-zero-on-format. This flag will tell mdformat to return non-zero if any files were modified.

This would be a super quick fix, so I'm happy to make the change myself if there are no objections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions