From 1f9d8a6dccb3a3476c5f14c2c257821321ad1846 Mon Sep 17 00:00:00 2001 From: ftnext Date: Thu, 12 Dec 2024 23:30:32 +0900 Subject: [PATCH 1/3] [refactor] Extract lint command --- .github/workflows/lint.yml | 6 ++---- Makefile | 3 +++ README.rst | 2 +- setup.cfg | 1 - 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 50bd307c..6a4291f1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..d65ea570 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +lint: +# ignore errors for long lines and multi-statement lines + @pipx run flake8 --ignore=E501,E701,W503 . diff --git a/README.rst b/README.rst index 0052ccf4..30d7a77c 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 + make lint To ensure RST is well-formed: diff --git a/setup.cfg b/setup.cfg index 8de63858..a8ec4919 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [options.extras_require] dev = - flake8 rstcheck pytest pytest-randomly From 9e6f97ac0eed9a7d1b64e6e2a96d71e4f184da33 Mon Sep 17 00:00:00 2001 From: ftnext Date: Thu, 12 Dec 2024 23:33:21 +0900 Subject: [PATCH 2/3] [refactor] Extract rstcheck --- .github/workflows/rstcheck.yml | 9 +-------- Makefile | 3 +++ README.rst | 2 +- setup.cfg | 1 - 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rstcheck.yml b/.github/workflows/rstcheck.yml index 89635395..c27a54cd 100644 --- a/.github/workflows/rstcheck.yml +++ b/.github/workflows/rstcheck.yml @@ -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 diff --git a/Makefile b/Makefile index d65ea570..cbf1e79c 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ lint: # ignore errors for long lines and multi-statement lines @pipx run flake8 --ignore=E501,E701,W503 . + +rstcheck: + @pipx run rstcheck --ignore-directives autofunction README.rst reference/*.rst diff --git a/README.rst b/README.rst index 30d7a77c..37e90b91 100644 --- a/README.rst +++ b/README.rst @@ -312,7 +312,7 @@ 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. diff --git a/setup.cfg b/setup.cfg index a8ec4919..33ac0595 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,5 @@ [options.extras_require] dev = - rstcheck pytest pytest-randomly respx From 3f9403b4827184c078cb7149900ce23220c060d1 Mon Sep 17 00:00:00 2001 From: ftnext Date: Thu, 12 Dec 2024 23:35:27 +0900 Subject: [PATCH 3/3] [docs] Show pipx installation for developers --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 37e90b91..afb69b66 100644 --- a/README.rst +++ b/README.rst @@ -296,6 +296,8 @@ Releases are done by running ``make-release.sh VERSION_GOES_HERE`` to build the Testing ~~~~~~~ +Prerequisite: `Install pipx `__. + To run all the tests: .. code:: bash