diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-10-10 07:52:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 07:52:39 (GMT) |
commit | 7b2764e798e400b8f5fcc199739405e6fbd05c20 (patch) | |
tree | d653a3d190631e3f6ec167b3db2f5e66e1b8333e /Tools/clinic | |
parent | 96fed66a65097eac2dc528ce29c9ba676bb07689 (diff) | |
download | cpython-7b2764e798e400b8f5fcc199739405e6fbd05c20.zip cpython-7b2764e798e400b8f5fcc199739405e6fbd05c20.tar.gz cpython-7b2764e798e400b8f5fcc199739405e6fbd05c20.tar.bz2 |
gh-110558: Run ruff on Argument Clinic in CI (#110559)
Diffstat (limited to 'Tools/clinic')
-rw-r--r-- | Tools/clinic/.ruff.toml | 14 | ||||
-rwxr-xr-x | Tools/clinic/clinic.py | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/Tools/clinic/.ruff.toml b/Tools/clinic/.ruff.toml new file mode 100644 index 0000000..3bc9d90 --- /dev/null +++ b/Tools/clinic/.ruff.toml @@ -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 +] diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index eca4747..0f26350 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -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: |