Replace settings_override regex-scrape with format AST parsing#107
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR replaces regex-based scraping of FormatsConf.FORMATS with AST parsing in settings_override.py, moves AST helpers into production, updates tests to use those helpers, and revises README and the deployment runbook to describe AST-based extraction and maintenance guidance. ChangesAST-based WEBLATE_FORMATS extraction
🎯 3 (Moderate) | ⏱️ ~25 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/boost_weblate/settings_override.py (1)
83-89: 💤 Low valueConsider removing redundant
RuntimeErrorcatch.Lines 85-86 catch
RuntimeErrorand immediately re-raise it. Since the helper functions already raiseRuntimeErrorwith appropriate messages, this catch-and-re-raise is unnecessary. You can simplify by removing those two lines and lettingRuntimeErrorpropagate naturally while still catchingSyntaxErrorandValueError.♻️ Simplified exception handling
try: core = tuple(_parse_formatsconf_formats_ast(src)) - except RuntimeError: - raise except (SyntaxError, ValueError) as exc: msg = f"boost_weblate: could not parse FormatsConf.FORMATS from {models_py}" raise RuntimeError(msg) from exc🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/boost_weblate/settings_override.py` around lines 83 - 89, The try/except block around parsing (where core = tuple(_parse_formatsconf_formats_ast(src))) has an unnecessary except RuntimeError that only re-raises; remove the two-line except RuntimeError: raise branch and leave the except (SyntaxError, ValueError) as exc to convert those into a RuntimeError with the existing msg, so RuntimeError from _parse_formatsconf_formats_ast will propagate unchanged while SyntaxError/ValueError are wrapped.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/boost_weblate/settings_override.py`:
- Around line 83-89: The try/except block around parsing (where core =
tuple(_parse_formatsconf_formats_ast(src))) has an unnecessary except
RuntimeError that only re-raises; remove the two-line except RuntimeError: raise
branch and leave the except (SyntaxError, ValueError) as exc to convert those
into a RuntimeError with the existing msg, so RuntimeError from
_parse_formatsconf_formats_ast will propagate unchanged while
SyntaxError/ValueError are wrapped.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 24af0985-21bd-45fd-bb0d-cf5e18b4be1a
📒 Files selected for processing (4)
README.mddocs/deployment-runbook.mdsrc/boost_weblate/settings_override.pytests/test_settings_override.py
Close #100.
Summary by CodeRabbit
Documentation
Refactor
Tests