Skip to content

Commit

Permalink
消除lua-language server code的代码检查警告
Browse files Browse the repository at this point in the history
  • Loading branch information
huahua132 committed Jan 13, 2025
1 parent baf23e2 commit 6520a6c
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/frpc_server/module/test_m.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-field, need-check-nil
local log = require "skynet-fly.log"
local skynet = require "skynet.manager"
local contriner_client = require "skynet-fly.client.contriner_client"
Expand Down
3 changes: 2 additions & 1 deletion lualib/skynet-fly/client/contriner_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ g_mod_svr_ids_map = setmetatable({},{__index = function(t,key)
g_querycbed_map[key] = true
skynet.fork(call_back_queryed, queryed)
end
return t[key],g_mod_svr_version_map[key]
return t[key]
end})

local function monitor_all()
Expand All @@ -166,6 +166,7 @@ local function monitor_all()
end)
end

---@diagnostic disable-next-line: duplicate-set-field
skynet.exit = function()
IS_CLOSE = true
for mod_name in pairs(g_mod_svr_ids_map) do
Expand Down
2 changes: 2 additions & 0 deletions lualib/skynet-fly/client/frpc_client.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-field, need-check-nil

local skynet = require "skynet"
local contriner_client = require "skynet-fly.client.contriner_client"
Expand Down Expand Up @@ -187,6 +188,7 @@ end

local function unpack_broadcast(rsp, secret)
local ret_map = unpack_rsp(rsp, secret)
---@diagnostic disable-next-line: param-type-mismatch
for sid, luastr in pairs(ret_map) do
ret_map[sid] = {skynet.unpack(luastr)}
end
Expand Down
5 changes: 3 additions & 2 deletions lualib/skynet-fly/db/orm/ormtable.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: need-check-nil, assign-type-mismatch, param-type-mismatch
local ormentry = require "skynet-fly.db.orm.ormentry"
local table_util = require "skynet-fly.utils.table_util"
local math_util = require "skynet-fly.utils.math_util"
Expand Down Expand Up @@ -714,7 +715,7 @@ local function get_one_entry(t, key_values)
add_key_select(t, invalid_entry)
return nil, false
else
entry = ormentry:new(t, init_entry_data(t, entry_data), true)
entry = ormentry:new(t, init_entry_data(t, entry_data, true))
return add_key_select(t, entry)
end
end
Expand Down Expand Up @@ -839,7 +840,7 @@ local function get_entry_by_limit(t, cursor, limit, sort, key_values)
local cursor, entry_data_list, count = t._adapterinterface:get_entry_by_limit(cursor, limit, sort, key_values)
for i = 1, #entry_data_list do
local entry_data = entry_data_list[i]
local entry = ormentry:new(t, init_entry_data(t, entry_data), true)
local entry = ormentry:new(t, init_entry_data(t, entry_data, true))
entry_data_list[i] = entry
end

Expand Down
2 changes: 1 addition & 1 deletion lualib/skynet-fly/logrotate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ end
local M = {}
local mt = {__index = M}
---#desc 新建对象
---@param filename string 文件名
---@param filename string? 文件名
---@return table 对象
function M:new(filename)
local t = {
Expand Down
2 changes: 1 addition & 1 deletion lualib/skynet-fly/utils/skynet_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ local g_shutdown_func_map = {}

---#desc 注册关服处理函数
---@param func function 函数
---@param sort_weight number 排序权重
---@param sort_weight number? 排序权重
function M.reg_shutdown_func(func, sort_weight)
sort_weight = sort_weight or 0
assert(type(func) == 'function', "not function")
Expand Down
3 changes: 2 additions & 1 deletion lualib/skynet-fly/utils/string_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ local sfind = string.find
---#desc 字符串分割,可以嵌套分割 例如:split('1:2_3:4','_',':') res = {{1,2},{3,4}}
---@param inputstr string 被分割字符串
---@param ... string 分隔符列表
---@return table|string 分割结果
---@return table 分割结果
function M.split(inputstr, ...)
local seps = {...}
local sep = tremove(seps,1)

if sep == nil then
---@diagnostic disable-next-line: return-type-mismatch
return inputstr
end
local result={}
Expand Down
1 change: 1 addition & 0 deletions lualib/skynet-fly/watch/watch_syn.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
local skynet = require "skynet"
local skynet_util = require "skynet-fly.utils.skynet_util"
local log = require "skynet-fly.log"
Expand Down
1 change: 1 addition & 0 deletions module/frpc_client_m.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: need-check-nil, undefined-field
local skynet = require "skynet"
local timer = require "skynet-fly.timer"
local log = require "skynet-fly.log"
Expand Down
3 changes: 2 additions & 1 deletion module/mysql_m.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-field, need-check-nil
local skynet = require "skynet"
local timer = require "skynet-fly.timer"
local log = require "skynet-fly.log"
Expand Down Expand Up @@ -70,7 +71,7 @@ function CMD.query(sql_str)
end

function CMD.max_packet_size()
return g_db_conf.max_packet_size or 1024 * 1024
return g_db_conf.max_packet_size or (1024 * 1024)
end

function CMD.check_exit()
Expand Down
1 change: 1 addition & 0 deletions module/orm_table_m.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-field, need-check-nil
local skynet = require "skynet"
local log = require "skynet-fly.log"
local skynet_util = require "skynet-fly.utils.skynet_util"
Expand Down
2 changes: 2 additions & 0 deletions module/room_game_alloc_m.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: undefined-field, need-check-nil
--桌子分配
local log = require "skynet-fly.log"
local contriner_client = require "skynet-fly.client.contriner_client"
Expand All @@ -6,6 +7,7 @@ local queue = require "skynet.queue"()
local timer = require "skynet-fly.timer"
local time_util = require "skynet-fly.utils.time_util"
local skynet_util = require "skynet-fly.utils.skynet_util"
local table_util = require "skynet-fly.utils.table_util"

contriner_client:register("room_game_table_m")

Expand Down
1 change: 1 addition & 0 deletions service/hot_container.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field, undefined-field, need-check-nil
local skynet = require "skynet"
local assert = assert
local tonumber = tonumber
Expand Down
1 change: 1 addition & 0 deletions service/room_game_login.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: need-check-nil, undefined-field
local skynet = require "skynet.manager"
local timer = require "skynet-fly.timer"
local log = require "skynet-fly.log"
Expand Down
1 change: 1 addition & 0 deletions service/sharedata_service.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---@diagnostic disable: need-check-nil, undefined-field
local skynet = require "skynet.manager"
local sharedata = require "skynet.sharedata"
local sharetable = require "skynet.sharetable"
Expand Down

0 comments on commit 6520a6c

Please sign in to comment.