--hintAsError (#16763)

* --hintAsError

* add test, changelog

* condsyms
This commit is contained in:
Timothee Cour 2021-01-20 01:49:59 -08:00 • committed by GitHub
commit 4fc7fcb775
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 9 deletions

View file

@ -413,7 +413,7 @@ proc handleError(conf: ConfigRef; msg: TMsgKind, eh: TErrorHandling, s: string)
if conf.cmd == cmdIdeTools: log(s)
quit(conf, msg)
if msg >= errMin and msg <= errMax or
(msg in warnMin..warnMax and msg in conf.warningAsErrors):
(msg in warnMin..hintMax and msg in conf.warningAsErrors):
inc(conf.errorCounter)
conf.exitcode = 1'i8
if conf.errorCounter >= conf.errorMax:
@ -522,7 +522,11 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
of hintMin..hintMax:
sev = Severity.Hint
ignoreMsg = not conf.hasHint(msg)
title = HintTitle
if msg in conf.warningAsErrors:
ignoreMsg = false
title = ErrorTitle
else:
title = HintTitle
color = HintColor
inc(conf.hintCounter)