From dad7f209fadec6cd271125c2b0f9d77791090852 Mon Sep 17 00:00:00 2001 From: onde2rock Date: Sun, 29 Apr 2018 15:15:11 +0200 Subject: [PATCH] [CI] Add a check to detect tab in lua files (#3919) --- .ci/check.sh | 7 +++++++ frontend/apps/reader/modules/readerdictionary.lua | 4 ++-- frontend/device/pocketbook/device.lua | 4 ++-- plugins/newsdownloader.koplugin/feed_config.lua | 14 +++++++------- plugins/statistics.koplugin/main.lua | 2 +- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.ci/check.sh b/.ci/check.sh index 143812607..8a9a20702 100755 --- a/.ci/check.sh +++ b/.ci/check.sh @@ -21,5 +21,12 @@ if [ "${unscaled_size_check}" ] || [ "${unscaled_size_check_geom}" ]; then exit 1 fi +tab_detected=$(grep -P "\\t" --include \*.lua --exclude={dateparser.lua,xml.lua} --recursive {reader,setupkoenv,datastorage}.lua frontend plugins spec || true) +if [ "${tab_detected}" ]; then + echo -e "\\n${ANSI_RED}Error TAB character detected" + echo "${tab_detected}" + exit 1 +fi + echo -e "\n${ANSI_GREEN}Luacheck results" luajit "$(which luacheck)" --no-color -q {reader,setupkoenv,datastorage}.lua frontend plugins spec diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index f07c0b3b0..7cbfb32e5 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -80,8 +80,8 @@ end -- HTML quality) in a file named as the .ifo with a .lua -- extension, containing for example: -- return function(html) --- html = html:gsub("
", "
") --- return html +-- html = html:gsub("
", "
") +-- return html -- end local function getDictionaryFixHtmlFunc(path) if lfs.attributes(path, "mode") == "file" then diff --git a/frontend/device/pocketbook/device.lua b/frontend/device/pocketbook/device.lua index a27d28455..e7e47b60e 100644 --- a/frontend/device/pocketbook/device.lua +++ b/frontend/device/pocketbook/device.lua @@ -34,8 +34,8 @@ local KEY_HOME = 0x1a local KEY_BACK = 0x1b local KEY_PREV2 = 0x1c local KEY_NEXT2 = 0x1d -local KEY_COVEROPEN = 0x02 -local KEY_COVERCLOSE = 0x03 +local KEY_COVEROPEN = 0x02 +local KEY_COVERCLOSE = 0x03 -- luacheck: pop ffi.cdef[[ diff --git a/plugins/newsdownloader.koplugin/feed_config.lua b/plugins/newsdownloader.koplugin/feed_config.lua index 6d3b643c1..c8f1c85e2 100644 --- a/plugins/newsdownloader.koplugin/feed_config.lua +++ b/plugins/newsdownloader.koplugin/feed_config.lua @@ -1,11 +1,11 @@ return { - -- list your feeds here: + -- list your feeds here: { "http://feeds.reuters.com/Reuters/worldNews?format=xml", limit = 2, download_full_article=true}, { "https://www.pcworld.com/index.rss", limit = 7 , download_full_article=false}, - -- comment out line ("--" at line start) to stop downloading source + -- comment out line ("--" at line start) to stop downloading source --{ "http://www.football.co.uk/international/rss.xml", limit = 0 , download_full_article=false}, @@ -14,14 +14,14 @@ return { - --HELP: - -- use syntax: {"your_url", limit= max_number_of_items_to_be_created, download_full_article=true/false} + --HELP: + -- use syntax: {"your_url", limit= max_number_of_items_to_be_created, download_full_article=true/false} - -- set 'limit' to change number of 'news' to be created + -- set 'limit' to change number of 'news' to be created -- 'limit' equal "0" means no limit. - -- 'download_full_article=false' - means download full article using feed link (may not always work correctly) - -- 'download_full_article=true' - means use only feed description to create feeds (usually only part of the article) + -- 'download_full_article=false' - means download full article using feed link (may not always work correctly) + -- 'download_full_article=true' - means use only feed description to create feeds (usually only part of the article) } diff --git a/plugins/statistics.koplugin/main.lua b/plugins/statistics.koplugin/main.lua index e265d27e2..8d7032a67 100755 --- a/plugins/statistics.koplugin/main.lua +++ b/plugins/statistics.koplugin/main.lua @@ -877,7 +877,7 @@ function ReaderStatistics:getTodayBookStats() FROM page_stat WHERE start_time >= '%s' GROUP BY id_book, page - ) + ) ]] local today_pages, today_period = conn:rowexec(string.format(sql_stmt, start_today_time)) if today_pages == nil then