Skip to content

Commit cd11ae7

Browse files
committed
use ruff
1 parent f28bd1d commit cd11ae7

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
exclude: (^hls4ml\/templates\/(vivado|quartus)\/(ap_types|ac_types)\/|^test/pytest/test_report/)
22

33
repos:
4-
- repo: https://github.com/psf/black
5-
rev: 25.1.0
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.11.5
66
hooks:
7-
- id: black
8-
language_version: python3
9-
args: ['--line-length=125',
10-
'--skip-string-normalization']
7+
- id: ruff
8+
args: [--fix]
9+
- id: ruff-format
1110

1211
- repo: https://github.com/tox-dev/pyproject-fmt
1312
rev: v2.5.1
@@ -29,11 +28,6 @@ repos:
2928
- id: requirements-txt-fixer
3029
- id: trailing-whitespace
3130

32-
- repo: https://github.com/PyCQA/isort
33-
rev: 6.0.1
34-
hooks:
35-
- id: isort
36-
3731
- repo: https://github.com/asottile/pyupgrade
3832
rev: v3.19.1
3933
hooks:
@@ -47,7 +41,9 @@ repos:
4741
exclude: docs/conf.py
4842
additional_dependencies: [flake8-bugbear, flake8-print]
4943
args: ['--max-line-length=125', # github viewer width
50-
'--extend-ignore=E203,T201'] # E203 is not PEP8 compliant
44+
'--extend-ignore=E203,T201,F401']
45+
# E203 is not PEP8 compliant
46+
# F401 included in ruff (behaves slightly differently for noqa flags)
5147

5248
- repo: https://github.com/mgedmin/check-manifest
5349
rev: "0.50"

pyproject.toml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,24 @@ git_describe_command = [
8282
]
8383
write_to = "hls4ml/_version.py"
8484

85-
[tool.black]
85+
[tool.ruff]
86+
target-version = "py310"
87+
8688
line-length = 125
87-
skip-string-normalization = true
89+
indent-width = 4
90+
include = [ "hls4ml/**/*.py", "tests/**/*.py" ]
91+
exclude = [ "hls4ml/_version.py", "hls4ml/templates/**" ]
92+
93+
format.quote-style = "single"
94+
format.skip-magic-trailing-comma = false
95+
format.docstring-code-line-length = 125
96+
format.docstring-code-format = true
97+
lint.select = [ "E", "F", "F401", "I", "W" ]
98+
lint.ignore = [ "E741" ]
99+
lint.per-file-ignores = { "__init__.py" = [ "F401" ] }
88100

89-
[tool.isort]
90-
profile = "black"
91-
line_length = 125
101+
lint.fixable = [ "ALL" ]
102+
lint.unfixable = [ ]
92103

93104
[tool.check-manifest]
94105
ignore = [

0 commit comments

Comments
 (0)