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 # flake8-simplify
"SIM102", # Use a single `if` statement instead of nested `if` statements "SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM108", # Use ternary operator `{contents}` instead of `if`-`else`-block "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 # pyupgrade
"UP031", # Use format specifiers instead of percent format "UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call "UP032", # Use f-string instead of `format` call
@ -240,13 +245,7 @@ select = [
# flake8-type-checking ('TC') # flake8-type-checking ('TC')
"TC", "TC",
# flake8-todos ('TD') # flake8-todos ('TD')
# "TD001", # Invalid TODO tag: `{tag}` "TD",
# "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
# flake8-tidy-imports ('TID') # flake8-tidy-imports ('TID')
"TID", "TID",
# flake8-trio ('TRIO') # flake8-trio ('TRIO')

View File

@ -162,12 +162,12 @@ class ASTNestedName(ASTBase):
if mode == 'noneIsName': if mode == 'noneIsName':
if self.rooted: if self.rooted:
unreachable = 'Can this happen?' unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('.') signode += nodes.Text('.')
for i in range(len(self.names)): for i in range(len(self.names)):
if i != 0: if i != 0:
unreachable = 'Can this happen?' unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('.') signode += nodes.Text('.')
n = self.names[i] n = self.names[i]
n.describe_signature(signode, mode, env, '', symbol) 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 self, outer: str | None = None, allow_fallback: bool = True
) -> ASTInitializer | None: ) -> ASTInitializer | None:
self.skip_ws() 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() braced_init = self._parse_braced_init_list()
if braced_init is not None: if braced_init is not None:
return ASTInitializer(braced_init, hasAssign=False) return ASTInitializer(braced_init, hasAssign=False)

View File

@ -286,17 +286,17 @@ class ASTNestedName(ASTBase):
if mode == 'noneIsName': if mode == 'noneIsName':
if self.rooted: if self.rooted:
unreachable = 'Can this happen?' unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('::') signode += nodes.Text('::')
for i in range(len(self.names)): for i in range(len(self.names)):
if i != 0: if i != 0:
unreachable = 'Can this happen?' unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('::blah') signode += nodes.Text('::blah')
n = self.names[i] n = self.names[i]
if self.templates[i]: if self.templates[i]:
unreachable = 'Can this happen?' unreachable = 'Can this happen?'
raise AssertionError(unreachable) # TODO raise AssertionError(unreachable) # TODO: Can this happen?
signode += nodes.Text('template') signode += nodes.Text('template')
signode += nodes.Text(' ') signode += nodes.Text(' ')
n.describe_signature(signode, mode, env, '', symbol) 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')
# ['.*', '->*'] # ['.*', '->*']
expr_check('5 .* 42')
expr_check('5 ->* 42')
# TODO: conditional is unimplemented
# conditional # conditional
# TODO # expr_check('5 ? 7 : 3')
# assignment # assignment
expr_check('a = 5') expr_check('a = 5')
expr_check('a *= 5') expr_check('a *= 5')