mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
lint: Don't assign values that will never be used
No bugs here, but giving an initial value can hide cases where we fail to set a value. Use an assert instead so we can see errors if we change and break this code. Except break_next which goes out of scope after it's assigned (I guess it used to be outside the loop).
This commit is contained in:
parent
5118cc42bb
commit
0c193d7901
@ -4,7 +4,6 @@ return {
|
||||
"211", -- Unused local variable.
|
||||
"212/self", -- Unused argument self.
|
||||
"213", -- Unused loop variable.
|
||||
"311", -- Value assigned to a local variable is unused.
|
||||
"631", -- Line is too long.
|
||||
},
|
||||
files = {
|
||||
|
@ -136,7 +136,7 @@ function colour.rgb_to_hsl(r, g, b)
|
||||
local l, d = max + min, max - min
|
||||
local s = d / (l > 1 and (2 - l) or l)
|
||||
l = l / 2
|
||||
local h = nil --depends on below
|
||||
local h --depends on below
|
||||
if max == r then
|
||||
h = (g - b) / d
|
||||
if g < b then h = h + 6 end
|
||||
@ -145,6 +145,7 @@ function colour.rgb_to_hsl(r, g, b)
|
||||
else
|
||||
h = (r - g) / d + 4
|
||||
end
|
||||
assert(h)
|
||||
return h / 6, s, l
|
||||
end
|
||||
|
||||
|
@ -186,7 +186,7 @@ function intersect.line_line_collide(a_start, a_end, a_rad, b_start, b_end, b_ra
|
||||
local numerb = dx1 * dyab - dy1 * dxab
|
||||
|
||||
--check coincident lines
|
||||
local intersected = "none"
|
||||
local intersected
|
||||
if
|
||||
math.abs(numera) < COLLIDE_EPS and
|
||||
math.abs(numerb) < COLLIDE_EPS and
|
||||
@ -215,6 +215,7 @@ function intersect.line_line_collide(a_start, a_end, a_rad, b_start, b_end, b_ra
|
||||
end
|
||||
end
|
||||
end
|
||||
assert(intersected)
|
||||
|
||||
if intersected == "both" then
|
||||
--simply displace along A normal
|
||||
|
@ -153,7 +153,6 @@ function pretty._process(input, config, processing_state)
|
||||
end
|
||||
if break_next then
|
||||
table.insert(line_chunks, table.remove(chunks, 1))
|
||||
break_next = false
|
||||
end
|
||||
end
|
||||
chunks = line_chunks
|
||||
|
Loading…
Reference in New Issue
Block a user