From 421030d1fcc28bb7868721b1f6fab2a12fb417bf Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 10 Dec 2024 08:40:18 +0100 Subject: [PATCH] Python lint: Replace flake8 with ruff --- .github/workflows/lint.yml | 8 ++------ README.rst | 2 +- ruff.toml | 4 ++++ setup.cfg | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 ruff.toml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 50bd307c..cde6062a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,12 +9,8 @@ on: - master jobs: - flake8: + ruff: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - - name: Run flake8 - run: | - # ignore errors for long lines and multi-statement lines - pipx run flake8 --ignore=E501,E701,W503 . + - uses: astral-sh/ruff-action@v2 diff --git a/README.rst b/README.rst index 0052ccf4..2b5dabf1 100644 --- a/README.rst +++ b/README.rst @@ -306,7 +306,7 @@ To run static analysis: .. code:: bash - python -m flake8 --ignore=E501,E701,W503 speech_recognition tests examples setup.py + ruff check To ensure RST is well-formed: diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..0517c697 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,4 @@ +line-length = 671 +lint.ignore = ["E701"] +lint.mccabe.max-complexity = 23 +lint.select = ["C9", "E", "F", "W"] diff --git a/setup.cfg b/setup.cfg index 8de63858..55344036 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,10 @@ [options.extras_require] dev = - flake8 - rstcheck pytest pytest-randomly respx + rstcheck + ruff audio = PyAudio >= 0.2.11 pocketsphinx = @@ -13,8 +13,8 @@ whisper-local = openai-whisper soundfile openai = - openai httpx < 0.28 + openai groq = groq httpx < 0.28