build: enforce luacheck in travis build

pull/1804/head
Qingping Hou 8 years ago
parent b8ee33871f
commit 9bd2d42834

@ -90,3 +90,7 @@ read_globals = {
"lfs", "lfs",
"lipc", "lipc",
} }
exclude_files = {
"frontend/luxl.lua",
}

@ -61,6 +61,7 @@ install:
# luasec doesn't automatically detect 64-bit libs # luasec doesn't automatically detect 64-bit libs
- travis_retry luarocks --local install luasec OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu - travis_retry luarocks --local install luasec OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu
- travis_retry luarocks --local install luacov-coveralls --server=http://rocks.moonscript.org/dev - travis_retry luarocks --local install luacov-coveralls --server=http://rocks.moonscript.org/dev
- travis_retry luarocks --local install luacheck
# add local rocks to $PATH # add local rocks to $PATH
- eval $(luarocks path --bin) - eval $(luarocks path --bin)
@ -68,6 +69,8 @@ script:
- travis_retry make fetchthirdparty - travis_retry make fetchthirdparty
- make all - make all
- travis_retry make testfront - travis_retry make testfront
- luacheck --no-color -q frontend | tee ./luacheck.out
- test $(grep Total ./luacheck.out | awk '{print $2}') -le 250
after_success: after_success:
- make coverage - make coverage

@ -144,7 +144,7 @@ local function MD5Update(ctx, buf, len)
t = band(rshift(t, 3), 0x3f) t = band(rshift(t, 3), 0x3f)
if (t > 0) then if (t > 0) then
p = ffi.cast("unsigned char *", ctx.input + t) local p = ffi.cast("unsigned char *", ctx.input + t)
t = 64 - t t = 64 - t
if (len < t) then if (len < t) then

@ -1,10 +1,6 @@
local ReaderDictionary = require("apps/reader/modules/readerdictionary") local ReaderDictionary = require("apps/reader/modules/readerdictionary")
local EventListener = require("ui/widget/eventlistener")
local NetworkMgr = require("ui/networkmgr")
local Translator = require("ui/translator") local Translator = require("ui/translator")
local Wikipedia = require("ui/wikipedia") local Wikipedia = require("ui/wikipedia")
local UIManager = require("ui/uimanager")
local Geom = require("ui/geometry")
local Screen = require("device").screen local Screen = require("device").screen
local DEBUG = require("dbg") local DEBUG = require("dbg")
local _ = require("gettext") local _ = require("gettext")

@ -10,16 +10,15 @@ end
function Configurable:reset() function Configurable:reset()
for key,value in pairs(self) do for key,value in pairs(self) do
if type(value) == "number" or type(value) == "string" then if type(value) == "number" or type(value) == "string" then
self[key] = nil self[key] = nil
end end
end end
end end
function Configurable:hash(sep) function Configurable:hash(sep)
local hash = "" local hash = ""
local excluded = {multi_threads = true,}
for key,value in pairs(self) do for key,value in pairs(self) do
if type(value) == "number" or type(value) == "string" then if type(value) == "number" or type(value) == "string" then
hash = hash..sep..value hash = hash..sep..value
end end
end end
@ -31,13 +30,13 @@ function Configurable:loadDefaults(config_options)
self:reset() self:reset()
for i=1,#config_options do for i=1,#config_options do
local options = config_options[i].options local options = config_options[i].options
for j=1,#config_options[i].options do for j=1,#options do
local key = config_options[i].options[j].name local key = options[j].name
local settings_key = config_options.prefix.."_"..key local settings_key = config_options.prefix.."_"..key
local default = G_reader_settings:readSetting(settings_key) local default = G_reader_settings:readSetting(settings_key)
self[key] = default or config_options[i].options[j].default_value self[key] = default or options[j].default_value
if not self[key] then if not self[key] then
self[key] = config_options[i].options[j].default_arg self[key] = options[j].default_arg
end end
end end
end end
@ -49,7 +48,7 @@ function Configurable:loadSettings(settings, prefix)
or type(value) == "table" then or type(value) == "table" then
local saved_value = settings:readSetting(prefix..key) local saved_value = settings:readSetting(prefix..key)
self[key] = (saved_value == nil) and self[key] or saved_value self[key] = (saved_value == nil) and self[key] or saved_value
--Debug("Configurable:loadSettings", "key", key, "saved value", --Debug("Configurable:loadSettings", "key", key, "saved value",
--saved_value,"Configurable.key", self[key]) --saved_value,"Configurable.key", self[key])
end end
end end

@ -27,9 +27,10 @@ local function probeDevice()
end end
-- add new ports here: -- add new ports here:
if --[[ implement a proper test instead --]] false then --
return require("device/newport/device") -- if --[[ implement a proper test instead --]] false then
end -- return require("device/newport/device")
-- end
error("did not find a hardware abstraction for this platform") error("did not find a hardware abstraction for this platform")
end end

@ -30,8 +30,8 @@ function DocSettings:getNameFromHistory(hist_name)
end end
function DocSettings:open(docfile) function DocSettings:open(docfile)
local history_path = nil local history_path
local sidecar_path = nil local sidecar_path
if docfile == ".reader" then if docfile == ".reader" then
-- we handle reader setting as special case -- we handle reader setting as special case
history_path = DataStorage:getDataDir() .. "/settings.reader.lua" history_path = DataStorage:getDataDir() .. "/settings.reader.lua"

@ -1,5 +1,4 @@
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local DEBUG = require("dbg")
local HTTPClient = { local HTTPClient = {
input_timeouts = 0, input_timeouts = 0,

Loading…
Cancel
Save