nitc :: ToolContext :: warning
First-level warnings are warnings that SHOULD be corrected, and COULD usually be immediately corrected.
First-level warnings are displayed by default (except if option -q
is given).
Return the message (to add information) or null if the warning is disabled
# Display a first-level warning.
#
# First-level warnings are warnings that SHOULD be corrected,
# and COULD usually be immediately corrected.
#
# * There is a simple correction
# * There is no reason to let the code this way (no reasonable @supresswarning-like annotation)
# * They always are real issues (no false positive)
#
# First-level warnings are displayed by default (except if option `-q` is given).
#
# Return the message (to add information) or null if the warning is disabled
fun warning(l: nullable Location, tag: String, text: String): nullable Message
do
if is_warning_blacklisted(l, tag) then return null
var m = new Message(l, tag, text, 1)
if messages.has(m) then return null
if l != null then l.add_message m
if opt_warning.value.has("no-{tag}") then return null
if not opt_warning.value.has(tag) and opt_warn.value <= 0 then return null
messages.add m
warning_count = warning_count + 1
if opt_stop_on_first_error.value then check_errors
return m
end
src/toolcontext.nit:261,2--285,4