Skip to content

Commit

Permalink
Use pre-commit to test style
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Nov 30, 2023
1 parent 31a4b1e commit 8e823a9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ jobs:
- name: Add matching rule
run: echo ::add-matcher::.github/flake8-matcher.json

- name: Run ruff
- name: Run style check
if: ${{ always() }}
run: |
ruff check .
- name: Run black
if: ${{ always() }}
uses: psf/black@stable
pre-commit run --all-files --show-diff-on-failure
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*.user.*
.nfs*
*.swp
.pre-commit-config.yaml
.idea
.vscode
.pytest_cache
Expand Down
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args: [ --fix ]

- repo: https://github.com/ambv/black
rev: 23.11.0
hooks:
- id: black
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ dev = [
]
style = [
"cmake-format",
"black",
"ruff",
"pre-commit",
]
types = [
"mypy",
Expand Down

0 comments on commit 8e823a9

Please sign in to comment.