From ea033431aa73f7028f5f0c6091817a7122c06b7e Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sun, 8 Oct 2017 16:33:59 +0200 Subject: [PATCH] CircleCI fixes * shellcheck 0.4.5 fix `LC_ALL: en_US.UTF8` (can be removed for shellcheck 0.4.6) * hush updated luacheck on `reader.lua`; we're not assigning any variables but `= nil` is redundant --- .ci/check.sh | 6 +++--- .circleci/config.yml | 2 ++ reader.lua | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.ci/check.sh b/.ci/check.sh index cc5d6fcb4..143812607 100755 --- a/.ci/check.sh +++ b/.ci/check.sh @@ -9,13 +9,13 @@ echo -e "\n${ANSI_GREEN}shellcheck results" echo -e "\\n${ANSI_GREEN}Checking for unscaled sizes" # stick `|| true` at the end to prevent Travis exit on failed command -unscaled_size_check=$(grep -nr --include=*.lua --exclude=koptoptions.lua --exclude-dir=base --exclude-dir=install --exclude-dir=keyboardlayouts --exclude-dir=*arm* "\\(padding\\|margin\\|bordersize\\|width\\|height\\|radius\\|linesize\\) = [0-9]\\{1,2\\}" | grep -v '= 0' | grep -v '= [0-9]/[0-9]' | grep -Ev '(default_option_height|default_option_padding)' | grep -v scaleBySize || true) +unscaled_size_check=$(grep -nr --include=*.lua --exclude=koptoptions.lua --exclude-dir=base --exclude-dir=luajit-rocks --exclude-dir=install --exclude-dir=keyboardlayouts --exclude-dir=*arm* "\\(padding\\|margin\\|bordersize\\|width\\|height\\|radius\\|linesize\\) = [0-9]\\{1,2\\}" | grep -v '= 0' | grep -v '= [0-9]/[0-9]' | grep -Ev '(default_option_height|default_option_padding)' | grep -v scaleBySize || true) # Also check Geom objects; for legibility two regular expressions rather than # one enormous indecipharable blob. -unscaled_size_check_geom=$(grep -E -nr --include=*.lua --exclude=gesturerange_spec.lua --exclude-dir=base --exclude-dir=*arm* 'Geom:new{.+ [wh] = [0-9]{1,4}' | grep -Ev '[wh] = 0' | grep -v '= [0-9]/[0-9]' | grep -v scaleBySize || true) +unscaled_size_check_geom=$(grep -E -nr --include=*.lua --exclude=gesturerange_spec.lua --exclude-dir=base --exclude-dir=luajit-rocks --exclude-dir=*arm* 'Geom:new{.+ [wh] = [0-9]{1,4}' | grep -Ev '[wh] = 0' | grep -v '= [0-9]/[0-9]' | grep -v scaleBySize || true) if [ "${unscaled_size_check}" ] || [ "${unscaled_size_check_geom}" ]; then - echo -e "\\n${ANSI_RED}Warning: it looks like you might be using unscaled sizes.\\nIt is almost always preferable to defer to one of the predefined sizes in ui.elements.commonui in the following files:" + echo -e "\\n${ANSI_RED}Warning: it looks like you might be using unscaled sizes.\\nIt is almost always preferable to defer to one of the predefined sizes in ui.size in the following files:" echo "${unscaled_size_check}" echo "${unscaled_size_check_geom}" exit 1 diff --git a/.circleci/config.yml b/.circleci/config.yml index 75e14f889..c6573922c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,6 +5,8 @@ jobs: - image: houqp/kobase:0.0.5 environment: EMULATE_READER: 1 + # this is for shellcheck 0.4.5 and lower; can be removed for 0.4.6 + LC_ALL: en_US.UTF8 steps: - checkout - restore_cache: diff --git a/reader.lua b/reader.lua index 8d9cb51a8..c850464bc 100755 --- a/reader.lua +++ b/reader.lua @@ -153,10 +153,10 @@ if Device.hasColorScreen() and not G_reader_settings:has("color_rendering") then }) end -local exit_code = nil +local exit_code if ARGV[argidx] and ARGV[argidx] ~= "" then - local file = nil + local file if lfs.attributes(ARGV[argidx], "mode") == "file" then file = ARGV[argidx] elseif open_last and last_file then