Skip to content

Commit

Permalink
Add pre-commit utilities (#46)
Browse files Browse the repository at this point in the history
* Add pre-commit utilities

* isort autoflake

* add black profile

* revert formatting

* Add precommit CI

* change names
  • Loading branch information
vwxyzjn authored Jan 27, 2022
1 parent 69df35c commit bc1ae91
Show file tree
Hide file tree
Showing 17 changed files with 535 additions and 261 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: pre-commit

on:
push:
branches: [ '*' ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: pre-commit/action@v2.0.3
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: build and distribute

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: tests

on:
push:
Expand Down
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: /~https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args:
- --profile=black
- --skip=wandb
- repo: /~https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args:
- -r
- --exclude=wandb
- --in-place
- --remove-unused-variables
- --remove-all-unused-imports
- repo: /~https://github.com/python/black
rev: 21.7b0
hooks:
- id: black
args:
- --line-length=127
- --exclude=wandb
- repo: /~https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args:
- --ignore-words-list=nd,reacher,thist,ths
Loading

0 comments on commit bc1ae91

Please sign in to comment.