Skip to content

Conversation

@calebevans
Copy link
Owner

@calebevans calebevans commented Jan 20, 2026

  • Add XML special character escaping (&, <, >) to prevent parse errors
  • Add proper XML declaration and root element
  • Add pretty printing with indentation for readability
  • Add test coverage for XML escaping
  • Update documentation to reflect new XML structure

Summary by CodeRabbit

  • Documentation

    • Updated architecture docs to describe the new pretty-printed XML output format and metadata (including raw content).
  • Bug Fixes

    • XML output now includes declaration and wrapper, with consistent indentation and escaped special characters.
    • Empty input now yields a valid XML document instead of empty output.
  • Tests

    • Tests updated to expect the XML wrapper and verify proper escaping of XML special characters.
  • Chores

    • Version bumped to 0.3.3.

✏️ Tip: You can customize this high-level summary in your review settings.

@calebevans calebevans self-assigned this Jan 20, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

Warning

Rate limit exceeded

@calebevans has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 244a871 and dbe5266.

📒 Files selected for processing (6)
  • docs/architecture.md
  • pyproject.toml
  • src/cordon/__init__.py
  • src/cordon/postprocess/formatter.py
  • tests/test_integration.py
  • tests/test_postprocess.py
📝 Walkthrough

Walkthrough

Version 0.3.3 updates the XML output formatter to emit a pretty-printed XML document with an XML declaration and an <anomalies> root, adds XML character escaping, and adjusts tests and documentation to expect the new wrapped output.

Changes

Cohort / File(s) Summary
Documentation
docs/architecture.md
Revised Output Formatting wording and expanded the example to a full XML document with <?xml ...?>, an <anomalies> root, wrapped <block> entries, and metadata now including raw content.
Version Bump
pyproject.toml, src/cordon/__init__.py
Project version updated from 0.3.2 to 0.3.3.
Formatter Implementation
src/cordon/postprocess/formatter.py
Introduced XML declaration and <anomalies> root, applied xml.sax.saxutils.escape for block content, added pretty-printing (2-space <block> tags, 4-space content indentation), and produces minimal XML for empty input.
Tests
tests/test_integration.py, tests/test_postprocess.py
Updated expected outputs to the XML wrapper and header; added test to verify escaping of XML special characters (&, <, >); empty-output expectations changed to minimal XML document.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nibble bytes and tidy tags tonight,

Pretty XML wrapped up just right.
Escaped the ampersand, tucked brackets in tight,
Anomalies nested, indented with light.
Hop, hop — release looks delightful! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures all main changes: XML escaping, root element addition, and pretty printing, which align with the extensive modifications across formatter, tests, and documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/architecture.md`:
- Around line 307-334: The XML example in the <anomalies> <block> section has
several log lines (the ones showing "[Sun Dec 04 14:29:00 2005] ..." through
"[Sun Dec 04 16:24:06 2005] ...") that are missing the 4-space indentation used
for other lines inside the <block>; update those lines so each line within the
<block> is prefixed with four spaces to match the surrounding entries and
maintain consistent indentation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/cordon/postprocess/formatter.py`:
- Around line 55-71: The current indentation logic drops whitespace-only lines
because it uses line.strip(); update the generator that builds indented_content
to preserve original whitespace-only lines by checking for an empty string
instead (e.g., use if line != "" or if line == "" accordingly) so that
escaped_content.splitlines() entries that contain only whitespace are not
discarded; modify the expression that creates indented_content (referencing
escaped_content and indented_content) to prepend the indentation to non-empty
strings and preserve whitespace-only lines from content_lines when appending to
output_parts.

- Add XML special character escaping (&, <, >) to prevent parse errors
- Add proper XML declaration and <anomalies> root element
- Add pretty printing with indentation for readability
- Add test coverage for XML escaping
- Update documentation to reflect new XML structure
@sonarqubecloud
Copy link

@calebevans calebevans merged commit 87eb420 into main Jan 20, 2026
8 checks passed
@calebevans calebevans deleted the xml branch January 20, 2026 19:08
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.

2 participants