Skip to content

fix: address critical code review issues - #28

Merged
datenzar merged 1 commit into
mainfrom
fix/code-review-improvements
Dec 31, 2025
Merged

fix: address critical code review issues#28
datenzar merged 1 commit into
mainfrom
fix/code-review-improvements

Conversation

@datenzar

Copy link
Copy Markdown
Contributor

Summary

Security & Resource Management

  • Replace NamedTemporaryFile(delete=False) with TemporaryDirectory for secure temp files (fixes race condition and permission issues)
  • Add GPU memory cleanup when changing languages (del reader + torch.cuda.empty_cache())
  • Add thread safety documentation warning in class docstring

Code Quality

  • Use xml.sax.saxutils.escape for robust XML escaping instead of manual string replacement
  • Add guard for zero median height in line grouping to prevent potential division by zero

Test plan

  • Run make lint - no issues
  • Run make test - tests pass (requires easyocr installation)

🤖 Generated with Claude Code

Security & Resource Management:
- Replace NamedTemporaryFile with TemporaryDirectory for secure temp files
- Add GPU memory cleanup when changing languages (del reader + cuda.empty_cache)
- Add thread safety documentation warning

Code Quality:
- Use xml.sax.saxutils.escape for robust XML escaping
- Add guard for zero median height in line grouping to prevent division by zero

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@datenzar
datenzar merged commit 50ab215 into main Dec 31, 2025
7 checks passed
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