Skip to content

Add editorconfig conformance checker: scripts/editorconfig-changes#100

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/build-editorconfig-conformance-tool
Draft

Add editorconfig conformance checker: scripts/editorconfig-changes#100
Copilot wants to merge 2 commits into
mainfrom
copilot/build-editorconfig-conformance-tool

Conversation

Copilot AI commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Builds a shell script around the editorconfig CLI that detects editorconfig violations and emits a unified diff patch — without modifying files on disk. Non-zero exit when any patch is produced makes it suitable as a CI gate or pre-commit check.

Usage

# Per-file (e.g. via fd --exec)
fd . --absolute-path --exec editorconfig-changes {}

# Batch via stdin
fd . --absolute-path | editorconfig-changes -

What it checks

Calls editorconfig <file> (single-file key=value output) per file and applies rules to a temp copy:

  • trim_trailing_whitespacesed strips trailing space/tabs per line
  • end_of_line — normalises between lf / crlf / cr
  • insert_final_newline — adds or removes the trailing newline byte
  • charset — detects current encoding via file -b --mime-encoding, converts with iconv -f <detected> -t <target>

Binary files (detected via file --mime-encoding) and files with no editorconfig config are skipped. Quoted values (charset="utf-8") and values containing = are handled correctly.

Other changes

  • tests/test_editorconfig_changes.bats — 33 BATS tests; editorconfig CLI is mocked so no real binary is required for unit testing
  • .github/workflows/test-editorconfig-changes.yml — CI on macOS + Ubuntu with the real editorconfig binary installed
  • brewfiles/Brewfile.all — adds editorconfig runtime dependency

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Build an editorconfig conformance tool around binary Add editorconfig conformance checker: scripts/editorconfig-changes Mar 29, 2026
Copilot AI requested a review from colindean March 29, 2026 04:48
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.

Build an editorconfig conformance tool around binary

2 participants