Skip to content

Add INI filetype support#120

Open
0xTaoZ wants to merge 1 commit into
trailofbits:masterfrom
0xTaoZ:0xTaoZ/add-ini-filetype
Open

Add INI filetype support#120
0xTaoZ wants to merge 1 commit into
trailofbits:masterfrom
0xTaoZ:0xTaoZ/add-ini-filetype

Conversation

@0xTaoZ

@0xTaoZ 0xTaoZ commented Jul 2, 2026

Copy link
Copy Markdown

Fixes #49.

This adds first-class INI support using Python's standard configparser module. INI files are represented as section dictionaries with string option values, which lets Graphtage parse, diff, and format .ini files without adding a new dependency.

Changes:

  • add an ini filetype with parser and formatter support
  • register .ini MIME detection for CLI use
  • include INI in the package filetype registry
  • add randomized INI round-trip formatting coverage

Local validation:

  • .venv/bin/python -m pytest test/test_formatting.py -q
  • .venv/bin/python -m ruff check graphtage/ini.py
  • .venv/bin/python -m py_compile graphtage/ini.py graphtage/__init__.py graphtage/__main__.py test/test_formatting.py
  • git diff --check
  • manual CLI smoke test diffing two .ini files

Note: full changed-file Ruff checking reports existing lint issues in files that already predate this change, so I scoped Ruff to the new module and used targeted tests for the touched behavior.

Signed-off-by: Haitao Zheng <[email protected]>
@0xTaoZ 0xTaoZ requested a review from ESultanik as a code owner July 2, 2026 12:56
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.

Add support for INI files

1 participant