-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from xhochy/pre-commit-hooks
Add some pre-commit hooks
- Loading branch information
Showing
6 changed files
with
109 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Taken directly from https://github.com/ambv/black/blob/master/.flake8 | ||
[flake8] | ||
ignore = E203, E266, E501, W503, C901, D104, D100 | ||
max-line-length = 88 | ||
max-complexity = 18 | ||
select = B,C,E,F,W,T4,B9 | ||
per-file-ignores = | ||
tests/**:D101,D102,D103 | ||
docstring-convention = numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: CI | ||
on: [push, pull_request] | ||
|
||
# Automatically stop old builds on the same branch/PR | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
|
||
jobs: | ||
pre-commit-checks: | ||
name: "Linux - pre-commit checks - Python 3.10" | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
env: | ||
PRE_COMMIT_USE_MICROMAMBA: 1 | ||
steps: | ||
- name: Checkout branch | ||
uses: actions/[email protected] | ||
- name: Set up micromamba | ||
uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1 | ||
- name: Add micromamba to GITHUB_PATH | ||
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH" | ||
- name: Install Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Run pre-commit checks | ||
uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
repos: | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black-conda | ||
args: | ||
- --safe | ||
- --target-version=py38 | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8-conda | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort-conda | ||
additional_dependencies: [-c, conda-forge, toml=0.10.2] | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-mypy | ||
rev: "1.5.1" | ||
hooks: | ||
- id: mypy-conda | ||
additional_dependencies: | ||
- -c | ||
- conda-forge | ||
- types-mock | ||
- types-setuptools | ||
- types-redis | ||
- types-boto | ||
- boto3-stubs | ||
- repo: https://github.com/Quantco/pre-commit-mirrors-pyupgrade | ||
rev: 3.10.1 | ||
hooks: | ||
- id: pyupgrade-conda | ||
args: | ||
- --py38-plus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[tool.black] | ||
exclude = ''' | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.venv | ||
| build | ||
| dist | ||
)/ | ||
''' | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 88 | ||
known_first_party = "{{ project_slug }}" | ||
skip_glob = '\.eggs/*,\.git/*,\.venv/*,build/*,dist/*' | ||
default_section = 'THIRDPARTY' | ||
|
||
[tool.mypy] | ||
python_version = '3.8' | ||
ignore_missing_imports = true | ||
no_implicit_optional = true | ||
check_untyped_defs = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters