Skip to content

Conversation

@PrzemyslawZabicki
Copy link

@PrzemyslawZabicki PrzemyslawZabicki commented Sep 20, 2025

Ensure all files are opened with UTF-8 instead of relying on OS defaults. This prevents UnicodeDecodeError on Windows and ensures consistent behavior across environments when parsing STIG data containing special characters.

Summary by CodeRabbit

  • Bug Fixes
    • Ensures XML imports use UTF-8 encoding, preventing parsing errors and garbled characters for non-ASCII content.
    • Improves consistency across platforms by standardizing file reading behavior, reducing sporadic import failures.
    • Users working with legacy-encoded XML may need to convert files to UTF-8 to import successfully.

PrzemyslawZabicki and others added 2 commits September 20, 2025 05:44
Ensure all files are opened with UTF-8 instead of relying on OS defaults.
This prevents UnicodeDecodeError on Windows and ensures consistent behavior across environments when parsing STIG data containing special characters.
Copy link
Collaborator

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.

All Python code needs to follow the black style guide and all commits need to signed with GPG. I will have contributing guide up soon to help explain this.

Ensure all files are opened with UTF-8 instead of relying on OS defaults.
This prevents UnicodeDecodeError on Windows and ensures consistent behavior across environments when parsing STIG data containing special characters.
@coderabbitai
Copy link

coderabbitai bot commented Sep 28, 2025

Walkthrough

Updated XML parsing in stigaview_static/import_stig.py to open files with UTF-8 encoding in _get_root_from_xml_path. No other logic or control flow changes.

Changes

Cohort / File(s) Summary of Changes
XML Parsing Encoding
stigaview_static/import_stig.py
Open XML files with encoding="utf-8" in _get_root_from_xml_path; no other functional changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

I nibbled bytes with careful cheer,
Set UTF-8 so glyphs are clear.
No tangled flow, no logic spree—
Just tidy text, now bug-free tea.
Hop, parse, hop—content draws near! 🐇📄

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately describes the primary change of explicitly opening STIG files with UTF-8 encoding to avoid OS-dependent defaults and decoding errors, matching the PR’s objectives without extraneous details.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5de149d and 4b5397a.

📒 Files selected for processing (1)
  • stigaview_static/import_stig.py (1 hunks)
🔇 Additional comments (1)
stigaview_static/import_stig.py (1)

118-120: Explicit UTF-8 decoding prevents platform-specific parse errors.

Good call tightening this up—explicitly decoding as UTF-8 keeps the parser consistent across environments.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • UTF-8: Entity not found: Issue - Could not find referenced Issue.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

@PrzemyslawZabicki
Copy link
Author

Thanks @Mab879 for a review.

✅ All Python code needs to follow the black style guide.
✅ All commits need to signed with GPG.

@Mab879
Copy link
Collaborator

Mab879 commented Sep 28, 2025

Thanks for the updates. The old commits still are on this branch. My suggestion would be start with a fresh branch based on latest master (commit 8a7a579 as of writing this comment) then cherry-pick 9e24083 to that branch.

For the sake of causing you less headache I have created #188 those the above steps already done.

I will go ahead close this PR, but feel free to open another PR other changes. I will be happy to review them.

Again, thanks for the work.

@Mab879 Mab879 closed this Sep 28, 2025
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