From 8064b33a36dbf6b799a1c1767df32511e5160d6e Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 5 May 2023 13:55:14 -0400 Subject: [PATCH] some luacheck fixes --- coordinator/iocontrol.lua | 4 ++++ graphics/elements/controls/hazard_button.lua | 4 +--- graphics/elements/controls/push_button.lua | 4 +--- graphics/elements/controls/switch_button.lua | 4 +--- scada-common/util.lua | 4 ++++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/coordinator/iocontrol.lua b/coordinator/iocontrol.lua index e26546d..60444f6 100644 --- a/coordinator/iocontrol.lua +++ b/coordinator/iocontrol.lua @@ -18,11 +18,15 @@ local iocontrol = {} ---@class ioctl local io = {} +-- luacheck push ignore + -- placeholder acknowledge function for type hinting ---@param success boolean ---@diagnostic disable-next-line: unused-local local function __generic_ack(success) end +-- luacheck pop + -- initialize the coordinator IO controller ---@param conf facility_conf configuration ---@param comms coord_comms comms reference diff --git a/graphics/elements/controls/hazard_button.lua b/graphics/elements/controls/hazard_button.lua index e9f2bf4..2b9baa6 100644 --- a/graphics/elements/controls/hazard_button.lua +++ b/graphics/elements/controls/hazard_button.lua @@ -141,9 +141,7 @@ local function hazard_button(args) end -- handle mouse interaction - ---@param event mouse_interaction mouse event ----@diagnostic disable-next-line: unused-local - function e.handle_mouse(event) + function e.handle_mouse(_) if e.enabled then -- change text color to indicate clicked e.window.setTextColor(args.accent) diff --git a/graphics/elements/controls/push_button.lua b/graphics/elements/controls/push_button.lua index d0c1299..9b5f971 100644 --- a/graphics/elements/controls/push_button.lua +++ b/graphics/elements/controls/push_button.lua @@ -48,9 +48,7 @@ local function push_button(args) end -- handle mouse interaction - ---@param event mouse_interaction mouse event ----@diagnostic disable-next-line: unused-local - function e.handle_mouse(event) + function e.handle_mouse(_) if e.enabled then if args.active_fg_bg ~= nil then -- show as pressed diff --git a/graphics/elements/controls/switch_button.lua b/graphics/elements/controls/switch_button.lua index 133ea45..012872c 100644 --- a/graphics/elements/controls/switch_button.lua +++ b/graphics/elements/controls/switch_button.lua @@ -63,9 +63,7 @@ local function switch_button(args) draw_state() -- handle mouse interaction - ---@param event mouse_interaction mouse event ----@diagnostic disable-next-line: unused-local - function e.handle_mouse(event) + function e.handle_mouse(_) if e.enabled then -- toggle state e.value = not e.value diff --git a/scada-common/util.lua b/scada-common/util.lua index 5f2f34b..315f8cb 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -113,6 +113,8 @@ end ---@return table lines function util.strwrap(str, limit) return cc_strings.wrap(str, limit) end +-- luacheck push no unused varargs + -- concatenation with built-in to string ---@nodiscard ---@vararg any @@ -136,6 +138,8 @@ function util.sprintf(format, ...) return string.format(format, table.unpack(arg)) end +-- luacheck pop + -- format a number string with commas as the thousands separator
-- subtracts from spaces at the start if present for each comma used ---@nodiscard