--fatalwarnings flag to force ldoc to return non-zero exit code if there are any warnings; issue #255 @psychon

This commit is contained in:
steve donovan 2016-04-10 18:02:09 +02:00
parent 1ebd148291
commit bbbcb1a59f
2 changed files with 7 additions and 0 deletions

View File

@ -65,6 +65,7 @@ ldoc, a documentation generator for Lua, vs 1.4.3
--dump debug output dump
--filter (default none) filter output as Lua data (e.g pl.pretty.dump)
--tags (default none) show all references to given tags, comma-separated
--fatalwarnings non-zero exit status on any warning
<file> (string) source file or directory containing source
`ldoc .` reads options from an `config.ld` file in same directory;
@ -143,6 +144,7 @@ local function setup_kinds ()
ModuleMap:add_kind(lookup('function','Functions','Parameters'))
ModuleMap:add_kind(lookup('table','Tables','Fields'))
ModuleMap:add_kind(lookup('field','Fields'))
ModuleMap:add_kind(lookup('type','Types'))
ModuleMap:add_kind(lookup('lfunction','Local Functions','Parameters'))
ModuleMap:add_kind(lookup('annotation','Issues'))
@ -817,3 +819,7 @@ if args.verbose then
print 'modules'
for k in pairs(module_list.by_name) do print(k) end
end
if args.fatalwarnings and Item.had_warning then
os.exit(1)
end

View File

@ -1020,6 +1020,7 @@ function Item:warning(msg)
if type(file) == 'table' then require 'pl.pretty'.dump(file); file = '?' end
file = file or '?'
io.stderr:write(file,':',self.lineno or '1',': ',self.name or '?',': ',msg,'\n')
Item.had_warning = true
return nil
end