Fix Luacheck 0.19.0 release Travis breaks

This commit is contained in:
Kevin Zander 2017-03-03 16:11:06 -06:00
parent 17ed7c182c
commit 3f6df8ddee
15 changed files with 133 additions and 97 deletions

View File

@ -13,11 +13,13 @@ files["awesomerc.lua"].allow_defined_top = true
-- This file itself -- This file itself
files[".luacheckrc"].ignore = {"111", "112", "131"} files[".luacheckrc"].ignore = {"111", "112", "131"}
-- Theme files, ignore max line length
files["themes/*"].ignore = {"631"}
-- Global objects defined by the C code -- Global objects defined by the C code
read_globals = { read_globals = {
"awesome", "awesome",
"button", "button",
"client",
"dbus", "dbus",
"drawable", "drawable",
"drawin", "drawin",
@ -28,6 +30,8 @@ read_globals = {
"selection", "selection",
"tag", "tag",
"window", "window",
"table.unpack",
"math.atan2",
} }
-- screen may not be read-only, because newer luacheck versions complain about -- screen may not be read-only, because newer luacheck versions complain about

View File

@ -106,7 +106,8 @@ function completion.shell(command, cur_pos, ncomp, shell)
-- check commands, aliases, builtins, functions and reswords -- check commands, aliases, builtins, functions and reswords
shell_cmd = "/usr/bin/env zsh -c 'local -a res; ".. shell_cmd = "/usr/bin/env zsh -c 'local -a res; "..
"res=( ".. "res=( "..
"\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" \"${(k)reswords[@]}\" ".. "\"${(k)commands[@]}\" \"${(k)aliases[@]}\" \"${(k)builtins[@]}\" \"${(k)functions[@]}\" "..
"\"${(k)reswords[@]}\" "..
"${PWD}/*(:t)".. "${PWD}/*(:t)"..
"); ".. "); "..
"print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'" "print -ln -- ${(M)res[@]:#" .. string.format('%q', words[cword_index]) .. "*}'"

View File

@ -117,7 +117,8 @@ local function mouse_resize_handler(c, _, _, _, orientation)
local geom = c:geometry() local geom = c:geometry()
-- we have to make sure we're not on the last visible client where we have to use different settings. -- we have to make sure we're not on the last visible
-- client where we have to use different settings.
local wfact local wfact
local wfact_x, wfact_y local wfact_x, wfact_y
if (geom.y+geom.height+15) > (wa.y+wa.height) then if (geom.y+geom.height+15) > (wa.y+wa.height) then
@ -265,7 +266,8 @@ local function do_tile(param, orientation)
if not data[0] then if not data[0] then
data[0] = {} data[0] = {}
end end
coord = coord + tile_group(gs, cls, wa, orientation, data[0], {first=1, last=nmaster, coord = coord, size = size}) coord = coord + tile_group(gs, cls, wa, orientation, data[0],
{first=1, last=nmaster, coord = coord, size = size})
end end
if not place_master and nother > 0 then if not place_master and nother > 0 then
@ -285,7 +287,8 @@ local function do_tile(param, orientation)
if not data[i] then if not data[i] then
data[i] = {} data[i] = {}
end end
coord = coord + tile_group(gs, cls, wa, orientation, data[i], { first = first, last = last, coord = coord, size = size }) coord = coord + tile_group(gs, cls, wa, orientation, data[i],
{ first = first, last = last, coord = coord, size = size })
end end
end end
place_master = not place_master place_master = not place_master

View File

@ -632,8 +632,10 @@ end
--- Create a menu popup. --- Create a menu popup.
-- @param args Table containing the menu informations. -- @param args Table containing the menu informations.
-- --
-- * Key items: Table containing the displayed items. Each element is a table by default (when element 'new' is awful.menu.entry) containing: item name, triggered action, submenu table or function, item icon (optional). -- * Key items: Table containing the displayed items. Each element is a table by default (when element 'new' is
-- * Keys theme.[fg|bg]_[focus|normal], theme.border_color, theme.border_width, theme.submenu_icon, theme.height and theme.width override the default display for your menu and/or of your menu entry, each of them are optional. -- awful.menu.entry) containing: item name, triggered action, submenu table or function, item icon (optional).
-- * Keys theme.[fg|bg]_[focus|normal], theme.border_color, theme.border_width, theme.submenu_icon, theme.height
-- and theme.width override the default display for your menu and/or of your menu entry, each of them are optional.
-- * Key auto_expand controls the submenu auto expand behaviour by setting it to true (default) or false. -- * Key auto_expand controls the submenu auto expand behaviour by setting it to true (default) or false.
-- --
-- @param parent Specify the parent menu if we want to open a submenu, this value should never be set by the user. -- @param parent Specify the parent menu if we want to open a submenu, this value should never be set by the user.

View File

@ -1,3 +1,5 @@
--luacheck: no max line length
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
--- Spawning of programs. --- Spawning of programs.
-- --

View File

@ -471,7 +471,9 @@ end
--- Create a new minimize button for a client. --- Create a new minimize button for a client.
-- @param c The client for which the button is wanted. -- @param c The client for which the button is wanted.
function titlebar.widget.minimizebutton(c) function titlebar.widget.minimizebutton(c)
local widget = titlebar.widget.button(c, "minimize", function() return "" end, function(cl) cl.minimized = not cl.minimized end) local widget = titlebar.widget.button(c, "minimize",
function() return "" end,
function(cl) cl.minimized = not cl.minimized end)
c:connect_signal("property::minimized", widget.update) c:connect_signal("property::minimized", widget.update)
return widget return widget
end end
@ -485,7 +487,9 @@ end
--- Create a new ontop button for a client. --- Create a new ontop button for a client.
-- @param c The client for which the button is wanted. -- @param c The client for which the button is wanted.
function titlebar.widget.ontopbutton(c) function titlebar.widget.ontopbutton(c)
local widget = titlebar.widget.button(c, "ontop", function(cl) return cl.ontop end, function(cl, state) cl.ontop = not state end) local widget = titlebar.widget.button(c, "ontop",
function(cl) return cl.ontop end,
function(cl, state) cl.ontop = not state end)
c:connect_signal("property::ontop", widget.update) c:connect_signal("property::ontop", widget.update)
return widget return widget
end end
@ -493,7 +497,9 @@ end
--- Create a new sticky button for a client. --- Create a new sticky button for a client.
-- @param c The client for which the button is wanted. -- @param c The client for which the button is wanted.
function titlebar.widget.stickybutton(c) function titlebar.widget.stickybutton(c)
local widget = titlebar.widget.button(c, "sticky", function(cl) return cl.sticky end, function(cl, state) cl.sticky = not state end) local widget = titlebar.widget.button(c, "sticky",
function(cl) return cl.sticky end,
function(cl, state) cl.sticky = not state end)
c:connect_signal("property::sticky", widget.update) c:connect_signal("property::sticky", widget.update)
return widget return widget
end end

View File

@ -145,7 +145,8 @@ function util.escape(text)
return text and text:gsub("['&<>\"]", xml_entity_names) or nil return text and text:gsub("['&<>\"]", xml_entity_names) or nil
end end
local xml_entity_chars = { lt = "<", gt = ">", nbsp = " ", quot = "\"", apos = "'", ndash = "-", mdash = "-", amp = "&" }; local xml_entity_chars = { lt = "<", gt = ">", nbsp = " ", quot = "\"", apos = "'", ndash = "-", mdash = "-",
amp = "&" };
--- Unescape a string from entities. --- Unescape a string from entities.
-- @param text Text to unescape. -- @param text Text to unescape.
-- @return Unescaped text. -- @return Unescaped text.

View File

@ -45,7 +45,8 @@ function button.new(args)
orig_set_image(self, img_release) orig_set_image(self, img_release)
end end
w:set_image(args.image) w:set_image(args.image)
w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end, function () orig_set_image(w, img_release) end)) w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end,
function () orig_set_image(w, img_release) end))
w:connect_signal("mouse::leave", function(self) orig_set_image(self, img_release) end) w:connect_signal("mouse::leave", function(self) orig_set_image(self, img_release) end)

