From 1597dfb8df13faae84ce5d268515b5e898e680ed Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 10 Nov 2015 10:31:10 -0500 Subject: [PATCH 1/1] frontend: `missing-doc` advice is conditioned to the presence of doc on the module Signed-off-by: Jean Privat --- src/frontend/no_warning.nit | 8 +++++--- src/loader.nit | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/frontend/no_warning.nit b/src/frontend/no_warning.nit index b3cfd30..97efb63 100644 --- a/src/frontend/no_warning.nit +++ b/src/frontend/no_warning.nit @@ -34,16 +34,18 @@ private class NoWarningPhase var source = nmodule.location.file - # If no decl block then quit var nmoduledecl = nmodule.n_moduledecl - if nmoduledecl == null then + if nmoduledecl == null or nmoduledecl.n_doc == 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 + # If no decl block then quit + if nmoduledecl == null then return + var modelbuilder = toolcontext.modelbuilder # Disable `missing-doc` for `test_suite` diff --git a/src/loader.nit b/src/loader.nit index b3485ed..c0891a1 100644 --- a/src/loader.nit +++ b/src/loader.nit @@ -716,8 +716,6 @@ redef class ModelBuilder var mdoc = ndoc.to_mdoc mmodule.mdoc = mdoc mdoc.original_mentity = mmodule - else - advice(decl, "missing-doc", "Documentation warning: Undocumented module `{mmodule}`") end # Is the module a test suite? mmodule.is_test_suite = not decl.get_annotations("test_suite").is_empty -- 1.7.9.5