Skip to content

Commit 493d450

Browse files
authored
chore: set ruff to ALL (scikit-build#1176)
Setting ALL then ignoring is actually shorter config. Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 186a976 commit 493d450

File tree

7 files changed

+30
-59
lines changed

7 files changed

+30
-59
lines changed

pyproject.toml

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -246,60 +246,29 @@ ignore = ["W002"] # Triggers on __init__.py's
246246
exclude = ["src/scikit_build_core/_vendor/*"]
247247

248248
[tool.ruff.lint]
249-
extend-select = [
250-
"ANN", # flake8-annotations
251-
"ARG", # flake8-unused-arguments
252-
"B", # flake8-bugbear
253-
"BLE", # flake8-blind-except
254-
"C4", # flake8-comprehensions
255-
"DTZ", # flake8-datetimez
256-
"EM", # flake8-errmsg
257-
"EXE", # flake8-executable
258-
"FA", # flake8-future-annotations
259-
"FBT", # flake8-boolean-trap
260-
"FLY", # flynt
261-
"FURB", # refurb
262-
"G", # flake8-logging-format
263-
"I", # isort
264-
"ICN", # flake8-import-conventions
265-
"ISC", # flake8-implicit-str-concat
266-
"LOG", # flake8-logging
267-
"N", # flake8-naming
268-
"PERF", # perflint
269-
"PGH", # pygrep-hooks
270-
"PIE", # flake8-pie
271-
"PL", # pylint
272-
"PT", # flake8-pytest-style
273-
"PTH", # flake8-use-pathlib
274-
"PYI", # flake8-pyi
275-
"Q", # flake8-quotes
276-
"RET", # flake8-return
277-
"RSE", # flake8-raise
278-
"RUF", # Ruff-specific
279-
"S", # eval -> literal_eval
280-
"SIM", # flake8-simplify
281-
"SLOT", # flake8-slots
282-
"T10", # flake8-debugger
283-
"T20", # flake8-print
284-
"TC", # flake8-type-checking
285-
"TID251", # flake8-tidy-imports.banned-api
286-
"TRY", # tryceratops
287-
"UP", # pyupgrade
288-
"YTT", # flake8-2020
289-
]
249+
select = ["ALL"]
290250
ignore = [
291-
"ANN401", # Disallow dynamically typed expressions
251+
"A", # Okay to shadow builtins
252+
"ANN401", # Disallow Any
253+
"C90", # Complexity
254+
"COM", # Trailing commas teach the formatter
255+
"D", # Too many doc requests
256+
"E501", # Line too long
257+
"ERA", # Commented out code
258+
"FIX", # Hacks and todos
292259
"PLC0415", # Import should be at top of file
293260
"PLE1205", # Format check doesn't work with our custom logger
294261
"PLR09", # Too many ...
295262
"PLR2004", # Magic value used in comparison
296263
"PT013", # It's correct to import classes for typing!
297-
"PYI025", # Wants Set to be renamed AbstractSet
298-
"RUF009", # Too easy to get a false positive
264+
"RUF009", # Too easy to get a false positive (function call in dataclass defaults)
299265
"S101", # Use of assert detected
300266
"S404", # subprocess module is possibly insecure
301267
"S603", # subprocess untrusted input
302268
"S607", # subprocess call
269+
"SLF001", # Private members are okay to access
270+
"TD", # Todo format
271+
"TID252", # Relative imports are fine
303272
]
304273
typing-modules = ["scikit_build_core._compat.typing"]
305274

@@ -328,7 +297,7 @@ known-local-folder = ["pathutils"]
328297

329298

330299
[tool.ruff.lint.per-file-ignores]
331-
"tests/**" = ["T20", "ANN", "FBT001"]
300+
"tests/**" = ["T20", "ANN", "FBT001", "INP"]
332301
"noxfile.py" = ["T20", "TID251"]
333302
"src/scikit_build_core/resources/*.py" = ["PTH", "ARG002", "FBT", "TID251"]
334303
"src/scikit_build_core/_compat/**.py" = ["TID251"]
@@ -337,6 +306,7 @@ known-local-folder = ["pathutils"]
337306
"tests/conftest.py" = ["TID251"]
338307
"tests/packages/**.py" = ["TID251"]
339308
"tests/test_settings.py" = ["FA"]
309+
"docs/**" = ["INP"]
340310
"docs/conf.py" = ["TID251"]
341311
"docs/examples/**" = ["ANN"]
342312
"src/scikit_build_core/file_api/model/*.py" = ["N"]

src/scikit_build_core/build/_wheelfile.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
from .. import __version__
2121

2222
if TYPE_CHECKING:
23-
from collections.abc import Mapping, Sequence, Set
23+
from collections.abc import Mapping, Sequence
24+
from collections.abc import Set as AbstractSet
2425

2526
from packaging.tags import Tag
2627

@@ -48,7 +49,7 @@ class WheelMetadata:
4849
root_is_purelib: bool = False
4950
metadata_version: str = "1.0"
5051
generator: str = f"scikit-build-core {__version__}"
51-
tags: Set[Tag] = dataclasses.field(default_factory=frozenset)
52+
tags: AbstractSet[Tag] = dataclasses.field(default_factory=frozenset)
5253
build_tag: str = ""
5354

5455
def as_bytes(self) -> bytes:
@@ -72,7 +73,7 @@ class WheelWriter:
7273

7374
metadata: StandardMetadata
7475
folder: Path
75-
tags: Set[Tag]
76+
tags: AbstractSet[Tag]
7677
wheel_metadata: WheelMetadata
7778
metadata_dir: Path | None
7879
_zipfile: zipfile.ZipFile | None = None

tests/test_auto.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ def test_auto_cmake_version(expr: str, answer: str):
7272
def test_auto_cmake_version_block(block: str):
7373
txt = textwrap.dedent(f"""\
7474
# cmake_minimum_version(VERSION 3.1)
75-
75+
7676
#[[
7777
cmake_minimum_required(VERSION 3.2)
7878
]]
79-
79+
8080
{block}()
81-
cmake_minimum_required(VERSION 3.3)
81+
cmake_minimum_required(VERSION 3.3)
8282
end{block}()
8383
8484
cmake_MINimum_required(VERSION 3.4)
8585
86-
cmake_minimum_required(VERSION 3.5)
86+
cmake_minimum_required(VERSION 3.5)
8787
""")
8888
res = find_min_cmake_version(txt)
8989
assert res == "3.4"

tests/test_cmake_ast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def test_cmake_ast_parse_long():
6969
)
7070
7171
# Add executable
72-
add_executable(TokenizationExample
73-
src/main.cpp
72+
add_executable(TokenizationExample
73+
src/main.cpp
7474
src/utils.cpp
7575
)
7676

tests/test_editable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ def test_importlib_resources(monkeypatch, tmp_path, editable, editable_mode, iso
262262
from importlib import import_module
263263
from importlib.resources import files
264264
from pathlib import Path
265-
265+
266266
def is_extension(path):
267267
for ext in (".so", ".pyd"):
268268
if ext in path.suffixes:
269269
return True
270270
return False
271-
271+
272272
def check_pkg(pkg_name):
273273
try:
274274
pkg = import_module(pkg_name)
@@ -281,7 +281,7 @@ def check_pkg(pkg_name):
281281
except Exception as err:
282282
msg = f"Failed in {str(pkg)}"
283283
raise RuntimeError(msg) from err
284-
284+
285285
check_pkg("pkg")
286286
check_pkg("pkg.sub_a")
287287
check_pkg("pkg.sub_b")

tests/test_get_requires.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_get_requires_parts_pyproject_old(
7979
monkeypatch.chdir(tmp_path)
8080
tmp_path.joinpath("pyproject.toml").write_text(
8181
"""
82-
82+
8383
[tool.scikit-build]
8484
minimum-version = "0.0"
8585
cmake.minimum-version = "3.21"

tests/test_settings_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_skbuild_docs_sphinx() -> None:
2929
textwrap.dedent("""\
3030
.. confval:: cmake.define
3131
:type: ``EnvVar``
32-
32+
3333
A table of defines to pass to CMake when configuring the project. Additive.
3434
""")
3535
in docs

0 commit comments

Comments
 (0)