Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruff: enable pep8-naming rules #18144

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T:
return visitor.visit_str_expr(self)


def is_StrExpr_list(seq: list[Expression]) -> TypeGuard[list[StrExpr]]:
def is_StrExpr_list(seq: list[Expression]) -> TypeGuard[list[StrExpr]]: # noqa: N802
return all(isinstance(item, StrExpr) for item in seq)


Expand Down
2 changes: 1 addition & 1 deletion mypy/test/teststubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def test(cls, arg0: str) -> None:
def test_generate_c_type_classmethod_with_overloads(self) -> None:
class TestClass:
@classmethod
def test(self, arg0: str) -> None:
def test(cls, arg0: str) -> None:
"""
test(cls, arg0: str)
test(cls, arg0: int)
Expand Down
2 changes: 1 addition & 1 deletion mypyc/lib-rt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
compile_args = ["--std=c++11"]


class build_ext_custom(build_ext):
class build_ext_custom(build_ext): # noqa: N801
def get_library_names(self):
return ["gtest"]

Expand Down
2 changes: 1 addition & 1 deletion mypyc/test/test_emitfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_integer(self) -> None:
def test_tuple_get(self) -> None:
self.assert_emit(TupleGet(self.t, 1, 0), "cpy_r_r0 = cpy_r_t.f1;")

def test_load_None(self) -> None:
def test_load_None(self) -> None: # noqa: N802
self.assert_emit(
LoadAddress(none_object_op.type, none_object_op.src, 0),
"cpy_r_r0 = (PyObject *)&_Py_NoneStruct;",
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ select = [
"W", # pycodestyle (warning)
"B", # flake8-bugbear
"I", # isort
"N", # pep8-naming
"RUF100", # Unused noqa comments
"PGH004", # blanket noqa comments
"UP", # pyupgrade
Expand All @@ -68,6 +69,8 @@ ignore = [
"E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for isinstance checks
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # Ambiguous variable name
"N818", # Exception should be named with an Error suffix
"N806", # UPPER_CASE used for constant local variables
"UP031", # Use format specifiers instead of percent format
"UP032", # 'f-string always preferable to format' is controversial
"C416", # There are a few cases where it's nice to have names for the dict items
Expand All @@ -81,6 +84,10 @@ unfixable = [
"UP036", # sometimes it's better to just noqa this
]

[tool.ruff.lint.per-file-ignores]
# Mixed case variable and function names.
"mypy/fastparse.py" = ["N802", "N816"]

[tool.ruff.lint.isort]
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
Expand Down
Loading