Enable the entire TD category in Ruff

This commit is contained in:
Adam Turner 2025-01-14 12:52:43 +00:00
parent d102e62bc7
commit 3521cb60cf
5 changed files with 16 additions and 14 deletions

View File

@ -66,6 +66,11 @@ ignore = [
# flake8-simplify
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM108", # Use ternary operator `{contents}` instead of `if`-`else`-block
# flake8-todos ('TD')
"TD001", # Invalid TODO tag: `{tag}`
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link on the line following this TODO
"TD004", # Missing colon in TODO
# pyupgrade
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
@ -240,13 +245,7 @@ select = [
# flake8-type-checking ('TC')
"TC",
# flake8-todos ('TD')
# "TD001", # Invalid TODO tag: `{tag}`
# "TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
# "TD003", # Missing issue link on the line following this TODO
# "TD004", # Missing colon in TODO
# "TD005", # Missing issue description after `TODO`
"TD006", # Invalid TODO capitalization: `{tag}` should be `TODO`
"TD007", # Missing space after colon in TODO
"TD",
# flake8-tidy-imports ('TID')
"TID",
# flake8-trio ('TRIO')

View File

@ -162,12 +162,12 @@ class ASTNestedName(ASTBase):
if mode == 'noneIsName':
if self.rooted:
unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO
raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('.')
for i in range(len(self.names)):
if i != 0:
unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO
raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('.')
n = self.names[i]
n.describe_signature(signode, mode, env, '', symbol)

View File

@ -871,7 +871,7 @@ class DefinitionParser(BaseParser):
self, outer: str | None = None, allow_fallback: bool = True
) -> ASTInitializer | None:
self.skip_ws()
if outer == 'member' and False: # NoQA: SIM223 # TODO
if outer == 'member' and False: # NoQA: SIM223,TD005 # TODO
braced_init = self._parse_braced_init_list()
if braced_init is not None:
return ASTInitializer(braced_init, hasAssign=False)

View File

@ -286,17 +286,17 @@ class ASTNestedName(ASTBase):
if mode == 'noneIsName':
if self.rooted:
unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO
raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('::')
for i in range(len(self.names)):
if i != 0:
unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO
raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('::blah')
n = self.names[i]
if self.templates[i]:
unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO
raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('template')
signode += nodes.Text(' ')
n.describe_signature(signode, mode, env, '', symbol)

View File

@ -314,8 +314,11 @@ def test_domain_c_ast_expressions():
expr_check('5 / 42')
expr_check('5 % 42')
# ['.*', '->*']
expr_check('5 .* 42')
expr_check('5 ->* 42')
# TODO: conditional is unimplemented
# conditional
# TODO
# expr_check('5 ? 7 : 3')
# assignment
expr_check('a = 5')
expr_check('a *= 5')