This repository was archived by the owner on Mar 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
fix: filter sphinx warnings related to adding a new line after lists #2533
Merged
chalmerlowe
merged 8 commits into
main
from
fix-suppress-blank-line-after-bullet-warning
Jan 30, 2026
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
78e2bbb
updates conf.py.js templates to add sphinx warnings
chalmerlowe df9df95
updates the location of common macros for ads and non-ads templates
chalmerlowe 3146a63
updates conf.py.j2 templates and adds content to common_setup.py.j2
chalmerlowe 4fa2a45
updates path to common macros in ads-template
chalmerlowe f4afdea
updates imports and duplicates content to ads-template
chalmerlowe c9f29cd
update golden conf.py files
chalmerlowe d0ad5f2
Merge branch 'main' into fix-suppress-blank-line-after-bullet-warning
chalmerlowe 4c188cb
Merge branch 'main' into fix-suppress-blank-line-after-bullet-warning
chalmerlowe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,10 @@ | |
| # All configuration values have a default; values that are commented out | ||
| # serve to show the default. | ||
|
|
||
| import sys | ||
| import logging | ||
| import os | ||
| import shlex | ||
| import sys | ||
|
|
||
| # If extensions (or modules to document with autodoc) are in another directory, | ||
| # add these directories to sys.path here. If the directory is relative to the | ||
|
|
@@ -361,4 +362,21 @@ napoleon_use_admonition_for_references = False | |
| napoleon_use_ivar = False | ||
| napoleon_use_param = True | ||
| napoleon_use_rtype = True | ||
|
|
||
| # --- Specific warning filters not covered by suppress_warnings --- | ||
|
|
||
| class UnexpectedUnindentFilter(logging.Filter): | ||
| """Filter out warnings about unexpected unindentation following bullet lists.""" | ||
| def filter(self, record): | ||
| # Return False to suppress the warning, True to allow it | ||
| msg = record.getMessage() | ||
| if "Bullet list ends without a blank line" in msg: | ||
| return False | ||
| return True | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we include this (and the setup function below) in a separate file as a macro and use it in both templates and ad-templates? I'm guessing we'll keep introducing new code for each warning as per this pattern and it'll be easier to maintain code if it's one place.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ohmayr please take a look. I attempted to incorporate your comments. |
||
|
|
||
| def setup(app): | ||
| # Sphinx's logger is hierarchical. Adding a filter to the | ||
| # root 'sphinx' logger will catch warnings from all sub-loggers. | ||
| logger = logging.getLogger('sphinx') | ||
| logger.addFilter(UnexpectedUnindentFilter()) | ||
| {% endblock %} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,10 @@ | |
| # All configuration values have a default; values that are commented out | ||
| # serve to show the default. | ||
|
|
||
| import sys | ||
| import logging | ||
| import os | ||
| import shlex | ||
| import sys | ||
|
|
||
| # If extensions (or modules to document with autodoc) are in another directory, | ||
| # add these directories to sys.path here. If the directory is relative to the | ||
|
|
@@ -372,4 +373,21 @@ napoleon_use_admonition_for_references = False | |
| napoleon_use_ivar = False | ||
| napoleon_use_param = True | ||
| napoleon_use_rtype = True | ||
|
|
||
| # --- Specific warning filters not covered by suppress_warnings --- | ||
|
|
||
| class UnexpectedUnindentFilter(logging.Filter): | ||
| """Filter out warnings about unexpected unindentation following bullet lists.""" | ||
| def filter(self, record): | ||
| # Return False to suppress the warning, True to allow it | ||
| msg = record.getMessage() | ||
| if "Bullet list ends without a blank line" in msg: | ||
| return False | ||
| return True | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| def setup(app): | ||
| # Sphinx's logger is hierarchical. Adding a filter to the | ||
| # root 'sphinx' logger will catch warnings from all sub-loggers. | ||
| logger = logging.getLogger('sphinx') | ||
| logger.addFilter(UnexpectedUnindentFilter()) | ||
| {% endblock %} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For conciseness, the logic in the
filtermethod can be simplified to a singlereturnstatement.