Fix pre-commit hook + linting jobs for OAPEN engine (#14)

* sync upstream

* isort, black, flake8 precommit hook

* Ignore bin

* reset bin

* reset bin

* try to fix black

* remove bin!

* update gh action
pull/15/head^2
Celina Peralta 2022-10-23 19:51:47 -04:00 committed by GitHub
parent 033fc1e56e
commit 1520f08b05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 36 deletions

5
.flake8 Normal file
View File

@ -0,0 +1,5 @@
[flake8]
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
ignore = E203, E266, E501, W503, F403, F401

View File

@ -22,7 +22,7 @@ jobs:
pipenv install --deploy --dev
pipenv run isort --profile black src/
pipenv run black --check src/ --exclude="lib/*"
pipenv run flake8 src/ --ignore="lib/* W"
pipenv run flake8 src/ --ignore="lib/*, W, E203, E266, E501, W503, F403, F401"
pipenv run pytest

9
.isort.cfg Normal file
View File

@ -0,0 +1,9 @@
[settings]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
skip=[lib/, bin/]
profile=black
known_third_party = data,lib,model,nltk,pandas,psycopg2,requests

View File

@ -1,18 +1,14 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.10.1
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args: [--profile, black, --filter-files, oapen-engine/src]
name: isort (python)
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3.10
args: [oapen-engine/src]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: flake8
args: [oapen-engine/src]
- id: isort
- repo: https://github.com/ambv/black
rev: 22.10.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: flake8

View File

@ -161,4 +161,7 @@ cython_debug/
database.ini
lib/python3.7/
lib/python3.10/
lib/python3.10/
bin/
.pytest_cache
lib/

22
pyproject.toml Normal file
View File

@ -0,0 +1,22 @@
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| lib
| ./oapen-engine/lib
| __pycache__
| bin
| ./oapen-engine/bin
|
)/
'''

View File

@ -1,18 +0,0 @@
[isort]
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
skip=[lib/]
profile=black
[flake8]
ignore = E203, E266, E501, W503, E501
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4
exclude=.git,lib,__pycache__
[tool:pytest]
testpaths=src/test