diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c195bc21..5323dd04 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..285ad5ca --- /dev/null +++ b/pyproject.toml @@ -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 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 23b6a27f..00000000 --- a/setup.cfg +++ /dev/null @@ -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 diff --git a/setup.py b/setup.py index 6d15b725..b7ed3ef3 100755 --- a/setup.py +++ b/setup.py @@ -86,6 +86,7 @@ For instructions on installing Solaar see https://pwr-solaar.github.io/Solaar/in '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'],