From 3c414f2dbd76cc911e902d360a48c3a2925249a4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 30 Jul 2021 19:52:36 +0100 Subject: [PATCH] Fix more issues discovered by luacheck --- .tests/luacheckrc | 10 ++++++++-- worldeditadditions/utils/format/human_size.lua | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.tests/luacheckrc b/.tests/luacheckrc index 36f9fd9..7c036ae 100644 --- a/.tests/luacheckrc +++ b/.tests/luacheckrc @@ -2,11 +2,17 @@ quiet = 1 codes = true exclude_files = { - ".luarocks/*" + ".luarocks/*", + "worldeditadditions/utils/bit.lua" } -ignore = {"631", "61[124]", "412", "21[123]"} +ignore = { + "631", "61[124]", + "412", + "321/bit", + "21[123]" +} -- Read-write globals (i.e. they can be defined) globals = { diff --git a/worldeditadditions/utils/format/human_size.lua b/worldeditadditions/utils/format/human_size.lua index 2403ff0..7bb600c 100644 --- a/worldeditadditions/utils/format/human_size.lua +++ b/worldeditadditions/utils/format/human_size.lua @@ -5,7 +5,7 @@ -- @param decimals number The number of decimal places to show. -- @return string A formatted string that represents the given input number. function worldeditadditions.format.human_size(n, decimals) - sizes = { "", "K", "M", "G", "T", "P", "E", "Y", "Z" } + local sizes = { "", "K", "M", "G", "T", "P", "E", "Y", "Z" } local factor = math.floor((#tostring(n) - 1) / 3) local multiplier = 10^(decimals or 0) local result = math.floor(0.5 + (n / math.pow(1000, factor)) * multiplier) / multiplier