X-Git-Url: http://nitlanguage.org diff --git a/src/frontend/no_warning.nit b/src/frontend/no_warning.nit index c862075..bc59d8c 100644 --- a/src/frontend/no_warning.nit +++ b/src/frontend/no_warning.nit @@ -30,21 +30,33 @@ private class NoWarningPhase do # Get the mmodule var mmodule = nmodule.mmodule - assert mmodule != null + if mmodule == null then return + + var source = nmodule.location.file # If no decl block then quit var nmoduledecl = nmodule.n_moduledecl - if nmoduledecl == null then return + if nmoduledecl == null then + # Disable `missing-doc` if there is no `module` clause + # Rationale: the presence of a `module` clause is a good heuristic to + # discriminate quick and dirty prototypes from nice and clean modules + if source != null then toolcontext.warning_blacklist[source].add("missing-doc") + return + end var modelbuilder = toolcontext.modelbuilder - # Get all the new annotations + # Disable `missing-doc` for `test_suite` + if source != null and not nmoduledecl.get_annotations("test_suite").is_empty then + toolcontext.warning_blacklist[source].add("missing-doc") + end + + # Get all the `no_warning` annotations var name = "no_warning" var annots = nmoduledecl.get_annotations(name) if annots.is_empty then return - var source = nmodule.location.file if source == null then modelbuilder.warning(annots.first, "file-less-module", "Warning: annotation `{name}` does not currently work on file-less modules.") return