mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
minore: more static check fixes
This commit is contained in:
@@ -71,7 +71,7 @@ script:
|
||||
- make all
|
||||
- travis_retry make testfront
|
||||
- luajit $(which luacheck) --no-color -q frontend | tee ./luacheck.out
|
||||
- test $(grep Total ./luacheck.out | awk '{print $2}') -le 250
|
||||
- test $(grep Total ./luacheck.out | awk '{print $2}') -le 238
|
||||
|
||||
after_success:
|
||||
- make coverage
|
||||
|
||||
2
Makefile
2
Makefile
@@ -321,7 +321,7 @@ po:
|
||||
$(MAKE) -i -C l10n bootstrap pull
|
||||
|
||||
static-check:
|
||||
@if which luacheck > /dev/null; then luacheck frontend; else \
|
||||
@if which luacheck > /dev/null; then luacheck -q frontend; else \
|
||||
echo "[!] luacheck not found. "\
|
||||
"you can install it with 'luarocks install luacheck'"; fi
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ local FocusManager = require("ui/widget/focusmanager")
|
||||
local LineWidget = require("ui/widget/linewidget")
|
||||
local Blitbuffer = require("ffi/blitbuffer")
|
||||
local Button = require("ui/widget/button")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Geom = require("ui/geometry")
|
||||
local Device = require("device")
|
||||
local Screen = Device.screen
|
||||
|
||||
@@ -7,12 +7,9 @@ local ImageWidget = require("ui/widget/imagewidget")
|
||||
local TextBoxWidget = require("ui/widget/textboxwidget")
|
||||
local HorizontalSpan = require("ui/widget/horizontalspan")
|
||||
local ButtonTable = require("ui/widget/buttontable")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Device = require("device")
|
||||
local Geom = require("ui/geometry")
|
||||
local Input = require("device").input
|
||||
local Screen = require("device").screen
|
||||
local Screen = Device.screen
|
||||
local Font = require("ui/font")
|
||||
local DEBUG = require("dbg")
|
||||
local _ = require("gettext")
|
||||
|
||||
@@ -9,10 +9,11 @@ local BottomContainer = WidgetContainer:new()
|
||||
|
||||
function BottomContainer:paintTo(bb, x, y)
|
||||
local contentSize = self[1]:getSize()
|
||||
if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- FIXME
|
||||
-- if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- throw error? paint to scrap buffer and blit partially?
|
||||
-- for now, we ignore this
|
||||
end
|
||||
-- end
|
||||
self[1]:paintTo(bb,
|
||||
x + math.floor((self.dimen.w - contentSize.w)/2),
|
||||
y + (self.dimen.h - contentSize.h))
|
||||
|
||||
@@ -7,10 +7,11 @@ local CenterContainer = WidgetContainer:new()
|
||||
|
||||
function CenterContainer:paintTo(bb, x, y)
|
||||
local content_size = self[1]:getSize()
|
||||
if content_size.w > self.dimen.w or content_size.h > self.dimen.h then
|
||||
-- FIXME
|
||||
-- if content_size.w > self.dimen.w or content_size.h > self.dimen.h then
|
||||
-- throw error? paint to scrap buffer and blit partially?
|
||||
-- for now, we ignore this
|
||||
end
|
||||
-- end
|
||||
local x_pos = x
|
||||
local y_pos = y
|
||||
if self.ignore ~= "height" then
|
||||
|
||||
@@ -7,10 +7,11 @@ local LeftContainer = WidgetContainer:new()
|
||||
|
||||
function LeftContainer:paintTo(bb, x, y)
|
||||
local contentSize = self[1]:getSize()
|
||||
if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- FIXME
|
||||
-- if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- throw error? paint to scrap buffer and blit partially?
|
||||
-- for now, we ignore this
|
||||
end
|
||||
-- end
|
||||
self[1]:paintTo(bb, x , y + math.floor((self.dimen.h - contentSize.h)/2))
|
||||
end
|
||||
|
||||
|
||||
@@ -7,10 +7,11 @@ local RightContainer = WidgetContainer:new()
|
||||
|
||||
function RightContainer:paintTo(bb, x, y)
|
||||
local contentSize = self[1]:getSize()
|
||||
if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- FIXME
|
||||
-- if contentSize.w > self.dimen.w or contentSize.h > self.dimen.h then
|
||||
-- throw error? paint to scrap buffer and blit partially?
|
||||
-- for now, we ignore this
|
||||
end
|
||||
-- end
|
||||
self[1]:paintTo(bb,
|
||||
x + (self.dimen.w - contentSize.w),
|
||||
y + math.floor((self.dimen.h - contentSize.h)/2))
|
||||
|
||||
@@ -5,7 +5,6 @@ local CenterContainer = require("ui/widget/container/centercontainer")
|
||||
local LeftContainer = require("ui/widget/container/leftcontainer")
|
||||
local ScrollTextWidget = require("ui/widget/scrolltextwidget")
|
||||
local VerticalGroup = require("ui/widget/verticalgroup")
|
||||
local TextBoxWidget = require("ui/widget/textboxwidget")
|
||||
local OverlapGroup = require("ui/widget/overlapgroup")
|
||||
local CloseButton = require("ui/widget/closebutton")
|
||||
local ButtonTable = require("ui/widget/buttontable")
|
||||
|
||||
@@ -7,8 +7,8 @@ will call a method "onEventName" for an event with name
|
||||
--]]
|
||||
local EventListener = {}
|
||||
|
||||
function EventListener:new(o)
|
||||
local o = o or {}
|
||||
function EventListener:new(new_o)
|
||||
local o = new_o or {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
if o.init then o:init() end
|
||||
|
||||
@@ -168,7 +168,7 @@ end
|
||||
|
||||
function OPDSBrowser:genItemTableFromRoot()
|
||||
local item_table = {}
|
||||
for i, server in ipairs(self.opds_servers) do
|
||||
for _, server in ipairs(self.opds_servers) do
|
||||
table.insert(item_table, {
|
||||
text = server.title,
|
||||
content = server.subtitle,
|
||||
@@ -176,7 +176,7 @@ function OPDSBrowser:genItemTableFromRoot()
|
||||
})
|
||||
end
|
||||
local added_servers = G_reader_settings:readSetting("opds_servers") or {}
|
||||
for i, server in ipairs(added_servers) do
|
||||
for _, server in ipairs(added_servers) do
|
||||
table.insert(item_table, {
|
||||
text = server.title,
|
||||
content = server.subtitle,
|
||||
@@ -375,7 +375,7 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
|
||||
end
|
||||
local hrefs = {}
|
||||
if feed.link then
|
||||
for i, link in ipairs(feed.link) do
|
||||
for _, link in ipairs(feed.link) do
|
||||
if link.type:find(self.catalog_type) or
|
||||
link.type:find(self.search_type) then
|
||||
if link.rel and link.href then
|
||||
@@ -386,11 +386,11 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url)
|
||||
end
|
||||
item_table.hrefs = hrefs
|
||||
if feed.entry then
|
||||
for i, entry in ipairs(feed.entry) do
|
||||
for _, entry in ipairs(feed.entry) do
|
||||
local item = {}
|
||||
item.acquisitions = {}
|
||||
if entry.link then
|
||||
for i, link in ipairs(entry.link) do
|
||||
for _, link in ipairs(entry.link) do
|
||||
if link.type:find(self.catalog_type) and (not link.rel or link.rel == "subsection" or link.rel == "http://opds-spec.org/sort/popular" or link.rel == "http://opds-spec.org/sort/new") then
|
||||
item.url = build_href(link.href)
|
||||
end
|
||||
@@ -451,7 +451,7 @@ end
|
||||
|
||||
function OPDSBrowser:appendCatalog(item_table_url)
|
||||
local new_table = self:genItemTableFromURL(item_table_url)
|
||||
for i, item in ipairs(new_table) do
|
||||
for _, item in ipairs(new_table) do
|
||||
table.insert(self.item_table, item)
|
||||
end
|
||||
self.item_table.hrefs = new_table.hrefs
|
||||
@@ -566,7 +566,7 @@ end
|
||||
function OPDSBrowser:editServerFromInput(item, fields)
|
||||
DEBUG("input catalog", fields)
|
||||
local servers = {}
|
||||
for i, server in ipairs(G_reader_settings:readSetting("opds_servers") or {}) do
|
||||
for _, server in ipairs(G_reader_settings:readSetting("opds_servers") or {}) do
|
||||
if server.title == item.text or server.url == item.url then
|
||||
server.title = fields[1]
|
||||
server.url = (fields[2]:match("^%a+://") and fields[2] or "http://" .. fields[2])
|
||||
@@ -620,7 +620,7 @@ end
|
||||
function OPDSBrowser:deleteOPDSServer(item)
|
||||
DEBUG("delete", item)
|
||||
local servers = {}
|
||||
for i, server in ipairs(G_reader_settings:readSetting("opds_servers") or {}) do
|
||||
for _, server in ipairs(G_reader_settings:readSetting("opds_servers") or {}) do
|
||||
if server.title ~= item.text or server.url ~= item.url then
|
||||
table.insert(servers, server)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user