View File

@ -210,7 +210,8 @@ local function tasklist_label(c, args, tb)
local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus or bg_normal local bg_focus = args.bg_focus or theme.tasklist_bg_focus or theme.bg_focus or bg_normal
local fg_urgent = util.ensure_pango_color(args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent, fg_normal) local fg_urgent = util.ensure_pango_color(args.fg_urgent or theme.tasklist_fg_urgent or theme.fg_urgent, fg_normal)
local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent or bg_normal local bg_urgent = args.bg_urgent or theme.tasklist_bg_urgent or theme.bg_urgent or bg_normal
local fg_minimize = util.ensure_pango_color(args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize, fg_normal) local fg_minimize = util.ensure_pango_color(args.fg_minimize or theme.tasklist_fg_minimize or theme.fg_minimize,
fg_normal)
local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize or bg_normal local bg_minimize = args.bg_minimize or theme.tasklist_bg_minimize or theme.bg_minimize or bg_normal
-- FIXME v5, remove the fallback theme.bg_image_* variables, see GH#1403 -- FIXME v5, remove the fallback theme.bg_image_* variables, see GH#1403
local bg_image_normal = args.bg_image_normal or theme.tasklist_bg_image_normal or theme.bg_image_normal local bg_image_normal = args.bg_image_normal or theme.tasklist_bg_image_normal or theme.bg_image_normal

