Skip to content

Commit

Permalink
Add pre-commit-config and hook
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-f-cruz committed Jul 22, 2024
1 parent 76e55ea commit d2cd68d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@ on:

jobs:
linters:

runs-on: windows-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install -e .[linters] --no-cache-dir
- name: Run linters
run: ruff check . && codespell .
- uses: pre-commit/[email protected]

tests:
runs-on: windows-latest
Expand Down
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: no-commit-to-branch # prevent direct commits to main branch
- id: check-yaml
args: ['--unsafe']
- id: check-toml
- id: end-of-file-fixer
- id: trailing-whitespace


- repo: local
hooks:
- id: ruff
name: Ruff
entry: ruff check && ruff format
types: [python]
language: system
pass_filenames: false
- id: codespell
name: CodeSpell
entry: codespell
types: [python]
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ line-length = 120
target-version = 'py311'

[tool.ruff.lint]
extend-select = ['Q', 'RUF100', 'C90', 'I']
extend-select = ['Q', 'RUF100', 'C90', 'I', 'E']
extend-ignore = []
mccabe = { max-complexity = 14 }
pydocstyle = { convention = 'google' }
Expand Down

0 comments on commit d2cd68d

Please sign in to comment.