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. 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 pwr-Solaar#2295
  • Loading branch information
MattHag committed Feb 20, 2024
1 parent fa94944 commit 159278f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
21 changes: 8 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ 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
name: ruff lint
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
name: ruff format
args: [--diff]
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
]
15 changes: 0 additions & 15 deletions setup.cfg

This file was deleted.

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 159278f

Please sign in to comment.