Skip to content

Commit

Permalink
chore: add pre-commit basic checks
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed May 25, 2022
1 parent 133b737 commit 61ea19b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: Python type check
on: [push, pull_request]
jobs:
build:
type:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Lint with mypy
run: pipx run tox -e type

pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.2.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
exclude: '(^tests/.*\.lark|\.svg)$'
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
exclude: '(^tests/.*\.lark|\.svg)$'
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html#specifying-a-requirements-file
pillow
recommonmark
sphinx-gallery
sphinx_markdown_tables
recommonmark
sphinx_rtd_theme
pillow
11 changes: 10 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36, py37, py38, py39, py310, pypy3, type
envlist = lint, type, py36, py37, py38, py39, py310, pypy3
skip_missing_interpreters = true

[testenv]
Expand Down Expand Up @@ -28,3 +28,12 @@ deps =
rich
commands =
mypy

[testenv:lint]
description = run linters on code base
skip_install = true
recreate = false
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure

0 comments on commit 61ea19b

Please sign in to comment.