Skip to content

feat: populate quickfix list#23

Merged
smnatale merged 6 commits intomainfrom
feat/quickfix-populate
Apr 17, 2026
Merged

feat: populate quickfix list#23
smnatale merged 6 commits intomainfrom
feat/quickfix-populate

Conversation

@smnatale
Copy link
Copy Markdown
Owner

@smnatale smnatale commented Apr 16, 2026

Description

Trigger populating quickfix list for review comments

Screenshots/Images

Summary by CodeRabbit

  • New Features

    • Quickfix integration to send findings to Neovim’s quickfix list and open it.
    • New user command :CodeRabbitQuickfix [id] to populate quickfix from current or saved reviews.
    • New config option quickfix.auto (default: false) to optionally auto-populate on review completion.
  • Documentation

    • Updated docs with quickfix setup, command usage and configuration.
  • Tests

    • Added tests covering quickfix conversion, population and edge cases.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds quickfix-list integration: new quickfix.auto config (default false), a :CodeRabbitQuickfix [id] user command, a public API require("coderabbit").quickfix(id), a new lua/coderabbit/quickfix.lua module to convert findings into quickfix items, and optional automatic population on review completion.

Changes

Cohort / File(s) Summary
Documentation
README.md, doc/coderabbit.txt
Documented new Quickfix integration, quickfix.auto config, :CodeRabbitQuickfix [id] command, and Lua API require("coderabbit").quickfix(id).
Configuration
lua/coderabbit/config.lua
Added default quickfix = { auto = false } to module defaults.
Core Implementation
lua/coderabbit/quickfix.lua
New module mapping diagnostic severities to quickfix types, converting findings to qf items (1-based lnum/col, first-line message, optional severity prefix), setting the quickfix list and opening it, and populating from current or stored reviews.
API & Command Integration
lua/coderabbit/init.lua, plugin/coderabbit.lua
Exported M.quickfix(id) and added :CodeRabbitQuickfix [id] command with optional numeric arg parsing, error notification on invalid id, and completion via stored review IDs.
Review Lifecycle
lua/coderabbit/review.lua
On review exit, conditionally auto-populate quickfix when cfg.quickfix.auto is enabled and findings exist.
Tests
tests/coderabbit/quickfix_spec.lua
Added tests for severity mapping, findings→qf conversion (indexing, message truncation, severity prefix), set/populate behaviour, storage-backed populate, and edge cases.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin as CodeRabbit Plugin
    participant Storage as Review Storage
    participant Neovim as Quickfix List

    User->>Plugin: :CodeRabbitQuickfix [id] or require("coderabbit").quickfix(id)
    alt id provided
        Plugin->>Storage: get_review(id)
        Storage-->>Plugin: findings or nil
    else no id
        Plugin->>Plugin: use in-memory current findings
    end
    Plugin->>Neovim: vim.fn.setqflist(converted items, {title})
    Neovim-->>User: copen (quickfix window)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'feat: populate quickfix list' accurately and concisely describes the primary change across all modified files—adding quickfix list population functionality to the CodeRabbit Neovim plugin.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@smnatale
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
tests/coderabbit/quickfix_spec.lua (1)

103-135: Consider adding tests for populate(id) control flow.

Coverage is strong for conversion/set; adding populate(nil), populate(valid_id), and populate(invalid_id) cases would close the main behavioural gap for the user-facing command/API path.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/coderabbit/quickfix_spec.lua` around lines 103 - 135, Add unit tests
for the quickfix.populate control flow covering three cases: call
quickfix.populate(nil) to exercise the default/no-id path and assert the
quickfix list is populated or remains unchanged as expected; call
quickfix.populate(valid_id) using an existing finding id (from h.finding created
earlier) and assert the quickfix list contains the corresponding items/title;
call quickfix.populate(invalid_id) with a non-existent id and assert it either
clears the quickfix list or leaves it unchanged and does not error. Use the same
test patterns as other cases (vim.fn.getqflist, vim.cmd("cclose"), eq
assertions) and reference the quickfix.populate function to locate where to add
these tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/coderabbit/quickfix.lua`:
- Around line 62-63: Normalize entry.findings to a table before using it: check
the type of entry.findings and if it’s not a table, set findings to an empty
table so findings_to_qf_items always receives a table; update the assignment
around findings (the variable) where title = "CodeRabbit Review #" .. id is set
to ensure findings is either entry.findings (when type is "table") or {}.

In `@lua/coderabbit/review.lua`:
- Around line 214-218: Guard access to cfg.quickfix before reading its auto
field: update the block that checks cfg.quickfix.auto and state.findings (the
condition around cfg.quickfix and `#state.findings`) to first verify cfg.quickfix
is a table (e.g., type(cfg.quickfix) == "table") and only then check
cfg.quickfix.auto; keep calling
require("coderabbit.quickfix").set(state.findings, { title = "CodeRabbit Review"
}) when the guarded condition passes so misconfigured cfg.quickfix (non-table)
won't throw.

In `@plugin/coderabbit.lua`:
- Around line 79-80: The code currently converts args.fargs[1] to a number or
silently sets id = nil which causes unexpected behavior when invoking
require("coderabbit").quickfix(id); update the argument validation so that if
args.fargs[1] is present but not a valid integer (use tonumber and ensure it's
an integer if needed), you print or notify the user of the invalid input and
abort early (return) instead of passing nil to quickfix; change the handling
around the local id and the call to require("coderabbit").quickfix to validate
args.fargs, emit a clear error message, and only call quickfix(id) when id is
valid.

---

Nitpick comments:
In `@tests/coderabbit/quickfix_spec.lua`:
- Around line 103-135: Add unit tests for the quickfix.populate control flow
covering three cases: call quickfix.populate(nil) to exercise the default/no-id
path and assert the quickfix list is populated or remains unchanged as expected;
call quickfix.populate(valid_id) using an existing finding id (from h.finding
created earlier) and assert the quickfix list contains the corresponding
items/title; call quickfix.populate(invalid_id) with a non-existent id and
assert it either clears the quickfix list or leaves it unchanged and does not
error. Use the same test patterns as other cases (vim.fn.getqflist,
vim.cmd("cclose"), eq assertions) and reference the quickfix.populate function
to locate where to add these tests.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 78c9e504-1869-4e75-91ed-8bc6010e18f7

📥 Commits

Reviewing files that changed from the base of the PR and between 91173c5 and 61f89d8.

📒 Files selected for processing (8)
  • README.md
  • doc/coderabbit.txt
  • lua/coderabbit/config.lua
  • lua/coderabbit/init.lua
  • lua/coderabbit/quickfix.lua
  • lua/coderabbit/review.lua
  • plugin/coderabbit.lua
  • tests/coderabbit/quickfix_spec.lua

Comment thread lua/coderabbit/quickfix.lua Outdated
Comment thread lua/coderabbit/review.lua Outdated
Comment thread plugin/coderabbit.lua Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/coderabbit/quickfix_spec.lua`:
- Around line 151-152: The temp-dir cleanup call
vim.fn.delete(populate_test_dir, "rf") is executed at load time and deletes test
data before h.summary() runs and before populate(1) assertions; move that
cleanup so it runs after test execution (e.g., after h.summary() or as a
teardown in the test wrapper) to ensure populate_test_dir remains available
during tests and only removed once assertions complete.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7d3dc8f8-8517-4fc9-9dfc-d06a16883799

📥 Commits

Reviewing files that changed from the base of the PR and between 61f89d8 and 7c75712.

📒 Files selected for processing (4)
  • lua/coderabbit/quickfix.lua
  • lua/coderabbit/review.lua
  • plugin/coderabbit.lua
  • tests/coderabbit/quickfix_spec.lua
🚧 Files skipped from review as they are similar to previous changes (3)
  • lua/coderabbit/review.lua
  • plugin/coderabbit.lua
  • lua/coderabbit/quickfix.lua

Comment thread tests/coderabbit/quickfix_spec.lua Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/coderabbit/quickfix_spec.lua

Commit: a027e36e71a2526881bdc2188d8fb7a18b77a9d1

The changes have been pushed to the feat/quickfix-populate branch.

Time taken: 2m 3s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/coderabbit/quickfix_spec.lua`:
- Line 186: Line with vim.fn.delete(populate_test_dir, "rf") is failing Stylua;
fix by applying the project's Stylua formatting (convert to the project's
preferred string quoting/spacing). Replace the call to use the file's style
(e.g., vim.fn.delete(populate_test_dir, 'rf')) or run the repository Stylua
config to autoformat tests/coderabbit/quickfix_spec.lua so Stylua --check
passes; target symbol: vim.fn.delete and variable populate_test_dir.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 89528292-b48b-44e8-a103-fca949014ea8

📥 Commits

Reviewing files that changed from the base of the PR and between 7c75712 and a027e36.

📒 Files selected for processing (1)
  • tests/coderabbit/quickfix_spec.lua

Comment thread tests/coderabbit/quickfix_spec.lua Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/coderabbit/quickfix_spec.lua

Commit: df180cb9cf8cc790ba149548180bd6642d298a5b

The changes have been pushed to the feat/quickfix-populate branch.

Time taken: 3m 1s

coderabbitai Bot and others added 3 commits April 16, 2026 17:45
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@smnatale smnatale merged commit 83dcdf3 into main Apr 17, 2026
4 checks passed
@smnatale smnatale deleted the feat/quickfix-populate branch April 17, 2026 08:50
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