Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 10 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughA new utility module is introduced that provides centralised helpers for JSON decoding, file I/O, notifications, and text pluralisation. Six existing modules ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ 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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (3)
lua/coderabbit/utils.lua (2)
54-56: Nit:pluralizeonly handles regular-splurals.Fine for current callers (
"finding"), but callers passing words like"entry"or"match"would yield"entrys"/"matchs". Worth a short doc note or a futurepluraloverride parameter if usage expands.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lua/coderabbit/utils.lua` around lines 54 - 56, The pluralize helper M.pluralize currently only appends "s" and mispluralizes irregular nouns; update it to accept an optional override parameter (e.g., M.pluralize(n, word, plural_override)) or a custom pluralizer function so callers can supply the correct plural form (or a table/map of exceptions) when needed; document the new signature in the function comment and update callers that might pass words like "entry" or "match" to provide the correct plural_override or mapping.
31-39: Optional: surfacefile:writeerrors more faithfully.
io.open(path, "w")in Lua returnsnil, erron failure, andfile:writereturns the file handle on success ornil, erron failure. The current implementation collapses both to a boolean and silently discards the error message, which can make write failures hard to diagnose (e.g. permission denied, disk full). Consider capturing and returning the error, or at least logging it viautils.notifyatERRORlevel.♻️ Optional refactor
function M.write_file(path, content) - local file = io.open(path, "w") - if not file then - return false + local file, open_err = io.open(path, "w") + if not file then + return false, open_err end - local ok = file:write(content) + local ok, write_err = file:write(content) file:close() - return ok ~= nil + return ok ~= nil, write_err end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lua/coderabbit/utils.lua` around lines 31 - 39, The write_file implementation (function M.write_file) currently discards error details from io.open and file:write; update it to capture both open and write errors (io.open returns nil, err and file:write returns nil, err) and either return them to the caller or log them via utils.notify at ERROR level; specifically, when io.open fails include the err in the failure return/log, and when file:write fails capture its err (close the file if opened) and return/log that error instead of just true/false so callers can diagnose permission/disk issues.lua/coderabbit/storage.lua (1)
83-85: Consider surfacing write failures to the user.
M.savesilently returnsnilwhenutils.write_filefails (e.g. permission denied, disk full). Callers inreview.luainvokestorage.savewithout checking the return value, so the user currently gets no feedback if a completed review can't be persisted. Autils.notify(..., vim.log.levels.ERROR)on failure would make this debuggable without adding much noise.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lua/coderabbit/storage.lua` around lines 83 - 85, M.save currently returns nil on write failures without user feedback; update M.save to detect a failed utils.write_file call, call utils.notify with an ERROR level (vim.log.levels.ERROR) including contextual details (file path and any error message returned by utils.write_file if available), and then return nil/false so callers can react; reference the M.save function, utils.write_file and utils.notify, and ensure review.lua callers of storage.save will surface the notification to the user when persistence fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@lua/coderabbit/storage.lua`:
- Around line 83-85: M.save currently returns nil on write failures without user
feedback; update M.save to detect a failed utils.write_file call, call
utils.notify with an ERROR level (vim.log.levels.ERROR) including contextual
details (file path and any error message returned by utils.write_file if
available), and then return nil/false so callers can react; reference the M.save
function, utils.write_file and utils.notify, and ensure review.lua callers of
storage.save will surface the notification to the user when persistence fails.
In `@lua/coderabbit/utils.lua`:
- Around line 54-56: The pluralize helper M.pluralize currently only appends "s"
and mispluralizes irregular nouns; update it to accept an optional override
parameter (e.g., M.pluralize(n, word, plural_override)) or a custom pluralizer
function so callers can supply the correct plural form (or a table/map of
exceptions) when needed; document the new signature in the function comment and
update callers that might pass words like "entry" or "match" to provide the
correct plural_override or mapping.
- Around line 31-39: The write_file implementation (function M.write_file)
currently discards error details from io.open and file:write; update it to
capture both open and write errors (io.open returns nil, err and file:write
returns nil, err) and either return them to the caller or log them via
utils.notify at ERROR level; specifically, when io.open fails include the err in
the failure return/log, and when file:write fails capture its err (close the
file if opened) and return/log that error instead of just true/false so callers
can diagnose permission/disk issues.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4465e25e-978f-48b7-83b3-441a58a3c6f0
📒 Files selected for processing (7)
lua/coderabbit/health.lualua/coderabbit/history.lualua/coderabbit/parser.lualua/coderabbit/review.lualua/coderabbit/show.lualua/coderabbit/storage.lualua/coderabbit/utils.lua
Description
Extract common utils
Screenshots/Images
Summary by CodeRabbit