Skip to content

Commit 75f2024

Browse files
committed
Add an info log for which modules will be skipped
1 parent 6e1993d commit 75f2024

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

autoapi/_mapper.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ def in_stdlib(module_name: str) -> bool:
4444
LOGGER = sphinx.util.logging.getLogger(__name__)
4545

4646

47+
def _color_info(msg: str) -> None:
48+
LOGGER.info(
49+
colorize("bold", "[AutoAPI] ")
50+
+ colorize(
51+
"darkgreen", msg
52+
)
53+
)
54+
55+
4756
def _expand_wildcard_placeholder(original_module, originals_map, placeholder):
4857
"""Expand a wildcard placeholder to a sequence of named placeholders.
4958
@@ -330,12 +339,7 @@ def find_files(patterns, dirs, ignore):
330339
for sub_dir in subdirectories.copy():
331340
# iterate copy as we adapt subdirectories during loop
332341
if _path_matches_patterns(os.path.join(root, sub_dir), ignore):
333-
LOGGER.info(
334-
colorize("bold", "[AutoAPI] ")
335-
+ colorize(
336-
"darkgreen", f"Ignoring directory: {root}/{sub_dir}/"
337-
)
338-
)
342+
_color_info(f"Ignoring directory: {root}/{sub_dir}/")
339343
# adapt original subdirectories inplace
340344
subdirectories.remove(sub_dir)
341345
# recurse into remaining directories
@@ -349,12 +353,7 @@ def find_files(patterns, dirs, ignore):
349353

350354
# Skip ignored files
351355
if _path_matches_patterns(os.path.join(root, filename), ignore):
352-
LOGGER.info(
353-
colorize("bold", "[AutoAPI] ")
354-
+ colorize(
355-
"darkgreen", f"Ignoring file: {root}/{filename}"
356-
)
357-
)
356+
_color_info(f"Ignoring file: {root}/{filename}")
358357
continue
359358

360359
# Make sure the path is full
@@ -389,6 +388,14 @@ def output_rst(self, source_suffix):
389388
def _output_top_rst(self):
390389
# Render Top Index
391390
top_level_index = os.path.join(self.dir_root, "index.rst")
391+
392+
modules = [obj for obj in self.all_objects.values()
393+
if obj.type == "module" and obj.docstring == ""]
394+
if modules and "undoc-members" not in self.app.config.autoapi_options:
395+
_color_info("The following modules have no top-level documentation, and so were skipped as undocumented:")
396+
for m in modules:
397+
_color_info(f" {m.id}")
398+
392399
pages = [obj for obj in self.objects_to_render.values() if obj.display]
393400
if not pages:
394401
msg = (

0 commit comments

Comments
 (0)