mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][Ez] Update ruff to 0.2.2 (#120517)
Updates ruff to 0.2.2. This updates the config and handles some of the new rules that have come out of preview. Pull Request resolved: https://github.com/pytorch/pytorch/pull/120517 Approved by: https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
79f059987e
commit
33938cfddd
@ -2654,7 +2654,7 @@ init_command = [
|
||||
'python3',
|
||||
'tools/linter/adapters/pip_init.py',
|
||||
'--dry-run={{DRYRUN}}',
|
||||
'ruff==0.1.14',
|
||||
'ruff==0.2.2',
|
||||
]
|
||||
is_formatter = true
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
@ -22,11 +21,9 @@ import functorch
|
||||
# source code directory, relative to this file, for sphinx-autobuild
|
||||
# sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
import torch
|
||||
|
||||
RELEASE = os.environ.get("RELEASE", False)
|
||||
|
||||
import sys
|
||||
|
||||
import pytorch_sphinx_theme
|
||||
|
||||
|
@ -22,7 +22,9 @@ target-version = ["py38", "py39", "py310", "py311"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py38"
|
||||
line-length = 120
|
||||
|
||||
[tool.ruff.lint]
|
||||
# NOTE: Synchoronize the ignores with .flake8
|
||||
ignore = [
|
||||
# these ignores are from flake8-bugbear; please fix!
|
||||
@ -31,7 +33,7 @@ ignore = [
|
||||
"B019",
|
||||
"B023",
|
||||
"B028", # No explicit `stacklevel` keyword argument found
|
||||
"B904",
|
||||
"B904", # Migrate from TRY200
|
||||
"E402",
|
||||
"C408", # C408 ignored because we like the dict keyword argument syntax
|
||||
"E501", # E501 is not flexible enough, we're using B950 instead
|
||||
@ -56,6 +58,7 @@ ignore = [
|
||||
"PYI041",
|
||||
"PYI056",
|
||||
"SIM102", "SIM103", "SIM112", # flake8-simplify code styles
|
||||
"SIM113", # please fix
|
||||
"SIM105", # these ignores are from flake8-simplify. please fix or ignore with commented reason
|
||||
"SIM108",
|
||||
"SIM110",
|
||||
@ -67,7 +70,6 @@ ignore = [
|
||||
"UP006", # keep-runtime-typing
|
||||
"UP007", # keep-runtime-typing
|
||||
]
|
||||
line-length = 120
|
||||
select = [
|
||||
"B",
|
||||
"C4",
|
||||
@ -109,15 +111,18 @@ select = [
|
||||
"RUF015", # access first ele in constant time
|
||||
"RUF016", # type error non-integer index
|
||||
"RUF017",
|
||||
"TRY200",
|
||||
"TRY200", # TODO: migrate from deprecated alias
|
||||
"TRY302",
|
||||
"UP",
|
||||
]
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = [
|
||||
"F401",
|
||||
]
|
||||
"functorch/notebooks/**" = [
|
||||
"F401",
|
||||
]
|
||||
"test/typing/reveal/**" = [
|
||||
"F821",
|
||||
]
|
||||
@ -136,7 +141,8 @@ select = [
|
||||
"RUF015",
|
||||
"UP", # We don't want to modify the jit test as they test specify syntax
|
||||
]
|
||||
|
||||
# autogenerated #TODO figure out why file level noqa is ignored
|
||||
"torch/_inductor/fx_passes/serialized_patterns/**" = ["F401", "F501"]
|
||||
"torch/onnx/**" = [
|
||||
"UP037", # ONNX does runtime type checking
|
||||
]
|
||||
|
@ -2428,9 +2428,9 @@ def gen_source_files(
|
||||
},
|
||||
)
|
||||
|
||||
cpu_fm.write("Functions.cpp", lambda: {})
|
||||
cpu_fm.write("Functions.cpp", dict)
|
||||
|
||||
core_fm.write("TensorMethods.cpp", lambda: {})
|
||||
core_fm.write("TensorMethods.cpp", dict)
|
||||
|
||||
core_fm.write(
|
||||
"ATenOpList.cpp",
|
||||
|
Reference in New Issue
Block a user