mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-110558: Run ruff on Argument Clinic in CI (#110559)
This commit is contained in:
parent
96fed66a65
commit
7b2764e798
5 changed files with 21 additions and 4 deletions
14
Tools/clinic/.ruff.toml
Normal file
14
Tools/clinic/.ruff.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
target-version = "py310"
|
||||
fix = true
|
||||
select = [
|
||||
"F", # Enable all pyflakes rules
|
||||
"RUF100", # Ban unused `# noqa` comments
|
||||
"PGH004", # Ban blanket `# noqa` comments (only ignore specific error codes)
|
||||
]
|
||||
unfixable = [
|
||||
# The autofixes sometimes do the wrong things for these;
|
||||
# it's better to have to manually look at the code and see how it needs fixing
|
||||
"F841", # Detects unused variables
|
||||
"F601", # Detects dictionaries that have duplicate keys
|
||||
"F602", # Also detects dictionaries that have duplicate keys
|
||||
]
|
||||
|
|
@ -924,7 +924,6 @@ class CLanguage(Language):
|
|||
|
||||
# Format the preprocessor warning and error messages.
|
||||
assert isinstance(self.cpp.filename, str)
|
||||
source = os.path.basename(self.cpp.filename)
|
||||
message = f"Update the clinic input of {func.full_name!r}."
|
||||
code = self.COMPILER_DEPRECATION_WARNING_PROTOTYPE.format(
|
||||
major=minversion[0],
|
||||
|
|
@ -1846,7 +1845,6 @@ class CLanguage(Language):
|
|||
last_group = 0
|
||||
first_optional = len(selfless)
|
||||
positional = selfless and selfless[-1].is_positional_only()
|
||||
new_or_init = f.kind.new_or_init
|
||||
has_option_groups = False
|
||||
|
||||
# offset i by -1 because first_optional needs to ignore self
|
||||
|
|
@ -6343,7 +6341,6 @@ class DSLParser:
|
|||
else:
|
||||
return
|
||||
|
||||
no_param_after_symbol = True
|
||||
for p in reversed(self.function.parameters.values()):
|
||||
if self.keyword_only:
|
||||
if p.kind == inspect.Parameter.KEYWORD_ONLY:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue