Skip to content

Map VBA macros and finish the coverage audit (priorities 1–3) - #1

Merged
asharma327 merged 4 commits into
mainfrom
macro-analysis
Nov 1, 2026
Merged

asharma327 merged 4 commits into
mainfrom
macro-analysis

Conversation

@asharma327

Copy link
Copy Markdown
Owner

Brings the macro mapping and the full coverage audit (priorities 1–3) into main.

What's in it

  • Macros (aa1f7f1): each VBA procedure's trigger, the sheets and ranges it writes and uses, the procedures it calls, and the formula cells that call it. These show in REPORT.md and as macro nodes in graph.json. Adds the sheetgraph macro command and an xlsm fixture.
  • Priority 1 (0ff3814):
    • Fixes 3D-reference and external-reference graph edges.
    • File settings: properties, calc mode, structure lock.
    • Data connections and Power Query.
    • Shapes and controls, pictures in cells, data types and chips.
    • Rich text runs, locked cells, and numbers shown as formatted.
  • Priority 2 (4ae0027):
    • Very hidden tabs.
    • Sheet-scoped and formula/LAMBDA names.
    • Named cell styles and border sides.
    • Dropdown, validation and conditional-format rules as graph nodes.
    • trace across sibling extracted workbooks.
    • Merged cells.
    • Google slicers and Tables.
  • Priority 3 (83b1f29):
    • Column widths and row heights.
    • Gridlines off.
    • Outline groups (Excel and Google).
    • Note and comment authors with replies and resolved state.
    • Google Drive comments, read-only.

Full details are in CHANGELOG.md under Unreleased.

Testing

  • tests/fixtures/audit.xlsx and Other.xlsx (built by make_audit.py) carry every item on the coverage checklist; tests/audit.rs asserts each one.
  • Locally, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked and cargo doc with -D warnings all pass.
  • Ran the old and new builds over the local corpus of 1,351 files: no new failures (only the same 2 ~$ lock files) and the same run time. Output grew 0.03%.

🤖 Generated with Claude Code

asharma327 and others added 4 commits October 28, 2026 14:45
- New `macros` module reads each VBA procedure's source: the sheets and
  ranges it writes and uses (literal addresses, variables, With blocks,
  sheets passed to other procedures, code names, string constants, named
  ranges, sheets it creates), the procedures it calls, and the event that
  runs it. Apps Script functions are listed with their triggers.
- REPORT.md: one line per procedure under Scripts; modules with no code
  (the empty one Excel gives every sheet) are counted, not listed.
- graph.json: `macro` nodes with `writes` / `uses` / `calls` edges, and
  `calls` edges from formula groups to the VBA functions they use.
- `sheetgraph macro <dir> [name]` lists macros or prints a module's or
  procedure's code; `find` also searches macro code.
- Read sheets' VBA code names from xlsx/xlsm (`Sheet.code_name`).
- tests/fixtures/macros.xlsm, built by make_macros.py (which writes the VBA
  project from scratch), and tests/macros.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ich cells

Graph fixes:
- 3D references (Jan:Dec!B2) now link every sheet in the span.
- References into another workbook no longer add a broken edge.

File level: document and custom properties, calculation mode and iterative
settings (Excel and Google), locked structure, data connections with
passwords removed, and Power Query code as scripts.

Tabs: pictures, shapes, text boxes and form buttons with their anchors;
the graph links a button to the macro it runs and a control to its cell.

Cells: numbers read as displayed via a number-format renderer, pictures in
cells and data types (Excel), people/file chips and rich-text runs (Excel
and Google), unlocked cells and hidden formulas.

Also guards against a calamine panic on unusual VBA compression, and adds
tests/audit.rs over a generated audit workbook as a regression suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ges; trace across workbooks

- Mark very hidden tabs; read sheet-scoped names (local wins) and link
  formula/LAMBDA names to what they read
- Report meaningful named cell styles and which border sides are drawn
  (style field `borders` replaced by `border`)
- Dropdown, validation and conditional-format rules become graph nodes
  with edges to the ranges they read
- `trace` follows links into sibling extracted workbooks, both directions
- Google slicers and Tables
- Explain merged cells in `cells`/`trace`, fold repeated merges in the
  report, and flag formulas reading a cell hidden under a merge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t authors

- Column widths and row heights in pixels where not the default; a zero
  width or height counts as hidden
- Gridlines off in the sheet header; grouped rows and columns with level
  and collapsed state (Excel and Google)
- Notes and threaded comments carry their authors, replies and resolved
  state; Google Drive comments as Workbook.comments, tied to a cell when
  exactly one cell shows the quoted text

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@asharma327
asharma327 merged commit f49c7ca into main Nov 1, 2026
5 checks passed
@asharma327
asharma327 deleted the macro-analysis branch November 3, 2026 18:05
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.

1 participant