View File

@ -111,7 +111,10 @@ end
-- @return item name, item background color, background image, item icon. -- @return item name, item background color, background image, item icon.
local function label(o) local function label(o)
if o.focused then if o.focused then
return colortext(o.name, (theme.menu_fg_focus or theme.fg_focus)), (theme.menu_bg_focus or theme.bg_focus), nil, o.icon return colortext(o.name, (theme.menu_fg_focus or theme.fg_focus)),
(theme.menu_bg_focus or theme.bg_focus),
nil,
o.icon
else else
return o.name, (theme.menu_bg_normal or theme.bg_normal), nil, o.icon return o.name, (theme.menu_bg_normal or theme.bg_normal), nil, o.icon
end end

View File

@ -6,6 +6,8 @@
-- @module naughty -- @module naughty
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
--luacheck: no max line length
-- Package environment -- Package environment
local pairs = pairs local pairs = pairs
local table = table local table = table

View File

@ -105,98 +105,99 @@ local function convert_icon(w, h, rowstride, channels, data)
return cairo.ImageSurface.create_for_data(tcat(rows), format, w, h, stride) return cairo.ImageSurface.create_for_data(tcat(rows), format, w, h, stride)
end end
capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire) capi.dbus.connect_signal("org.freedesktop.Notifications",
local args = { } function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
if data.member == "Notify" then local args = { }
if text ~= "" then if data.member == "Notify" then
args.text = text if text ~= "" then
if title ~= "" then args.text = text
args.title = title if title ~= "" then
end args.title = title
else end
if title ~= "" then
args.text = title
else else
return if title ~= "" then
args.text = title
else
return
end
end end
end if appname ~= "" then
if appname ~= "" then args.appname = appname
args.appname = appname
end
for _, obj in pairs(dbus.config.mapping) do
local filter, preset = obj[1], obj[2]
if (not filter.urgency or filter.urgency == hints.urgency) and
(not filter.category or filter.category == hints.category) and
(not filter.appname or filter.appname == appname) then
args.preset = util.table.join(args.preset, preset)
end end
end for _, obj in pairs(dbus.config.mapping) do
local preset = args.preset or naughty.config.defaults local filter, preset = obj[1], obj[2]
local notification if (not filter.urgency or filter.urgency == hints.urgency) and
if actions then (not filter.category or filter.category == hints.category) and
args.actions = {} (not filter.appname or filter.appname == appname) then
args.preset = util.table.join(args.preset, preset)
end
end
local preset = args.preset or naughty.config.defaults
local notification
if actions then
args.actions = {}
for i = 1,#actions,2 do for i = 1,#actions,2 do
local action_id = actions[i] local action_id = actions[i]
local action_text = actions[i + 1] local action_text = actions[i + 1]
if action_id == "default" then if action_id == "default" then
args.run = function() args.run = function()
sendActionInvoked(notification.id, "default") sendActionInvoked(notification.id, "default")
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser) naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
end end
elseif action_id ~= nil and action_text ~= nil then elseif action_id ~= nil and action_text ~= nil then
args.actions[action_text] = function() args.actions[action_text] = function()
sendActionInvoked(notification.id, action_id) sendActionInvoked(notification.id, action_id)
naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser) naughty.destroy(notification, naughty.notificationClosedReason.dismissedByUser)
end
end end
end end
end end
end args.destroy = function(reason)
args.destroy = function(reason) sendNotificationClosed(notification.id, reason)
sendNotificationClosed(notification.id, reason) end
end if not preset.callback or (type(preset.callback) == "function" and
if not preset.callback or (type(preset.callback) == "function" and preset.callback(data, appname, replaces_id, icon, title, text, actions, hints, expire)) then
preset.callback(data, appname, replaces_id, icon, title, text, actions, hints, expire)) then if icon ~= "" then
if icon ~= "" then args.icon = icon
args.icon = icon elseif hints.icon_data or hints.image_data then
elseif hints.icon_data or hints.image_data then if hints.icon_data == nil then hints.icon_data = hints.image_data end
if hints.icon_data == nil then hints.icon_data = hints.image_data end
-- icon_data is an array: -- icon_data is an array:
-- 1 -> width -- 1 -> width
-- 2 -> height -- 2 -> height
-- 3 -> rowstride -- 3 -> rowstride
-- 4 -> has alpha -- 4 -> has alpha
-- 5 -> bits per sample -- 5 -> bits per sample
-- 6 -> channels -- 6 -> channels
-- 7 -> data -- 7 -> data
local w, h, rowstride, _, _, channels, icon_data = unpack(hints.icon_data) local w, h, rowstride, _, _, channels, icon_data = unpack(hints.icon_data)
args.icon = convert_icon(w, h, rowstride, channels, icon_data) args.icon = convert_icon(w, h, rowstride, channels, icon_data)
end
if replaces_id and replaces_id ~= "" and replaces_id ~= 0 then
args.replaces_id = replaces_id
end
if expire and expire > -1 then
args.timeout = expire / 1000
end
notification = naughty.notify(args)
return "u", notification.id
end end
if replaces_id and replaces_id ~= "" and replaces_id ~= 0 then return "u", "0"
args.replaces_id = replaces_id elseif data.member == "CloseNotification" then
local obj = naughty.getById(appname)
if obj then
naughty.destroy(obj, naughty.notificationClosedReason.dismissedByCommand)
end end
if expire and expire > -1 then elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
args.timeout = expire / 1000 -- name of notification app, name of vender, version, specification version
end return "s", "naughty", "s", "awesome", "s", capi.awesome.version, "s", "1.0"
notification = naughty.notify(args) elseif data.member == "GetCapabilities" then
return "u", notification.id -- We actually do display the body of the message, we support <b>, <i>
-- and <u> in the body and we handle static (non-animated) icons.
return "as", { "s", "body", "s", "body-markup", "s", "icon-static", "s", "actions" }
end end
return "u", "0"
elseif data.member == "CloseNotification" then
local obj = naughty.getById(appname)
if obj then
naughty.destroy(obj, naughty.notificationClosedReason.dismissedByCommand)
end
elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
-- name of notification app, name of vender, version, specification version
return "s", "naughty", "s", "awesome", "s", capi.awesome.version, "s", "1.0"
elseif data.member == "GetCapabilities" then
-- We actually do display the body of the message, we support <b>, <i>
-- and <u> in the body and we handle static (non-animated) icons.
return "as", { "s", "body", "s", "body-markup", "s", "icon-static", "s", "actions" }
end
end) end)
capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable", function (data) capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable", function (data)

