Resolve lint errors from Ruff 0.0.260

This commit is contained in:
Adam Turner 2023-03-31 17:52:51 +01:00
parent f019b89c05
commit 15553da9c8
5 changed files with 12 additions and 4 deletions

View File

@ -139,6 +139,7 @@ remove_redundant_aliases = true
[tool.ruff]
target-version = "py38" # Pin Ruff to Python 3.8
line-length = 95
show-source = true
exclude = [
".git",
".tox",
@ -284,11 +285,17 @@ select = [
"doc/conf.py" = ["INP001"]
"doc/development/tutorials/examples/*" = ["INP001"]
# Ruff false positive: https://github.com/charliermarsh/ruff/issues/3830
"sphinx/domains/c.py" = ["SIM222"]
"sphinx/environment/collectors/toctree.py" = ["B026"]
"sphinx/environment/adapters/toctree.py" = ["B026"]
"tests/*" = ["E501"]
# Ruff false positive: https://github.com/charliermarsh/ruff/issues/3831
"tests/test_config.py" = ["B018"]
[tool.ruff.flake8-quotes]
inline-quotes = "single"

View File

@ -943,7 +943,7 @@ class Sphinx:
refs: `Transform Priority Range Categories`__
__ https://docutils.sourceforge.io/docs/ref/transforms.html#transform-priority-range-categories
""" # noqa: E501
""" # NoQA: E501,RUF100 # Flake8 thinks the URL is too long, Ruff special cases URLs.
self.registry.add_transform(transform)
def add_post_transform(self, transform: type[Transform]) -> None:

View File

@ -5061,7 +5061,7 @@ class Symbol:
if parentSymbol.declaration is not None:
if parentSymbol.declaration.objectType == 'templateParam':
raise QualifiedSymbolIsTemplateParam()
return None # NoQA: RET501,PLR1711
return None
try:
lookupResult = self._symbol_lookup(nestedName, templateDecls,

View File

@ -323,7 +323,8 @@ class TextWrapper(textwrap.TextWrapper):
if w == 1:
chunks.extend(split(''.join(g)))
else:
chunks.extend(list(g))
# Ruff false positive: https://github.com/charliermarsh/ruff/issues/3829
chunks.extend(list(g)) # NoQA: B031
return chunks
def _handle_long_word(self, reversed_chunks: list[str], cur_line: list[str],

View File

@ -169,7 +169,7 @@ def test_restify_type_hints_alias():
def test_restify_type_ForwardRef():
from typing import ForwardRef # type: ignore
assert restify(ForwardRef("myint")) == ":py:class:`myint`" # NoQA: F821
assert restify(ForwardRef("myint")) == ":py:class:`myint`"
def test_restify_type_Literal():