Skip to content

Commit 47ea0b1

Browse files
authored
Replace flake8/isort/black with ruff for linting (#64)
1 parent 0bee201 commit 47ea0b1

File tree

5 files changed

+28
-24
lines changed

5 files changed

+28
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ runtime/
9999

100100
# IntelliJ Idea family of suites
101101
.idea
102+
103+
# Ruff linter cache files
104+
.ruff_cache

.pre-commit-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,14 @@ repos:
88
- id: check-docstring-first
99
- id: end-of-file-fixer
1010
- id: trailing-whitespace
11-
- repo: https://github.com/PyCQA/isort
12-
# For split_on_trailing_comma. Should be in the release after 5.10.1
13-
rev: 6.0.1
14-
hooks:
15-
- id: isort
16-
additional_dependencies: [toml]
1711
- repo: https://github.com/asottile/pyupgrade
1812
rev: v3.20.0
1913
hooks:
2014
- id: pyupgrade
2115
args: [--py38-plus]
22-
- repo: https://github.com/psf/black-pre-commit-mirror
23-
rev: 25.9.0
24-
hooks:
25-
- id: black
26-
language_version: python3
27-
- repo: https://github.com/PyCQA/flake8
28-
rev: 7.3.0
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.11.13
2918
hooks:
30-
- id: flake8
19+
- id: ruff-check
20+
args: [ --fix ]
21+
- id: ruff-format

nslog.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class CFTypeRef(ctypes.c_void_p):
3737
CoreFoundation.CFRelease.restype = None
3838
CoreFoundation.CFRelease.argtypes = [CFTypeRef]
3939

40-
# CFStringRef CFStringCreateWithCharacters(CFAllocatorRef alloc, const UniChar *chars, CFIndex numChars)
40+
# CFStringRef CFStringCreateWithCharacters(
41+
# CFAllocatorRef alloc, const UniChar *chars, CFIndex numChars
42+
# )
4143
CoreFoundation.CFStringCreateWithCharacters.restype = CFTypeRef
4244
CoreFoundation.CFStringCreateWithCharacters.argtypes = [
4345
CFTypeRef,

pyproject.toml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22
requires = ["setuptools>=60"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.isort]
6-
profile = "black"
7-
split_on_trailing_comma = true
8-
combine_as_imports = true
5+
[tool.ruff.lint]
6+
# In addition to the default rules, these additional rules will be used:
7+
extend-select = [
8+
"E", # pycodestyle
9+
"W", # pycodestyle
10+
"F", # pyflakes
11+
"UP", # pyupgrade
12+
"B", # flake8-bugbear
13+
"YTT", # flake8-2020
14+
"ASYNC", # flake8-async
15+
"C4", # flake8-comprehensions
16+
"I", # isort
17+
# The SIM rules are *very* opinionated, and don't necessarily make for better code.
18+
# They may be worth occasionally turning on just to see if something could actually
19+
# use improvement.
20+
# "SIM", # flake8-simplify
21+
]

setup.cfg

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,3 @@ platforms = any
4242
[options]
4343
py_modules = nslog
4444
python_requires = >= 3.7
45-
46-
[flake8]
47-
max-complexity = 25
48-
max-line-length = 119
49-
ignore = E203

0 commit comments

Comments
 (0)