Skip to content

Commit

Permalink
chore(deps): replace black+isort+flake8 with ruff (#1406)
Browse files Browse the repository at this point in the history
* chore(deps): replace black+isort+flake8 with ruff

Signed-off-by: Luka Peschke <[email protected]>

* chore: make format

Signed-off-by: Luka Peschke <[email protected]>

* fix broken imports

Signed-off-by: Luka Peschke <[email protected]>

* fix broken tests

Signed-off-by: Luka Peschke <[email protected]>

* chore: double quotes

Signed-off-by: Luka Peschke <[email protected]>

---------

Signed-off-by: Luka Peschke <[email protected]>
  • Loading branch information
lukapeschke authored Dec 15, 2023
1 parent 69ebbee commit 8f4a0d4
Show file tree
Hide file tree
Showing 149 changed files with 8,721 additions and 9,682 deletions.
41 changes: 17 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer

- repo: http://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
name: Lint Python files using flake8
- repo: local
hooks:
- id: system
name: Lint with Ruff
entry: poetry run ruff --fix
types: [python]
language: system

- repo: https://github.com/timothycrosley/isort
rev: 5.5.4
hooks:
- id: isort
name: Sort Python imports

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
name: Reformat Python files
- id: system
name: Lint with Ruff format
entry: poetry run ruff format
types: [python]
language: system
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DEFAULT_GOAL := all
isort = isort toucan_connectors tests
black = black toucan_connectors tests
flake8 = flake8 toucan_connectors tests
ruff = ruff toucan_connectors tests
format = ruff format toucan_connectors tests
mypy = mypy

.PHONY: clean
Expand All @@ -17,14 +16,13 @@ install:

.PHONY: format
format:
$(isort)
$(black)
$(format)
$(ruff) --fix

.PHONY: lint
lint:
$(flake8)
$(isort) --check-only
$(black) --check
$(format) --check
$(ruff)
$(mypy)

.PHONY: test
Expand Down
6 changes: 2 additions & 4 deletions doc/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def clean_type_str(field_str):
'ConstrainedStrValue': 'str (not empty)',
'ConstrainedIntValue': 'int (not empty)',
}
field_str = f'{field_str}'.replace("<class '", "").replace("'>", "").replace("<enum '", "")
field_str = f'{field_str}'.replace("<class '", '').replace("'>", '').replace("<enum '", '')
field_str = field_str.split('.')
if field_str[-1] in Constr_values.keys():
return Constr_values[field_str[-1]]
Expand Down Expand Up @@ -115,9 +115,7 @@ def generate(klass):

def get_connectors():
path = 'toucan_connectors/'
connectors = [
o for o in os.listdir(path) if os.path.isdir(os.path.join(path, o)) & (o != '__pycache__')
]
connectors = [o for o in os.listdir(path) if os.path.isdir(os.path.join(path, o)) & (o != '__pycache__')]
connectors_ok = {}
for connector in connectors:
try:
Expand Down
Loading

0 comments on commit 8f4a0d4

Please sign in to comment.