Skip to content

Report empty CSV column names - #18

Merged
kushagarwal2910-lang merged 1 commit into
github-community-gitam:mainfrom
SakarPaisen:report-empty-csv-column-names
Oct 12, 2026
Merged

kushagarwal2910-lang merged 1 commit into
github-community-gitam:mainfrom
SakarPaisen:report-empty-csv-column-names

Conversation

@SakarPaisen

Copy link
Copy Markdown
Contributor

inspect_csv now returns empty_header_indices: the zero-based positions of header cells that are empty or whitespace-only, so a blank column name is visible instead of only its effect on the row shape.

Every item on the issue's checklist:

  • inspect_csv("name,,age\nAda,20,x\nBob,30,y")["empty_header_indices"] == [1] — the issue's own example
  • A whitespace-only header cell also counts ("name, ,age" → [1])
  • valid stays True; a blank name is a warning, not an invalid document
  • columns keeps the empty string unchanged
  • row_count, missing_values and inconsistent_rows are unchanged
  • Empty input returns an empty empty_header_indices list
  • New test file tests/test_csv_tool_empty_header.py, runnable on its own
  • docs/tool-guide.md updated (the README does not list output keys, so it needed no change)

A document that fails to parse keeps its current {"valid": false, "error": ...} shape, with no empty_header_indices key — there are no header positions to name.

What I ran: python -m pytest -q → 62 passed (55 before, 7 new), python -m pytest tests/test_csv_tool_empty_header.py -q → 7 passed, and .github/scripts/check_rules.py → passes.

Closes #11.

`inspect_csv` now returns `empty_header_indices`: the zero-based positions of
header cells that are empty or whitespace-only, so a blank column name is
visible instead of only its effect on the row shape.

The field is warning-only. `valid` stays true, the empty string stays in
`columns`, and the count never moves. The empty-input branch adds an empty
`empty_header_indices` list; a document that fails to parse keeps its current
`{"valid": false, "error": ...}` shape with no `empty_header_indices` key.

Fixes github-community-gitam#11.
@kushagarwal2910-lang
kushagarwal2910-lang merged commit 742435d into github-community-gitam:main Oct 12, 2026
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.

Report empty CSV column names

2 participants