chore: Add lint ignore overrides for warnings that get a pass

Mostly because refactoring these is hard, double negatives are much
harder to follow logic wise and there isn't much point in refactoring
these loops unless they need other work.
This commit is contained in:
Caleb Maclennan 2020-10-01 14:54:02 +03:00
parent a3e8db19de
commit f979400edb
No known key found for this signature in database
GPG Key ID: 63CC496475267693
7 changed files with 16 additions and 1 deletions

View File

@ -263,7 +263,9 @@ local function loadstr (ldoc,txt)
load = load or utils.load
chunk,err = load(txt,'config',nil,ldoc)
else
-- luacheck: push ignore 113
chunk,err = loadin(ldoc,txt)
-- luacheck: pop
end
return chunk, err
end

View File

@ -2,6 +2,8 @@
module 'global'
-- luacheck: ignore 121
---
-- Issues an error when its argument `v` is false.
-- That is, nil or false. otherwise, returns all its arguments.

View File

@ -39,6 +39,8 @@ function table.pack (···) end
-- is not given, then the '<' operator will be used.
function table.sort(table , comp) end
-- luacheck: ignore 121
---
-- Returns the elements from the given table. This function is equivalent to
-- return list[i], list[i+1], ..., list[j]

View File

@ -230,6 +230,7 @@ function File:finish()
end
item:finish()
-- the default is not to show local functions in the documentation.
-- luacheck: push ignore 542
if not self.args.all and (item.type=='lfunction' or (item.tags and item.tags['local'])) then
-- don't add to the module --
elseif doc.project_level(item.type) then
@ -403,6 +404,7 @@ function File:finish()
-- must be a free-standing function (sometimes a problem...)
end
end
-- luacheck: pop
item.names_hierarchy = require('pl.utils').split(
item.name,
'[.:]'

View File

@ -93,6 +93,7 @@ function Lua:grab_block_comment(v,tok)
end
-- luacheck: push ignore 312
function Lua:parse_module_call(tok,t,v)
t,v = tnext(tok)
if t == '(' then t,v = tnext(tok) end
@ -102,6 +103,7 @@ function Lua:parse_module_call(tok,t,v)
return '...',t,v
end
end
-- luacheck: pop
-- If a module name was not provided, then we look for an explicit module()
-- call. However, we should not try too hard; if we hit a doc comment then

View File

@ -638,12 +638,14 @@ local function blockquotes(lines)
local stop = #lines
for i = start+1, #lines do
-- luacheck: push ignore 542
if lines[i].type == "blank" or lines[i].type == "blockquote" then
elseif lines[i].type == "normal" then
if lines[i-1].type == "blank" then stop = i-1 break end
else
stop = i-1 break
end
-- luacheck: pop
end
while lines[stop].type == "blank" do stop = stop - 1 end
return start, stop
@ -869,7 +871,6 @@ local function code_spans(s)
pos = stop + 1
end
end
return s
end
-- Encode alt text... enodes &, and ".
@ -1166,10 +1167,12 @@ function OptionParser:run(args)
while pos <= #args do
local arg = args[pos]
if arg == "--" then
-- luacheck: push ignore 512
for i=pos+1,#args do
if self.arg then self.arg(args[i]) end
return true
end
-- luacheck: pop
end
if arg:match("^%-%-") then
local info = self.long[arg:sub(3)]

View File

@ -237,6 +237,7 @@ local formatters =
discount = function(format)
local ok, markdown = pcall(require, 'discount')
if ok then
-- luacheck: push ignore 542
if 'function' == type(markdown) then
-- lua-discount by A.S. Bradbury, https://luarocks.org/modules/luarocks/lua-discount
elseif 'table' == type(markdown) and ('function' == type(markdown.compile) or 'function' == type(markdown.to_html)) then
@ -260,6 +261,7 @@ local formatters =
else
ok = false
end
-- luacheck: pop
end
if not ok then
print('format: using built-in markdown')