From afac37d068fb97bba51f9ac422bcfe98a6587e65 Mon Sep 17 00:00:00 2001 From: drc38 <20024196+drc38@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:18:27 +1300 Subject: [PATCH] Switch to ruff (#367) --- .github/workflows/constraints.txt | 4 +--- .github/workflows/tests.yaml | 2 +- .pre-commit-config.yaml | 20 ++++---------------- tests/test_init.py | 2 +- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 3fb3199..c5b99bb 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -1,9 +1,7 @@ pip>=8.0.3,<24.1 pre-commit==3.7.0 bandit==1.7.8 -black==24.3.0 -flake8==7.0.0 -isort==5.13.2 +ruff==0.3.5 pre-comit-hooks==4.1.0 pyupgrade==3.15.0 reorder-python-imports==3.12.0 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f2a490c..808181b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -31,7 +31,7 @@ jobs: - name: Install Python modules run: | - pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports + pip install --constraint=.github/workflows/constraints.txt pre-commit ruff - name: Run pre-commit on all files run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 511f9f0..3885a37 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,24 +8,12 @@ repos: - id: trailing-whitespace - repo: local hooks: - - id: black - name: black - entry: black + - id: ruff + name: ruff + entry: ruff language: system types: [python] - require_serial: true - - id: flake8 - name: flake8 - entry: flake8 - language: system - types: [python] - require_serial: true - - id: reorder-python-imports - name: Reorder python imports - entry: reorder-python-imports - language: system - types: [python] - args: [--application-directories=custom_components] + args: [--fix] - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.2.1 hooks: diff --git a/tests/test_init.py b/tests/test_init.py index 04ccddf..fae26c1 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -48,7 +48,7 @@ async def test_setup_unload_and_reload_entry(hass, bypass_get_data, skip_api_sta ) # Unload the entry and verify that the data has been removed - assert await async_unload_entry(hass, config_entry) + await async_unload_entry(hass, config_entry) assert config_entry.entry_id not in hass.data[DOMAIN]