mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-14 01:12:10 -05:00
Permit filtering warnings generated during source code parsing (#13894)
Co-authored-by: Valentin Heinisch <valentin.heinisch@vector.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
4 files changed
+10
-1
No files matched your search
@@ -117,6 +117,7 @@ Contributors
|
||||
* Thomas Waldmann -- apidoc module fixes
|
||||
* Till Hoffmann -- doctest option to exit after first failed test
|
||||
* Tim Hoffmann -- theme improvements
|
||||
* Valentin Heinisch -- warning types improvement
|
||||
* Victor Wheeler -- documentation improvements
|
||||
* Vince Salvino -- JavaScript search improvements
|
||||
* Will Maier -- directory HTML builder
|
||||
|
||||
@@ -102,6 +102,9 @@ Features added
|
||||
Patch by Matthias Geier.
|
||||
* #14029: intersphinx: Fix error in format string interpolation.
|
||||
Patch by Matthieu de Cibeins.
|
||||
* #13894: Add ``source_code_parser`` type to :confval:`suppress_warnings`
|
||||
for grouping issues related to the C and C++ parsers.
|
||||
Patch by Valentin H.
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
@@ -1402,6 +1402,8 @@ Options for warning control
|
||||
* ``ref.python``
|
||||
* ``ref.ref``
|
||||
* ``ref.term``
|
||||
* ``source_code_parser.c``
|
||||
* ``source_code_parser.cpp``
|
||||
* ``toc.circular``
|
||||
* ``toc.duplicate_entry``
|
||||
* ``toc.empty_glob``
|
||||
|
||||
@@ -356,7 +356,10 @@ class BaseParser:
|
||||
raise self._make_multi_error(errors, '')
|
||||
|
||||
def warn(self, msg: str) -> None:
|
||||
logger.warning(msg, location=self.location)
|
||||
subtype = 'c' if self.language == 'C' else 'cpp'
|
||||
logger.warning(
|
||||
msg, location=self.location, type='source_code_parser', subtype=subtype
|
||||
)
|
||||
|
||||
def match(self, regex: re.Pattern[str]) -> bool:
|
||||
match = regex.match(self.definition, self.pos)
|
||||
|
||||
Reference in new issue
Block a user