properly handle note override logic/verbosity/config/cmdline using modifiedyNotes, cmdlineNotes

This commit is contained in:
Timothee Cour 2020-02-26 12:49:44 -08:00 • committed by Andreas Rumpf
commit 1056f9ecff
5 changed files with 31 additions and 32 deletions

View file

@ -226,13 +226,11 @@ type
ideCmd*: IdeCmd
oldNewlines*: bool
cCompiler*: TSystemCC
enableNotes*: TNoteKinds
disableNotes*: TNoteKinds
modifiedyNotes*: TNoteKinds # notes that have been set/unset from either cmdline/configs
cmdlineNotes*: TNoteKinds # notes that have been set/unset from cmdline
foreignPackageNotes*: TNoteKinds
notes*: TNoteKinds
notes*: TNoteKinds # notes after resolving all logic(defaults, verbosity)/cmdline/configs
mainPackageNotes*: TNoteKinds
cmdLineNotes*: TNoteKinds
cmdLineDisabledNotes*: TNoteKinds
mainPackageId*: int
errorCounter*: int
hintCounter*: int
@ -289,6 +287,10 @@ type
severity: Severity) {.closure, gcsafe.}
cppCustomNamespace*: string
proc setNote*(conf: ConfigRef, note: TNoteKind, enabled = true) =
if note notin conf.cmdlineNotes:
if enabled: incl(conf.notes, note) else: excl(conf.notes, note)
proc hasHint*(conf: ConfigRef, note: TNoteKind): bool =
optHints in conf.options and note in conf.notes