View File

@ -127,7 +127,11 @@ local function calculate_info(self, context, width, height)
local x, y = 0, 0 local x, y = 0, 0
local function get_scroll_offset(size, visible_size) local function get_scroll_offset(size, visible_size)
return self._private.step_function(self._private.timer:elapsed(), size, visible_size, self._private.speed, self._private.extra_space) return self._private.step_function(self._private.timer:elapsed(),
size,
visible_size,
self._private.speed,
self._private.extra_space)
end end
if self._private.dir == "h" then if self._private.dir == "h" then
x = -get_scroll_offset(surface_width - extra, width) x = -get_scroll_offset(surface_width - extra, width)

View File

@ -76,7 +76,11 @@ local function widget_layout(state, arguments)
return false return false
end end
say:set("assertion.widget_layout.positive", "Expected:\n%s\nbut got:\n%s\nwhen offering (%s, %s) to widget") say:set("assertion.widget_layout.positive", "Expected:\n%s\nbut got:\n%s\nwhen offering (%s, %s) to widget")
assert:register("assertion", "widget_layout", widget_layout, "assertion.widget_layout.positive", "assertion.widget_layout.positive") assert:register("assertion",
"widget_layout",
widget_layout,
"assertion.widget_layout.positive",
"assertion.widget_layout.positive")
-- }}} -- }}}
return { return {

View File

@ -8,7 +8,8 @@ local create_wibox = require("_wibox_helper").create_wibox
local BENCHMARK_EXACT = os.getenv("BENCHMARK_EXACT") local BENCHMARK_EXACT = os.getenv("BENCHMARK_EXACT")
if not BENCHMARK_EXACT then if not BENCHMARK_EXACT then
print("Doing quick and inexact measurements. Set BENCHMARK_EXACT=1 as an environment variable when you actually want to look at the results.") print("Doing quick and inexact measurements. Set BENCHMARK_EXACT=1 as an "..
"environment variable when you actually want to look at the results.")
end end
local measure, benchmark local measure, benchmark