Skip to content

Add check-only formatting mode with diff and concise output #452

Description

@coderabbitai

Summary

Add a --check mode that detects files which mdtablefix would change without modifying them.

In normal --check output, emit a diff for each changed input file.

Add a --concise flag for --check mode. This flag must list only the changed filenames.

Rationale

Repositories need a check-only formatting gate that reports formatting drift without changing tracked files.

A diff enables users to diagnose the required formatting changes. Filename-only output enables concise CI logs.

Required changes

  • Add a --check command-line option.
  • In --check mode, process every input file without modifying any input file.
  • Return exit status zero when no input file requires formatting changes.
  • Return a non-zero exit status when any input file requires formatting changes.
  • In normal --check mode, emit a readable diff for every input file that requires changes.
  • Add a --concise command-line option.
  • When --check --concise is used, list only the filenames of input files that require changes.
  • Define the interaction of --concise without --check, including either rejection or a documented behaviour.
  • Preserve existing formatting and in-place formatting behaviour outside --check mode.

Affected areas

  • Command-line argument parsing.
  • Formatter execution and file-writing paths.
  • Diff rendering.
  • User documentation and command help.
  • Automated tests.

Acceptance criteria

  • mdtablefix --check clean.md returns exit status zero and does not modify clean.md.
  • mdtablefix --check unformatted.md returns a non-zero exit status and does not modify unformatted.md.
  • mdtablefix --check unformatted.md emits a diff that identifies the required changes.
  • mdtablefix --check processes all supplied input files and reports every changed file before it exits non-zero.
  • mdtablefix --check --concise returns a non-zero exit status for changed input and lists only changed filenames.
  • --concise output contains no diff content.
  • Tests cover clean files, changed files, multiple input files, no source-file modification, exit statuses, diff output, and concise output.
  • Command help documents --check and --concise.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or requesttestingTest coverage, test infrastructure, and verification tooling work.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions