Skip to content

Commit

Permalink
Introduce ruff formatter and linter
Browse files Browse the repository at this point in the history
Replace yapf, isort and flake8 with much faster ruff formatter and
enforce double quote strings.

Install:
pip install ."[dev]"
pre-commit install

Run pre-commit hooks:
pre-commit run -a

Related pwr-Solaar#2295
  • Loading branch information
MattHag committed Feb 20, 2024
1 parent fa94944 commit 35016b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
18 changes: 5 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@ repos:
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.32.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: yapf
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: ['flake8-bugbear']
- id: ruff
args: [ --fix ]
- id: ruff-format
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tool.ruff]
line-length = 127
target-version = "py37"

[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", # pycodestyle
"W", # pycodestyle
"B", # flake8-bugbear
"I", # isort
]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _data_files():
'desktop-notifications': ['Notify (>= 0.7)'],
'git-commit': ['python-git-info'],
'test': ['pytest', 'pytest-cov'],
'dev': ['ruff'],
},
package_dir={'': 'lib'},
packages=['keysyms', 'hidapi', 'logitech_receiver', 'solaar', 'solaar.ui', 'solaar.cli'],
Expand Down

0 comments on commit 35016b3

Please sign in to comment.