emmylua_check as main linter#2776
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR updates lint tooling to provision ChangesLint Tooling
Lua Annotations and Fixes
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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: 2
🤖 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 `@lua/fzf-lua/providers/tags.lua`:
- Around line 260-268: The `M.grep_cword` and `M.grep_cWORD` search assignments
are malformed because the inline `--[[`@as` string]]` cast consumes the closing
parentheses. Fix this by hoisting each `vim.fn.expand("<cword>")` and
`vim.fn.expand("<cWORD>")` call into a local variable, casting the local
instead, and then passing that variable into `utils.rg_escape_cword` and
`utils.rg_escape` so the `opts.search` expressions remain syntactically correct.
In `@lua/fzf-lua/test/screenshot.lua`:
- Around line 86-87: The screenshot helper in nvim_buf_get_lines still adds 1 to
opts.end_line before checking whether it exists, so missing end_line can crash
the call. Update the line-range calculation in the screenshot.lua helper to
guard opts.end_line first and only apply +1 when it is present, keeping the
existing opts.start_line behavior intact and avoiding reliance on the nil-check
suppression.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: de1f3f4e-3f06-4b45-98ba-3cc7000b82fd
📒 Files selected for processing (55)
.github/workflows/lint.yamlMakefilelua/fzf-lua/_health.lualua/fzf-lua/actions.lualua/fzf-lua/cmd.lualua/fzf-lua/complete.lualua/fzf-lua/config.lualua/fzf-lua/core.lualua/fzf-lua/defaults.lualua/fzf-lua/devicons.lualua/fzf-lua/fzf.lualua/fzf-lua/init.lualua/fzf-lua/libuv.lualua/fzf-lua/make_entry.lualua/fzf-lua/path.lualua/fzf-lua/previewer/builtin.lualua/fzf-lua/previewer/codeaction.lualua/fzf-lua/previewer/fzf.lualua/fzf-lua/previewer/init.lualua/fzf-lua/previewer/tscontext.lualua/fzf-lua/profiles/cli.lualua/fzf-lua/profiles/hide.lualua/fzf-lua/providers/buffers.lualua/fzf-lua/providers/colorschemes.lualua/fzf-lua/providers/dap.lualua/fzf-lua/providers/diagnostic.lualua/fzf-lua/providers/files.lualua/fzf-lua/providers/git.lualua/fzf-lua/providers/helptags.lualua/fzf-lua/providers/lsp.lualua/fzf-lua/providers/meta.lualua/fzf-lua/providers/nvim.lualua/fzf-lua/providers/oldfiles.lualua/fzf-lua/providers/quickfix.lualua/fzf-lua/providers/tags.lualua/fzf-lua/providers/ui_select.lualua/fzf-lua/providers/undotree.lualua/fzf-lua/shell.lualua/fzf-lua/spawn.lualua/fzf-lua/test/exec_lua.lualua/fzf-lua/test/helpers.lualua/fzf-lua/test/screenshot.lualua/fzf-lua/types.lualua/fzf-lua/utils.lualua/fzf-lua/win.lualua/fzf-lua/win/border.luascripts/cli.luascripts/gen_options.luascripts/gen_types.luatests/api_spec.luatests/cache_spec.luatests/codeaction_spec.luatests/path_spec.luatests/ui_select_spec.luatests/win_spec.lua
💤 Files with no reviewable changes (1)
- .github/workflows/lint.yaml
8ff0093 to
a08fb72
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Makefile (1)
69-87: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueTarget body length exceeds recommended line count.
Static analysis flags both
deps/emmylua_checkandemmylua-checktargets for exceeding the recommended 5-line body length. This is stylistic only; consider extracting the download logic into a shell script underscripts/if readability becomes a concern, but not essential for this PR.Also applies to: 94-101
🤖 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 `@Makefile` around lines 69 - 87, The Makefile target bodies for deps/emmylua_check and emmylua-check are too long and trigger the line-count warning. Refactor the download/install logic out of these targets into a reusable shell script or helper target, and keep the Makefile recipe bodies minimal while preserving the existing behavior of the deps/emmylua_check and emmylua-check workflows.Source: Linters/SAST tools
🤖 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 `@Makefile`:
- Around line 71-75: The fast path in the Makefile for locating emmylua_check
creates an empty executable placeholder, which causes the emmylua-check target
to use a bogus binary instead of the real tool on PATH. Update the branch that
handles command -v emmylua_check so it records the actual executable path for
EMMY_CHECK_BIN, ideally by symlinking or otherwise pointing to the discovered
binary instead of touch-ing an empty file; also ensure the emmylua-check target
continues to prefer a valid binary via the EMMY and EMMY_CHECK_BIN variables.
---
Nitpick comments:
In `@Makefile`:
- Around line 69-87: The Makefile target bodies for deps/emmylua_check and
emmylua-check are too long and trigger the line-count warning. Refactor the
download/install logic out of these targets into a reusable shell script or
helper target, and keep the Makefile recipe bodies minimal while preserving the
existing behavior of the deps/emmylua_check and emmylua-check workflows.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 29814686-198d-4ca6-9de8-78bdd64871e6
📒 Files selected for processing (55)
.github/workflows/lint.yamlMakefilelua/fzf-lua/_health.lualua/fzf-lua/actions.lualua/fzf-lua/cmd.lualua/fzf-lua/complete.lualua/fzf-lua/config.lualua/fzf-lua/core.lualua/fzf-lua/defaults.lualua/fzf-lua/devicons.lualua/fzf-lua/fzf.lualua/fzf-lua/init.lualua/fzf-lua/libuv.lualua/fzf-lua/make_entry.lualua/fzf-lua/path.lualua/fzf-lua/previewer/builtin.lualua/fzf-lua/previewer/codeaction.lualua/fzf-lua/previewer/fzf.lualua/fzf-lua/previewer/init.lualua/fzf-lua/previewer/tscontext.lualua/fzf-lua/profiles/cli.lualua/fzf-lua/profiles/hide.lualua/fzf-lua/providers/buffers.lualua/fzf-lua/providers/colorschemes.lualua/fzf-lua/providers/dap.lualua/fzf-lua/providers/diagnostic.lualua/fzf-lua/providers/files.lualua/fzf-lua/providers/git.lualua/fzf-lua/providers/helptags.lualua/fzf-lua/providers/lsp.lualua/fzf-lua/providers/meta.lualua/fzf-lua/providers/nvim.lualua/fzf-lua/providers/oldfiles.lualua/fzf-lua/providers/quickfix.lualua/fzf-lua/providers/tags.lualua/fzf-lua/providers/ui_select.lualua/fzf-lua/providers/undotree.lualua/fzf-lua/shell.lualua/fzf-lua/spawn.lualua/fzf-lua/test/exec_lua.lualua/fzf-lua/test/helpers.lualua/fzf-lua/test/screenshot.lualua/fzf-lua/types.lualua/fzf-lua/utils.lualua/fzf-lua/win.lualua/fzf-lua/win/border.luascripts/cli.luascripts/gen_options.luascripts/gen_types.luatests/api_spec.luatests/cache_spec.luatests/codeaction_spec.luatests/path_spec.luatests/ui_select_spec.luatests/win_spec.lua
✅ Files skipped from review due to trivial changes (47)
- lua/fzf-lua/_health.lua
- lua/fzf-lua/providers/quickfix.lua
- tests/ui_select_spec.lua
- lua/fzf-lua/fzf.lua
- lua/fzf-lua/providers/helptags.lua
- lua/fzf-lua/test/exec_lua.lua
- lua/fzf-lua/cmd.lua
- lua/fzf-lua/providers/lsp.lua
- tests/codeaction_spec.lua
- lua/fzf-lua/providers/files.lua
- lua/fzf-lua/previewer/codeaction.lua
- tests/cache_spec.lua
- lua/fzf-lua/spawn.lua
- lua/fzf-lua/win/border.lua
- lua/fzf-lua/profiles/cli.lua
- scripts/cli.lua
- scripts/gen_options.lua
- lua/fzf-lua/test/screenshot.lua
- lua/fzf-lua/providers/dap.lua
- tests/win_spec.lua
- lua/fzf-lua/previewer/tscontext.lua
- lua/fzf-lua/defaults.lua
- lua/fzf-lua/providers/meta.lua
- lua/fzf-lua/providers/colorschemes.lua
- lua/fzf-lua/complete.lua
- lua/fzf-lua/providers/oldfiles.lua
- lua/fzf-lua/providers/diagnostic.lua
- lua/fzf-lua/providers/buffers.lua
- lua/fzf-lua/devicons.lua
- scripts/gen_types.lua
- lua/fzf-lua/providers/undotree.lua
- lua/fzf-lua/make_entry.lua
- lua/fzf-lua/test/helpers.lua
- lua/fzf-lua/config.lua
- tests/api_spec.lua
- lua/fzf-lua/shell.lua
- lua/fzf-lua/providers/ui_select.lua
- lua/fzf-lua/path.lua
- lua/fzf-lua/previewer/fzf.lua
- lua/fzf-lua/libuv.lua
- lua/fzf-lua/core.lua
- lua/fzf-lua/win.lua
- lua/fzf-lua/providers/nvim.lua
- lua/fzf-lua/providers/git.lua
- lua/fzf-lua/previewer/builtin.lua
- lua/fzf-lua/init.lua
- lua/fzf-lua/providers/tags.lua
🚧 Files skipped from review as they are similar to previous changes (7)
- lua/fzf-lua/previewer/init.lua
- lua/fzf-lua/profiles/hide.lua
- .github/workflows/lint.yaml
- tests/path_spec.lua
- lua/fzf-lua/types.lua
- lua/fzf-lua/utils.lua
- lua/fzf-lua/actions.lua
8ae04ff to
895a7ed
Compare
895a7ed to
d64308f
Compare
|
@phanen, comments? before I merge this I want to also add an automatic download of emmylua_format/luafmt and setup a format check as well - what do you think? |
18b64df to
df054af
Compare
|
One issue I’m adding is that luafmt apparently does not take into account lua block comments, take for example the section below gets formatted, the Any ideas @phanen? Or should we open an upstream issue as this is IMHO a bug. Lines 743 to 788 in df054af |
df054af to
0847c90
Compare
|
We can also merge this and wait for upstream fixes before we enable |
yeah the new formatter currently have less feature than emmylua_codestyle |
IDK how coderabbit came out with this summary but it's totally wrong lol
What this PR does
make emmylua_checkThe below is the garbage generated by coderabbitai:
Summary by CodeRabbit
grep_lgrepaction could ignore themultiprocesssetting.FZF_DEFAULT_OPTS.