Skip to content

Commit 2d3d45a

Browse files
authored
Improve CI for flake8, codecov and added a step to check poetry.lock (#60)
* improve ci/cd for flake8, codecov, and add poetry lock check * fixed codecov settings
1 parent 25c0ff4 commit 2d3d45a

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ install: ## Install the poetry environment
1212
@poetry shell
1313

1414
check: ## Lint code using pre-commit and run mypy and deptry.
15+
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check"
16+
@poetry lock --check
1517
@echo "🚀 Linting code: Running pre-commit"
1618
@pre-commit run -a
1719
@echo "🚀 Checking code formatting: Running mypy"

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ repos:
1212
- repo: https://github.com/PyCQA/flake8
1313
rev: "5.0.4"
1414
hooks:
15-
- id: flake8
15+
- id: flake8
16+
additional_dependencies:
17+
- flake8-bugbear==22.9.23
18+
- flake8-comprehensions==3.10.0
19+
- flake8-simplify==0.19.3

{{cookiecutter.project_name}}/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ install: ## Install the poetry environment and install the pre-commit hooks
55
@poetry shell
66

77
check: ## Lint and check code by running black, isort, flake8, mypy and deptry.
8+
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check"
9+
@poetry lock --check
810
@echo "🚀 Linting code: Running pre-commit"
911
@pre-commit run -a
1012
@echo "🚀 Checking code formatting: Running mypy"
@@ -18,7 +20,7 @@ check: ## Lint and check code by running black, isort, flake8, mypy and deptry.
1820
test: ## Test the code with pytest
1921
@echo "🚀 Testing code: Running pytest"
2022
{%- if cookiecutter.codecov == "y"%}
21-
@pytest --cov=./ --cov-report=xml
23+
@pytest --cov --cov-config=pyproject.toml --cov-report=xml
2224
{%- else %}
2325
@pytest --doctest-modules
2426
{%- endif%}

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ python = ">=3.8,<3.11"
1616
[tool.poetry.dev-dependencies]
1717
pytest = "^7.1.2"
1818
{% if cookiecutter.codecov == 'y' -%}
19-
pytest-cov = "^3.0.0"
19+
pytest-cov = "^4.0.0"
2020
{% endif -%}
2121
{% if cookiecutter.mkdocs == 'y' -%}
2222
mkdocs = "^1.3.0"
@@ -50,4 +50,13 @@ no_implicit_optional = "True"
5050
check_untyped_defs = "True"
5151
warn_return_any = "True"
5252
warn_unused_ignores = "True"
53-
show_error_codes = "True"
53+
show_error_codes = "True"
54+
55+
{% if cookiecutter.codecov == "y"-%}
56+
[tool.coverage.report]
57+
skip_empty = true
58+
59+
[tool.coverage.run]
60+
branch = true
61+
source = ["{{cookiecutter.project_slug}}"]
62+
{% endif%}

0 commit comments

Comments
 (0)