Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7b2764e

Browse filesBrowse files
authored
gh-110558: Run ruff on Argument Clinic in CI (#110559)
1 parent 96fed66 commit 7b2764e
Copy full SHA for 7b2764e

File tree

5 files changed

+21
-4
lines changed
Filter options

5 files changed

+21
-4
lines changed

‎.github/workflows/lint.yml

Copy file name to clipboardExpand all lines: .github/workflows/lint.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ permissions:
77

88
env:
99
FORCE_COLOR: 1
10-
RUFF_FORMAT: github
10+
RUFF_OUTPUT_FORMAT: github
1111

1212
concurrency:
1313
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ repos:
66
name: Run Ruff on Lib/test/
77
args: [--exit-non-zero-on-fix]
88
files: ^Lib/test/
9+
- id: ruff
10+
name: Run Ruff on Tools/clinic/
11+
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
12+
files: ^Tools/clinic/|Lib/test/test_clinic.py
913

1014
- repo: https://github.com/pre-commit/pre-commit-hooks
1115
rev: v4.4.0

‎Lib/test/.ruff.toml

Copy file name to clipboardExpand all lines: Lib/test/.ruff.toml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ select = [
33
"F811", # Redefinition of unused variable (useful for finding test methods with the same name)
44
]
55
extend-exclude = [
6+
# Excluded (run with the other AC files in its own separate ruff job in pre-commit)
7+
"test_clinic.py",
68
# Excluded (these aren't actually executed, they're just "data files")
79
"tokenizedata/*.py",
810
# Failed to lint

‎Tools/clinic/.ruff.toml

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
target-version = "py310"
2+
fix = true
3+
select = [
4+
"F", # Enable all pyflakes rules
5+
"RUF100", # Ban unused `# noqa` comments
6+
"PGH004", # Ban blanket `# noqa` comments (only ignore specific error codes)
7+
]
8+
unfixable = [
9+
# The autofixes sometimes do the wrong things for these;
10+
# it's better to have to manually look at the code and see how it needs fixing
11+
"F841", # Detects unused variables
12+
"F601", # Detects dictionaries that have duplicate keys
13+
"F602", # Also detects dictionaries that have duplicate keys
14+
]

‎Tools/clinic/clinic.py

Copy file name to clipboardExpand all lines: Tools/clinic/clinic.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,6 @@ def compiler_deprecated_warning(
924924

925925
# Format the preprocessor warning and error messages.
926926
assert isinstance(self.cpp.filename, str)
927-
source = os.path.basename(self.cpp.filename)
928927
message = f"Update the clinic input of {func.full_name!r}."
929928
code = self.COMPILER_DEPRECATION_WARNING_PROTOTYPE.format(
930929
major=minversion[0],
@@ -1846,7 +1845,6 @@ def render_function(
18461845
last_group = 0
18471846
first_optional = len(selfless)
18481847
positional = selfless and selfless[-1].is_positional_only()
1849-
new_or_init = f.kind.new_or_init
18501848
has_option_groups = False
18511849

18521850
# offset i by -1 because first_optional needs to ignore self
@@ -6343,7 +6341,6 @@ def check_remaining_star(self, lineno: int | None = None) -> None:
63436341
else:
63446342
return
63456343

6346-
no_param_after_symbol = True
63476344
for p in reversed(self.function.parameters.values()):
63486345
if self.keyword_only:
63496346
if p.kind == inspect.Parameter.KEYWORD_ONLY:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.