Bring EmmyLua annotations - #68
Merged
Merged
Conversation
49 tasks
ligurio
force-pushed
the
ligurio/gh-xxxx-emmylua-annotations
branch
2 times, most recently
from
August 7, 2026 14:59
c11d82a to
35ed1d9
Compare
The patch updates luacheckrc to suppress warnings. Follows up the commit 49fa005 ("test: add linting stage").
The patch adds comments for functions with descriptions and argument types in EmmyLua format. Needed for tarantool/tarantool#13020
The patch introduces an initial configuration file .emmyrc for emmylua_check, it is a modern static analuzer for Lua. The configuration file has the same excluded directories as in .luacheckrc and config disables a number of rules. Most of them will be enabled back in the following commits except the following rules: - "unresolved-require" (7 warnings) is disabled because most modules are Tarantool builtins: `json`, `log`, `uuid`; no source code is included in the project. - "need-check-nil" (22 warnings) is disabled because these warnings are not critical and I don't want to add extra checks to the code. - "redefined-local" is disabled because it was disabled for luacheck in the commit 49fa005 ("test: add linting stage").
The patch rule `assign-type-mismatch` in the .emmyrc and fixes three warnings: - @Class checks moved to the module table - no longer sticks to local ffi. - `checks(...)`: vararg typed as `checks.qualifier|number`, level annotated with ---@type number, stack level retrieved via narrowed local first. - @field checks field consistent with type `fun(...: checks.qualifier|number)`.
The patch enables rule `call-non-callable` and fixes warnings produced by this rule: removed class checks/@field from the modul table, now the `require('checks')` type is inferred from setmetatable (callable via variadic `__call`, checks/_VERSION fields are referenced). Field documentation has been moved to the module header.
The patch enables rule `duplicate-require` in the .emmyrc and removes duplicate require for `ffi` module.
The patch enables rule `param-type-mismatch` in the .emmyrc and fixes 20 warnings produced by this rule.
The patch enables rule `undefined-field` in the .emmyrc and fixes errors produced by this rule. The error is in using `table.deepcopy()` in test/test.lua because Tarantool API is unknown to the analyzer. The patch created a definition for `table.deepcopy()` in a file test/types.lua.
The patch enables `unnecessary-if` in the .emmyrc and fixes a warning produced by this rule. The reason of warning is an unknown type of variable `qualifier`. The analyzer infers the `optional` field as literal `false` and doesn't track the assignment `qualifier.optional = true` inside the `gmatch` loop, so `unnecessary-if` considers the condition is always `false`. This is a false positive - at runtime, the condition is reachable (e.g., '?string'). The patch adds the annotation to the local variable `qualifier` - the `optional` field is now typed as boolean, and the analyzer no longer considers the condition to always be false.
The patch enables rule `unused` and fixes a warnings produced by this rule by adding an underscore to the prefix of variables that are not used.
Contributor
|
I see old commits. Could you please rebase your branch relative to master? |
patapenka-alexey
self-requested a review
August 14, 2026 06:38
patapenka-alexey
force-pushed
the
ligurio/gh-xxxx-emmylua-annotations
branch
from
August 17, 2026 08:48
35ed1d9 to
507b1b7
Compare
patapenka-alexey
requested review from
bigbes,
elhimov and
oleg-jukovec
and removed request for
oleg-jukovec
August 17, 2026 08:49
patapenka-alexey
approved these changes
Aug 17, 2026
oleg-jukovec
approved these changes
Aug 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed for tarantool/tarantool#13020