Enable E116 (Unexpected indentation (comment))

This commit is contained in:
Adam Turner 2023-08-15 18:00:30 +01:00
parent f0fa8a66f9
commit 85e32e3b73
5 changed files with 17 additions and 15 deletions

View File

@ -295,6 +295,7 @@ select = [
"E113", # Unexpected indentation
"E114", # Indentation is not a multiple of {indent_size} (comment)
"E115", # Expected an indented block (comment)
"E116", # Unexpected indentation (comment)
]
[tool.ruff.per-file-ignores]

View File

@ -102,8 +102,7 @@ class NavPoint(NamedTuple):
playorder: int
text: str
refuri: str
children: list[Any] # mypy does not support recursive types
# https://github.com/python/mypy/issues/7069
children: list[NavPoint]
def sphinx_smarty_pants(t: str, language: str = 'en') -> str:

View File

@ -29,8 +29,7 @@ logger = logging.getLogger(__name__)
class NavPoint(NamedTuple):
text: str
refuri: str
children: list[Any] # mypy does not support recursive types
# https://github.com/python/mypy/issues/7069
children: list[NavPoint]
# writing modes

View File

@ -451,15 +451,17 @@ class SphinxRole:
.. note:: The subclasses of this class might not work with docutils.
This class is strongly coupled with Sphinx.
"""
name: str #: The role name actually used in the document.
rawtext: str #: A string containing the entire interpreted text input.
text: str #: The interpreted text content.
lineno: int #: The line number where the interpreted text begins.
inliner: Inliner #: The ``docutils.parsers.rst.states.Inliner`` object.
options: dict #: A dictionary of directive options for customization
#: (from the "role" directive).
content: Sequence[str] #: A list of strings, the directive content for customization
#: (from the "role" directive).
name: str #: The role name actually used in the document.
rawtext: str #: A string containing the entire interpreted text input.
text: str #: The interpreted text content.
lineno: int #: The line number where the interpreted text begins.
inliner: Inliner #: The ``docutils.parsers.rst.states.Inliner`` object.
#: A dictionary of directive options for customisation
#: (from the "role" directive).
options: dict[str, Any]
#: A list of strings, the directive content for customisation
#: (from the "role" directive).
content: Sequence[str]
def __call__(self, name: str, rawtext: str, text: str, lineno: int,
inliner: Inliner, options: dict | None = None, content: Sequence[str] = (),

View File

@ -1500,8 +1500,9 @@ class LaTeXTranslator(SphinxTranslator):
length = self.latex_image_length(node['width'])
elif isinstance(node[0], nodes.image) and 'width' in node[0]:
length = self.latex_image_length(node[0]['width'])
self.body.append(BLANKLINE) # Insert a blank line to prevent infinite loop
# https://github.com/sphinx-doc/sphinx/issues/7059
# Insert a blank line to prevent an infinite loop
# https://github.com/sphinx-doc/sphinx/issues/7059
self.body.append(BLANKLINE)
self.body.append(r'\begin{wrapfigure}{%s}{%s}' %
('r' if node['align'] == 'right' else 'l', length or '0pt') + CR)
self.body.append(r'\centering')