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 install --deploy --dev
pipenv run isort --profile black src/ pipenv run isort --profile black src/
pipenv run black --check src/ --exclude="lib/*" 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 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: repos:
- repo: https://github.com/pycqa/isort - repo: https://github.com/pre-commit/mirrors-isort
rev: 5.10.1 rev: v5.10.1
hooks: hooks:
- id: isort - id: isort
args: [--profile, black, --filter-files, oapen-engine/src] - repo: https://github.com/ambv/black
name: isort (python) rev: 22.10.0
- repo: https://github.com/psf/black hooks:
rev: stable - id: black
hooks: language_version: python3.10
- id: black - repo: https://github.com/pre-commit/pre-commit-hooks
language_version: python3.10 rev: v2.3.0
args: [oapen-engine/src] hooks:
- repo: https://github.com/pre-commit/pre-commit-hooks - id: flake8
rev: v1.2.3
hooks:
- id: flake8
args: [oapen-engine/src]

View File

@ -161,4 +161,7 @@ cython_debug/
database.ini database.ini
lib/python3.7/ 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