Skip to content

Commit

Permalink
Add formatter to CI checks (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline authored Jul 18, 2021
1 parent eda7d79 commit ff8e145
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 19 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ jobs:
- name: Build
run: make build

- name: Lint check
run: make lint
- name: Formatting check (black)
run: make check-fmt

- name: Type check
run: make type
- name: Lint check (pylint)
run: make check-lint

- name: Type check (mypy)
run: make check-type

- name: Test
run: make test
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ jobs:
- name: Build
run: make build

- name: Lint check
run: make lint
- name: Formatting check (black)
run: make check-fmt

- name: Type check
run: make type
- name: Lint check (pylint)
run: make check-lint

- name: Type check (mypy)
run: make check-type

- name: Test
run: make test
23 changes: 15 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,32 @@ requirements:
pip3 install -r requirements-test.txt
.PHONY: requirements

lint:
fmt:
black .

check-fmt:
black --check .
.PHONY: check-fmt

check-lint:
pylint dbtmetabase
.PHONY: lint
.PHONY: check-lint

type:
check-type:
mypy dbtmetabase
.PHONY: type
.PHONY: check-type

test:
python3 -m unittest tests
.PHONY: test

check: build
dist-check: build
twine check dist/*
.PHONY: check
.PHONY: dist-check

upload: check
dist-upload: check
twine upload dist/*
.PHONY: upload
.PHONY: dist-upload

dev-install: build
pip3 uninstall -y dbt-metabase && pip3 install dist/dbt_metabase-*-py3-none-any.whl
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ build-backend = "setuptools.build_meta"
write_to = "dbtmetabase/_version.py"

[tool.black]
line-length = 100
target-version = ['py36', 'py37', 'py38', 'py39']
line-length = 88
target-version = ['py36', 'py37', 'py38']
include = '\.pyi?$'

[tool.mypy]
Expand Down
1 change: 1 addition & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pylint
mypy
types-requests
types-PyYAML
black
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
if sys.version_info < (3, 6):
raise ValueError("Requires Python 3.6+")


def requires_from_file(filename: str) -> list:
with open(filename, "r") as f:
return [x.strip() for x in f if x.strip()]


with open("README.rst", "r") as f:
readme = f.read()

Expand All @@ -28,7 +30,7 @@ def requires_from_file(filename: str) -> list:
test_suite="tests",
install_requires=requires_from_file("requirements.txt"),
extras_require={
"test":requires_from_file("requirements-test.txt")
"test": requires_from_file("requirements-test.txt"),
},
setup_requires=["setuptools_scm"],
classifiers=[
Expand Down

0 comments on commit ff8e145

Please sign in to comment.