Skip to content

Commit a271960

Browse files
committed
Fix luacheck: ignore not filtering out warnings 5xx and 314
Ref #71.
1 parent 479dcf1 commit a271960

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

spec/check_spec.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,19 @@ return foo;
755755
]])
756756
end)
757757

758+
it("marks ignored warnings as filtered", function()
759+
assert.same({
760+
{code = "211", name = "foo", filtered = true, line = 1, column = 7, end_column = 9},
761+
{code = "211", name = "bar", line = 1, column = 12, end_column = 14},
762+
{code = "512", filtered = true, line = 2, column = 1, end_column = 3},
763+
{code = "213", name = "_", filtered = true, line = 2, column = 5, end_column = 5},
764+
{code = "113", name = "pairs", filtered_113 = true, line = 2, column = 10, end_column = 14},
765+
}, check[[
766+
local foo, bar -- luacheck: ignore foo
767+
for _ in pairs({}) do return end -- luacheck: ignore
768+
]])
769+
end)
770+
758771
it("handles argparse sample", function()
759772
assert.table(check(io.open("spec/samples/argparse.lua", "rb"):read("*a")))
760773
end)

src/luacheck/filter.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ local function is_enabled(rules, warning)
166166
for _, pattern in ipairs(rule[1]) do
167167
local matches_code, matches_name = match(warning, pattern)
168168

169-
-- If a factor is enabled, warning can't be disable by it.
169+
-- If a factor is enabled, warning can't be disabled by it.
170170
if enabled_code then
171171
matches_code = rule[2] ~= "disable"
172172
end
@@ -190,7 +190,7 @@ local function is_enabled(rules, warning)
190190
end
191191

192192
if enabled_code and enabled_name then
193-
-- Enable as matching to some `enable` pattern by code and to other by name.
193+
-- Enable as matching to some `enable` pattern by code and to another by name.
194194
return true
195195
end
196196
elseif rule[2] == "disable" then

src/luacheck/inline_options.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ local function get_options(body)
5151

5252
opts.std = args[1]
5353
elseif name == "ignore" and #args == 0 then
54-
opts.ignore = {".*/.*"}
54+
opts.ignore = {".*"}
5555
else
5656
local flag = true
5757

0 commit comments

Comments
 (0)