Skip to content
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.yaml]
indent_size = 2
63 changes: 36 additions & 27 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Check code for common misspellings
run: poetry run pre-commit run codespell --all-files
run: poetry run prek run codespell --all-files

ruff:
name: Ruff
Expand All @@ -61,6 +61,37 @@ jobs:
- name: 🚀 Run ruff formatter
run: poetry run ruff format --check .

prek-builtin-hooks:
name: prek-builtin-hooks
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v6.0.2
- name: 🏗 Install prek
run: pipx install prek
- name: 🚀 Check for case conflicts
run: prek run check-case-conflict --all-files
- name: 🚀 Check that executables have shebangs
run: prek run check-executables-have-shebangs --all-files
- name: 🚀 Check JSON files
run: prek run check-json --all-files
- name: 🚀 Check for merge conflicts
run: prek run check-merge-conflict --all-files
- name: 🚀 Check for broken symlinks
run: prek run check-symlinks --all-files
- name: 🚀 Check TOML files
run: prek run check-toml --all-files
- name: 🚀 Check XML files
run: prek run check-xml --all-files
- name: 🚀 Check YAML files
run: prek run check-yaml --all-files
- name: 🚀 Detect Private Keys
run: prek run detect-private-key --all-files
- name: 🚀 Check End of Files
run: prek run end-of-file-fixer --all-files
- name: 🚀 Trim Trailing Whitespace
run: prek run trailing-whitespace --all-files

pre-commit-hooks:
name: pre-commit-hooks
runs-on: ubuntu-latest
Expand All @@ -82,31 +113,9 @@ jobs:
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Check Python AST
run: poetry run pre-commit run check-ast --all-files
- name: 🚀 Check for case conflicts
run: poetry run pre-commit run check-case-conflict --all-files
run: poetry run prek run check-ast --all-files
- name: 🚀 Check docstring is first
run: poetry run pre-commit run check-docstring-first --all-files
- name: 🚀 Check that executables have shebangs
run: poetry run pre-commit run check-executables-have-shebangs --all-files
- name: 🚀 Check JSON files
run: poetry run pre-commit run check-json --all-files
- name: 🚀 Check for merge conflicts
run: poetry run pre-commit run check-merge-conflict --all-files
- name: 🚀 Check for broken symlinks
run: poetry run pre-commit run check-symlinks --all-files
- name: 🚀 Check TOML files
run: poetry run pre-commit run check-toml --all-files
- name: 🚀 Check XML files
run: poetry run pre-commit run check-xml --all-files
- name: 🚀 Check YAML files
run: poetry run pre-commit run check-yaml --all-files
- name: 🚀 Detect Private Keys
run: poetry run pre-commit run detect-private-key --all-files
- name: 🚀 Check End of Files
run: poetry run pre-commit run end-of-file-fixer --all-files
- name: 🚀 Trim Trailing Whitespace
run: poetry run pre-commit run trailing-whitespace --all-files
run: poetry run prek run check-docstring-first --all-files

pylint:
name: pylint
Expand All @@ -129,7 +138,7 @@ jobs:
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run pylint
run: poetry run pre-commit run pylint --all-files
run: poetry run prek run pylint --all-files

