Improve selflint results by fixing a few mistakes.

But selflint still does not pass. This appears to be due to bugs:

    src/fennel-ls/searcher.fnl:9:10: unknown field: path-sep
    src/fennel-ls.fnl:44:2: unknown field: table.unpack

The first one is a pretty clear issue with the field being exported
from fennel-ls.utils but somehow not picked up; reason is unclear.

The second is due to the macroexpansion of `case` making reference to
`table.unpack`, but I think it should be suppressed because the
unknown global is not in this code; it's in the macro.

Once these get fixed, we can add selflint to the ci target.
This commit is contained in:
Phil Hagelberg 2025-02-25 01:26:07 -08:00
parent f6fecd7b0b
commit bbc6ec4d62
4 changed files with 11 additions and 7 deletions

View File

@ -1 +1,2 @@
{:fennel-path "./?.fnl;./?/init.fnl;src/?.fnl;src/?/init.fnl;deps/?.fnl;deps/?/init.fnl"}
{:lua-version "intersection"
:fennel-path "./?.fnl;./?/init.fnl;src/?.fnl;src/?/init.fnl;deps/?.fnl;deps/?/init.fnl"}

View File

@ -42,7 +42,6 @@ find the definition `10`, but if `opts.stop-early?` is set, it would find
(local utils (require :fennel-ls.utils))
(local files (require :fennel-ls.files))
(local docs (require :fennel-ls.docs))
(local {: view} (require :fennel))
(local get-ast-info utils.get-ast-info)

View File

@ -25,7 +25,7 @@ identifiers are declared / referenced in which places."
(λ ast->macro-ast [ast]
[(fennel.list (sym :eval-compiler)
((or table.unpack _G.unpack) ast))])
((or (. table :unpack) _G.unpack) ast))])
(λ multisym? [t]
;; check if t is a symbol with multiple parts, eg. foo.bar.baz

View File

@ -13,10 +13,10 @@
name {:binding name :metadata (. METADATA value)}))
(local lua-versions
{:lua51 (require :fennel-ls.docs.generated.lua51)
:lua52 (require :fennel-ls.docs.generated.lua52)
:lua53 (require :fennel-ls.docs.generated.lua53)
:lua54 (require :fennel-ls.docs.generated.lua54)})
{:lua51 (require :fennel-ls.docs.generated.lua51)
:lua52 (require :fennel-ls.docs.generated.lua52)
:lua53 (require :fennel-ls.docs.generated.lua53)
:lua54 (require :fennel-ls.docs.generated.lua54)})
(fn get-lua-version [version]
(when (not (. lua-versions version))
@ -26,6 +26,10 @@
table.sort)))))
(. lua-versions version))
;; work around a mistake in Lua's own manual
(set lua-versions.lua51.package.fields.config
lua-versions.lua52.package.fields.config)
(set lua-versions.intersection
(collect [k v (pairs lua-versions.lua51)]
(if (. lua-versions.lua54 k) (values k v))))