Introduce ruff formatter and linter
Replace yapf, isort and flake8 with much faster ruff formatter. Remove conflicting rule and switch to double quotes for strings. Install: pip install ."[dev]" pre-commit install Run pre-commit hooks: pre-commit run -a Related #2295
This commit is contained in:
parent
ce00a78e7f
commit
fb6285606d
|
|
@ -8,19 +8,14 @@ repos:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
- id: debug-statements
|
- id: debug-statements
|
||||||
- id: double-quote-string-fixer
|
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/pre-commit/mirrors-yapf
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.32.0
|
rev: v0.2.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: yapf
|
- id: ruff
|
||||||
- repo: https://github.com/pre-commit/mirrors-isort
|
name: ruff lint
|
||||||
rev: v5.10.1
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
hooks:
|
- id: ruff-format
|
||||||
- id: isort
|
name: ruff format
|
||||||
- repo: https://github.com/PyCQA/flake8
|
args: [--diff]
|
||||||
rev: 6.0.0
|
|
||||||
hooks:
|
|
||||||
- id: flake8
|
|
||||||
additional_dependencies: ['flake8-bugbear']
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 127
|
||||||
|
target-version = "py37"
|
||||||
|
|
||||||
|
[tool.ruff.lint]
|
||||||
|
select = [
|
||||||
|
"F", # Pyflakes
|
||||||
|
"E", # pycodestyle
|
||||||
|
"W", # pycodestyle
|
||||||
|
"B", # flake8-bugbear
|
||||||
|
"I", # isort
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.ruff.lint.isort]
|
||||||
|
lines-between-types = 1
|
||||||
15
setup.cfg
15
setup.cfg
|
|
@ -1,15 +0,0 @@
|
||||||
[flake8]
|
|
||||||
max-line-length = 127
|
|
||||||
extend-ignore = E266,E731,E741
|
|
||||||
min-python-version = 3.5
|
|
||||||
|
|
||||||
[yapf]
|
|
||||||
column_limit = 127
|
|
||||||
dedent_closing_brackets = True
|
|
||||||
coalesce_brackets = True
|
|
||||||
|
|
||||||
[isort]
|
|
||||||
line_length = 127
|
|
||||||
lines_between_types = 1
|
|
||||||
;blocked by https://github.com/google/yapf/issues/429
|
|
||||||
;lines_after_imports = 2
|
|
||||||
1
setup.py
1
setup.py
|
|
@ -86,6 +86,7 @@ For instructions on installing Solaar see https://pwr-solaar.github.io/Solaar/in
|
||||||
'desktop-notifications': ['Notify (>= 0.7)'],
|
'desktop-notifications': ['Notify (>= 0.7)'],
|
||||||
'git-commit': ['python-git-info'],
|
'git-commit': ['python-git-info'],
|
||||||
'test': ['pytest', 'pytest-cov'],
|
'test': ['pytest', 'pytest-cov'],
|
||||||
|
'dev': ['ruff'],
|
||||||
},
|
},
|
||||||
package_dir={'': 'lib'},
|
package_dir={'': 'lib'},
|
||||||
packages=['keysyms', 'hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
|
packages=['keysyms', 'hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue