Skip to content

Commit

Permalink
coverage: Warn on missing modules
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Finucane <stephen@that.guru>
  • Loading branch information
stephenfin committed Oct 6, 2023
1 parent dcc150f commit 34c02ff
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sphinx/ext/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,22 @@ def _determine_py_coverage_modules(
py_undoc[mod_name] = {'error': err}
continue

# if there are additional modules then we warn (but still scan)
additional_modules = set(seen_modules) - modules
if additional_modules:
# if there are additional modules then we warn but continue scanning
if additional_modules := set(seen_modules) - modules:
logger.warning(
__('the following modules are documented but were not specified '
'in coverage_modules: %s'),
', '.join(additional_modules),
)

# likewise, if there are missing modules we warn but continue scanning
if additional_modules := modules - set(seen_modules):
logger.warning(
__('the following modules are specified in coverage_modules '
'but were not documented'),
', '.join(additional_modules),
)

return sorted(modules)


Expand Down

0 comments on commit 34c02ff

Please sign in to comment.