Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Use pipx for lint and rstcheck #807

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ on:
- master

jobs:
flake8:
lint:
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 .
run: make lint
9 changes: 1 addition & 8 deletions .github/workflows/rstcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,5 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install rstcheck
- name: Run rstcheck
run: |
python -m rstcheck --ignore-directives autofunction README.rst reference/*.rst
run: make rstcheck
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lint:
# ignore errors for long lines and multi-statement lines
@pipx run flake8 --ignore=E501,E701,W503 .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is flake8 getting installed? Same for rstcheck below.

Modern projects use pre-commit instead of make.


rstcheck:
@pipx run rstcheck --ignore-directives autofunction README.rst reference/*.rst
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ Releases are done by running ``make-release.sh VERSION_GOES_HERE`` to build the
Testing
~~~~~~~

Prerequisite: `Install pipx <https://pipx.pypa.io/stable/installation/>`__.

To run all the tests:

.. code:: bash
Expand All @@ -306,13 +308,13 @@ To run static analysis:

.. code:: bash

python -m flake8 --ignore=E501,E701,W503 speech_recognition tests examples setup.py
make lint

To ensure RST is well-formed:

.. code:: bash

python -m rstcheck README.rst reference/*.rst
make rstcheck

Testing is also done automatically by GitHub Actions, upon every push.

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[options.extras_require]
dev =
flake8
rstcheck
pytest
pytest-randomly
respx
Expand Down
Loading