Add ACARS free-text cleanup helper#457
Conversation
|
Warning Review limit reached
More reviews will be available in 25 minutes and 24 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughTwo new utility modules are added: ChangesACARS Free-Text Formatter and Label_5Z_Slash Integration
Emergency Squawk Utility Module
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 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)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
lib/utils/emergency_squawk.ts (1)
20-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider deriving validation from SQUAWK_MAP.
The manual check against the three codes duplicates the knowledge already encoded in
SQUAWK_MAP. If a new emergency squawk code is added to the map in the future, this function would need to be updated separately, creating a maintenance burden.♻️ Refactor to eliminate duplication
export function isEmergencySquawk(code: number): boolean { - return code === 7500 || code === 7600 || code === 7700; + return code in SQUAWK_MAP; }🤖 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 `@lib/utils/emergency_squawk.ts` around lines 20 - 22, The isEmergencySquawk function hardcodes the emergency squawk codes (7500, 7600, 7700) instead of deriving them from SQUAWK_MAP, creating maintenance duplication. Refactor the function to check if the provided code exists in SQUAWK_MAP and has an emergency classification, rather than using hardcoded equality checks. This way, adding new emergency squawk codes to SQUAWK_MAP will automatically be reflected in the validation logic without requiring separate function updates.
🤖 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.
Inline comments:
In `@lib/plugins/Label_5Z_Slash.ts`:
- Around line 52-60: The code block containing the ResultFormatter.text()
function call and subsequent statements has inconsistent indentation that
violates Prettier formatting rules. Fix the indentation of the entire block
starting from the comment "not UA, but starts with `/`" through the return
statement by properly aligning the ResultFormatter.text() function call
parameters and all following lines to comply with Prettier's indentation
standards.
In `@lib/utils/acars_free_text.test.ts`:
- Line 13: The test file acars_free_text.test.ts is missing a trailing newline
at the end of the file, which causes the prettier linter to fail. Add a single
newline character at the very end of the file after the final closing brace and
parenthesis `});` to satisfy the prettier formatting requirement.
In `@lib/utils/acars_free_text.ts`:
- Line 4: The file lib/utils/acars_free_text.ts is missing a trailing newline at
the end, which causes Prettier linting to fail. Add a newline character after
the closing brace on the last line of the file to satisfy the Prettier
formatting requirement.
In `@lib/utils/emergency_squawk.test.ts`:
- Around line 1-44: The test file emergency_squawk.test.ts is missing a newline
at the end of the file. Add a newline character after the final closing brace of
the describe block to comply with linting standards. You can do this manually by
placing your cursor at the very end of the file (after the last closing brace)
and adding a newline, or run prettier --write on the file to auto-fix this
formatting issue.
In `@lib/utils/emergency_squawk.ts`:
- Around line 1-27: The emergency_squawk.ts file has prettier formatting
inconsistencies in the getEmergencySquawkInfo function signature (around line
14) and in the formatEmergencySquawk function's ternary expression and final
newline handling (around lines 26-27). Run prettier --write on the
emergency_squawk.ts file to automatically apply the correct formatting according
to the project's prettier configuration, which will fix the multi-line function
signature formatting and the ternary expression/newline issues.
---
Nitpick comments:
In `@lib/utils/emergency_squawk.ts`:
- Around line 20-22: The isEmergencySquawk function hardcodes the emergency
squawk codes (7500, 7600, 7700) instead of deriving them from SQUAWK_MAP,
creating maintenance duplication. Refactor the function to check if the provided
code exists in SQUAWK_MAP and has an emergency classification, rather than using
hardcoded equality checks. This way, adding new emergency squawk codes to
SQUAWK_MAP will automatically be reflected in the validation logic without
requiring separate function updates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 879f8410-1a14-4194-a08a-3f8569941b7e
📒 Files selected for processing (5)
lib/plugins/Label_5Z_Slash.tslib/utils/acars_free_text.test.tslib/utils/acars_free_text.tslib/utils/emergency_squawk.test.tslib/utils/emergency_squawk.ts
|
I’ve addressed the review feedback and the branch is ready. The only remaining blocker appears to be workflow approval. |
Summary by CodeRabbit
New Features
Tests