Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andgineer committed Aug 8, 2021
1 parent 3546d95 commit a475b44
Show file tree
Hide file tree
Showing 59 changed files with 1,286 additions and 530 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"postCreateCommand": "pip install --no-cache-dir -r requirements.txt",

// Set *default* container specific settings.json values on container create.
"settings": {
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/local/bin/python",
"python.linting.enabled": true,
Expand Down
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
ignore = F401,F403,W503,E203,E402
max-line-length = 99
per-file-ignores = bombard/mock_globals.py:F401
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: [3.6, 3.7, 3.8]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[mypy]
ignore_missing_imports = True
101 changes: 101 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: ["--unsafe"]
- id: check-added-large-files

- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
name: Cleanup imports
args:
- --in-place
- --remove-all-unused-imports
- --expand-star-imports
- --ignore-init-module-imports

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
hooks:
- id: isort
name: Sorts imports
args: [
# Align isort with black formatting
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--use-parentheses",
"--line-width=99",
]

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
name: Fixes formatting
language_version: python3
args: ["--line-length=99"]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
name: Checks pep8 style
args:
- --max-line-length=99
# F405 - init imports * from module
# F401 - ignore imports used in init
# F403 - import * used in init
- --exclude=__init__.py
# ignore long comments (E501), as long lines are formatted by black
# ignore Whitespace before ':' (E203)
# ignore Line break occurred before a binary operator (W503)
# ignore module level import not at top of file (E402) to skip tests with uninstalled modules (pytest.importorskip)
- --ignore=E501,E203,W503,E402

- repo: local
hooks:
- id: mypy
name: mypy
entry: dmypy
files: \.py$
language: python
args: ["run", "--", "--strict", "--implicit-reexport", "--warn-unused-ignores", "--cache-fine-grained"]

- id: pylint
name: Pylint
entry: pylint --max-line-length=99 --ignore-imports=yes
files: \.py$
language: python

- id: jupyisort
name: Sorts ipynb imports
entry: jupytext --pipe-fmt ".py" --pipe "isort - --multi-line=3 --trailing-comma --force-grid-wrap=0 --use-parentheses --line-width=99"
files: \.ipynb$
language: python

- id: jupyblack
name: Fixes ipynb format
entry: jupytext --pipe-fmt ".py" --pipe "black - --line-length=99"
files: \.ipynb$
language: python

- id: nbconvert
name: Removes ipynb content
entry: jupyter nbconvert
args:
[
"--ClearOutputPreprocessor.enabled=True",
"--ClearMetadataPreprocessor.enabled=True",
"--RegexRemovePreprocessor.enabled=True",
"--to=notebook",
"--log-level=ERROR",
"--inplace",
]
files: \.ipynb$
language: python

0 comments on commit a475b44

Please sign in to comment.