Browse Source

build: enforce luacheck in travis build

pull/1804/head
Qingping Hou 5 years ago
parent
commit
9bd2d42834
8 changed files with 21 additions and 19 deletions
  1. +4
    -0
      .luacheckrc
  2. +3
    -0
      .travis.yml
  3. +1
    -1
      frontend/MD5.lua
  4. +0
    -4
      frontend/apps/reader/modules/readerwikipedia.lua
  5. +7
    -8
      frontend/configurable.lua
  6. +4
    -3
      frontend/device.lua
  7. +2
    -2
      frontend/docsettings.lua
  8. +0
    -1
      frontend/httpclient.lua

+ 4
- 0
.luacheckrc View File

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

+ 3
- 0
.travis.yml View File

@ -61,6 +61,7 @@ install:
# 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 luacov-coveralls --server=http://rocks.moonscript.org/dev
- travis_retry luarocks --local install luacheck
# add local rocks to $PATH
- eval $(luarocks path --bin)
@ -68,6 +69,8 @@ script:
- travis_retry make fetchthirdparty
- make all
- travis_retry make testfront
- luacheck --no-color -q frontend | tee ./luacheck.out
- test $(grep Total ./luacheck.out | awk '{print $2}') -le 250
after_success:
- make coverage

+ 1
- 1
frontend/MD5.lua View File

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

+ 0
- 4
frontend/apps/reader/modules/readerwikipedia.lua View File

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

+ 7
- 8
frontend/configurable.lua View File

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

+ 4
- 3
frontend/device.lua View File

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

+ 2
- 2
frontend/docsettings.lua View File

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

+ 0
- 1
frontend/httpclient.lua View File

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

Loading…
Cancel
Save