yamllint:
name: yamllint
Expand Down Expand Up @@ -182,4 +191,4 @@ jobs:
- name: 🏗 Install NPM dependencies
run: npm install
- name: 🚀 Run prettier
run: poetry run pre-commit run prettier --all-files
run: poetry run prek run prettier --all-files
96 changes: 31 additions & 65 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,51 +21,11 @@ repos:
language: system
types: [python]
entry: poetry run check-ast
- id: check-case-conflict
name: 🔠 Check for case conflicts
language: system
entry: poetry run check-case-conflict
- id: check-docstring-first
name: ℹ️ Check docstring is first
language: system
types: [python]
entry: poetry run check-docstring-first
- id: check-executables-have-shebangs
name: 🧐 Check that executables have shebangs
language: system
types: [text, executable]
entry: poetry run check-executables-have-shebangs
stages: [pre-commit, pre-push, manual]
- id: check-json
name: { Check JSON files
language: system
types: [json]
entry: poetry run check-json
- id: check-merge-conflict
name: 💥 Check for merge conflicts
language: system
types: [text]
entry: poetry run check-merge-conflict
- id: check-symlinks
name: 🔗 Check for broken symlinks
language: system
types: [symlink]
entry: poetry run check-symlinks
- id: check-toml
name: ✅ Check TOML files
language: system
types: [toml]
entry: poetry run check-toml
- id: check-xml
name: ✅ Check XML files
entry: check-xml
language: system
types: [xml]
- id: check-yaml
name: ✅ Check YAML files
language: system
types: [yaml]
entry: poetry run check-yaml
- id: codespell
name: ✅ Check code for common misspellings
language: system
Expand All @@ -74,31 +34,12 @@ repos:
entry: poetry run codespell
args:
- --ignore-words-list=doen,te,ons,Racoon,Crate,Ede,succes,alle,Theis,serie,wel,somme,affraid,programm,earnin,couldnt,beter,als,bord,wil,hart,thuis,voight,juni,handels,ot,tru,independant,unter,hagas
- id: detect-private-key
name: 🕵️ Detect Private Keys
language: system
types: [text]
entry: poetry run detect-private-key
- id: end-of-file-fixer
name: ⮐ Fix End of Files
language: system
types: [text]
entry: poetry run end-of-file-fixer
stages: [pre-commit, pre-push, manual]
- id: mypy
name: 🆎 Static type checking using mypy
language: system
types: [python]
entry: poetry run mypy
require_serial: true
- id: no-commit-to-branch
name: 🛑 Don't commit to main branch
language: system
entry: poetry run no-commit-to-branch
pass_filenames: false
always_run: true
args:
- --branch=main
- id: poetry
name: 📜 Check pyproject with Poetry
language: system
Expand All @@ -122,14 +63,39 @@ repos:
types: [python]
entry: poetry run pytest
pass_filenames: false
- id: trailing-whitespace
name: ✄ Trim Trailing Whitespace
language: system
types: [text]
entry: poetry run trailing-whitespace-fixer
stages: [pre-commit, pre-push, manual]
- id: yamllint
name: 🎗 Check YAML files with yamllint
language: system
types: [yaml]
entry: poetry run yamllint
- repo: builtin
hooks:
- id: check-case-conflict
name: 🔠 Check for case conflicts
- id: check-executables-have-shebangs
name: 🧐 Check that executables have shebangs
stages: [pre-commit, pre-push, manual]
- id: check-json
name: { Check JSON files
- id: check-merge-conflict
name: 💥 Check for merge conflicts
- id: check-symlinks
name: 🔗 Check for broken symlinks
- id: check-toml
name: ✅ Check TOML files
- id: check-xml
name: ✅ Check XML files
- id: check-yaml
name: ✅ Check YAML files
- id: detect-private-key
name: 🕵️ Detect Private Keys
- id: end-of-file-fixer
name: ⮐ Fix End of Files
stages: [pre-commit, pre-push, manual]
- id: no-commit-to-branch
name: 🛑 Don't commit to main branch
args:
- --branch=main
- id: trailing-whitespace
name: ✄ Trim Trailing Whitespace
stages: [pre-commit, pre-push, manual]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ npm install
poetry install
```

As this repository uses the [pre-commit][pre-commit] framework, all changes
As this repository uses the [prek][prek] framework, all changes
are linted and tested with each commit. You can run all checks and tests
manually, using the following command:

```bash
poetry run pre-commit run --all-files
poetry run prek run --all-files
```

To run just the Python tests:
Expand Down Expand Up @@ -123,7 +123,7 @@ SOFTWARE.
[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg
[poetry-install]: https://python-poetry.org/docs/#installation
[poetry]: https://python-poetry.org
[pre-commit]: https://pre-commit.com/
[prek]: https://prek.j178.dev/
[project-stage-shield]: https://img.shields.io/badge/project%20stage-stable-green.svg
[python-versions-shield]: https://img.shields.io/pypi/pyversions/spotifyaio
[releases-shield]: https://img.shields.io/github/release/joostlek/python-spotify.svg
Expand Down
Loading
Loading