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

update linters #33

Merged
merged 1 commit into from
Jan 28, 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 .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "[email protected]:bl-sdk/common_dotfiles.git",
"commit": "fb06ff8c773806b3f8cc69dbda60c0a7b481c6de",
"commit": "57d16dc4c4604beb228e8c04c31fb010954eb466",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,6 @@ jobs:
- name: Check spelling
uses: crate-ci/typos@master

black:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check formatting
uses: psf/black@stable
with:
options: --check --verbose
src: ./stubs

pyright:
runs-on: ubuntu-latest

Expand All @@ -356,7 +343,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Ruff
- name: Run Ruff Linting
uses: chartboost/ruff-action@v1
with:
src: ./stubs

- name: Run Ruff Formatting
uses: chartboost/ruff-action@v1
with:
src: ./stubs
args: format --check
28 changes: 24 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[tool.black]
target-version = ["py311"]
line-length = 100

[tool.pyright]
pythonVersion = "3.11"
typeCheckingMode = "strict"
Expand All @@ -23,13 +19,17 @@ select = [
"YTT",
"ANN",
"ASYNC",
"S",
"BLE",
"B",
"A",
"COM",
"C4",
"DTZ",
"T10",
"FA",
"ISC",
"ICN",
"G",
"PIE",
"PYI",
Expand All @@ -39,11 +39,19 @@ select = [
"SLOT",
"SIM",
"TID",
"TCH",
"INT",
"ARG",
"PTH",
"TD",
"FIX",
"ERA",
"PGH",
"PL",
"FLY",
"PERF",
"FURB",
"LOG",
"RUF",
]
ignore = [
Expand All @@ -67,11 +75,23 @@ ignore = [
"ANN101",
"ANN102",
"ANN401",
"S101",
"S603",
"S607",
"PYI011",
"PYI021",
"PYI029",
"PYI044",
"PGH003",
"PLR0904",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
"PLR6301",
"PLW0603",
"PLW2901",
"FURB140",
]

[tool.ruff.per-file-ignores]
Expand Down
8 changes: 5 additions & 3 deletions stubs/unrealsdk/hooks/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205, FIX004

from __future__ import annotations

from collections.abc import Callable
Expand All @@ -22,7 +24,7 @@ class Block:
"""
A sentinel used to indicate a hook should block execution of the unrealscript
function.
""" # noqa: D205
"""

# HACK: Pybind enums are completely normal classes, they don't inherit from the standard library
# enums, which means we're not allowed to use them in Literal type hints.
Expand Down Expand Up @@ -67,7 +69,7 @@ class Unset:
"""
A sentinel used to indicate a return value override is unset - i.e. the actual
return value will be used.
""" # noqa: D205
"""

_HookBlockSignal: TypeAlias = None | EllipsisType | Block | type[Block]
_PreHookCallback: TypeAlias = Callable[
Expand Down Expand Up @@ -170,7 +172,7 @@ def log_all_calls(should_log: bool) -> None:

Args:
should_log: True to turn on logging all calls, false to turn it off.
""" # noqa: D205
"""

def remove_hook(func: str, type: Type, identifier: str) -> bool:
"""
Expand Down
12 changes: 7 additions & 5 deletions stubs/unrealsdk/logging/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205

from __future__ import annotations

from typing import Any, ClassVar
Expand Down Expand Up @@ -87,7 +89,7 @@ def dev_warning(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def error(*args: Any, **kwargs: Any) -> None:
"""
Expand All @@ -97,7 +99,7 @@ def error(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def info(*args: Any, **kwargs: Any) -> None:
"""
Expand All @@ -107,7 +109,7 @@ def info(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def is_console_ready() -> bool:
"""
Expand All @@ -127,7 +129,7 @@ def misc(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""

def set_console_level(level: Level) -> bool:
"""
Expand All @@ -149,4 +151,4 @@ def warning(*args: Any, **kwargs: Any) -> None:
Args:
*args: Forwarded to print().
**kwargs: Forwarded to print().
""" # noqa: D205
"""
4 changes: 3 additions & 1 deletion stubs/unrealsdk/unreal/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205

from __future__ import annotations

from ._bound_function import BoundFunction
Expand Down Expand Up @@ -80,4 +82,4 @@ def dir_includes_unreal(should_include: bool) -> None:

Args:
should_include: True if to include dynamic properties, false to not.
""" # noqa: D205
"""
10 changes: 6 additions & 4 deletions stubs/unrealsdk/unreal/_wrapped_array.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ruff: noqa: D205

from __future__ import annotations

from collections.abc import Callable, Iterator, Sequence
Expand All @@ -18,7 +20,7 @@ class WrappedArray(Generic[_T]):

Args:
values: The sequence of values to append.
""" # noqa: D205
"""
@classmethod
def __class_getitem__(cls, *args: Any, **kwargs: Any) -> GenericAlias:
"""
Expand Down Expand Up @@ -111,7 +113,7 @@ class WrappedArray(Generic[_T]):

Args:
num: The number of times to repeat.
""" # noqa: D205
"""
def __new__(cls, *args: Any, **kwargs: Any) -> Never: ...
def __radd__(self, values: Sequence[_T]) -> list[_T]:
"""
Expand All @@ -120,7 +122,7 @@ class WrappedArray(Generic[_T]):

Args:
values: The sequence of values to append.
""" # noqa: D205
"""
def __repr__(self) -> str:
"""
Gets a string representation of this array.
Expand All @@ -142,7 +144,7 @@ class WrappedArray(Generic[_T]):

Args:
num: The number of times to repeat.
""" # noqa: D205
"""
@overload
def __setitem__(self, idx: int, value: _T) -> None:
"""
Expand Down
Loading