View difference between Paste ID: eTHpL70G and AKmCM7MC
SHOW: | | - or go back to the newest paste.
1
.DEFAULT_GOAL := help
2
DIRECTORIES = $$(find -wholename ./src -o -wholename ./incolumepy -o -wholename ./tests)
3
PKGNAME = 'incolumepy'
4-
setup:
4+
REPORT_DIR = 'coverage_report'
5-
	@poetry env use 3.10
5+
PYTHON_VERSION := 3.10
6
URLCOMPARE := 'https://github.com/incolumepy-prospections/incolumepy.dataclass/compare/'
7-
install:  ## Install this package using poetry
7+
CHANGELOGFILE := 'CHANGELOG.md'
8-
install: setup
8+
9-
	@poetry add incolumepy.makefilelicense
9+
.PHONY: black
10
black:   ##Apply code style black format
11
	@poetry run black $(DIRECTORIES) && git commit -m "style: Applied Code style Black format automaticly at `date +"%F %T"`" . || echo
12-
.PHONY: clean clean-all flake8 format help lint mypy prerelease release test tox
12+
	@echo ">>>  Checked code style Black format automaticly  <<<"
13
14
.PHONY: clean
15
clean:   ## Shallow clean into environment (.pyc, .cache, .egg, .log, et all)
16
	@echo -n "Starting cleanning environment .."
17-
mypy: ## mypy checking
17+
18
	@find ./ -name '*~' -exec rm -f {} \;
19-
	@mypy incolumepy/
19+
20
	@find ./ -name '*.log' -exec rm -f {} \;
21-
flake8: ## flake8 checking
21+
	@find ./ -name '*.log.*' -exec rm -f {} \;
22
	@find ./ -name ".cache" -exec rm -fr {} \;
23-
	@flake8 --config pyproject.toml incolumepy/
23+
24
	@find ./ -name "*.coverage" -exec rm -rf {} \;
25
	@find ./ -maxdepth 1 -type d -name "*cov*" -exec rm -rf {} \;
26
	@rm -fv cov.xml
27-
	@isort --check --atomic --py all incolumepy/ tests/
27+
28
	@echo " finished!"
29
30-
	@isort --atomic --py all incolumepy/ tests/ && git commit -m "Applied Code style isort format automaticly at `date +"%F %T"`" . || echo
30+
.PHONY: clean-all
31-
	@echo ">>>  Applied code style isort format automaticly  <<<"
31+
clean-all: clean   ## Deep cleanning into environment (dist, build, htmlcov, .tox, *_cache, et all)
32
	@echo "Starting Deep cleanning .."
33
	@rm -rf dist
34
	@rm -rf build
35-
	@black --check incolumepy/ tests/
35+
36
	@rm -rf coverage_report
37-
black:  ##Apply code style black format
37+
38-
	@poetry run black incolumepy/ tests/ && git commit -m "Applied Code style Black format automaticly at `date +"%F %T"`" . || echo
38+
	@find ./ \( -name "*_cache" -o -name '*cache__' \) -exec rm -rf {} 2> /dev/null \;
39-
	@echo ">>>  Applied code style Black format automaticly  <<<"
39+
40
	@poetry env list|awk '{print $$1}'|while read a; do poetry env remove $${a} 2> /dev/null && echo "$${a} removed."|| echo "$${a} not removed."; done
41-
.PHONY: check-docstyle
41+
	@echo "Deep cleaning finished!"
42-
check-docstyle: ## docstring checking
42+
43-
	@echo "docstyle checking .."
43+
.PHONY: check-black
44-
	@pydocstyle incolumepy/ tests/
44+
45
	@echo "Black checking .."
46-
pylint:  ## pylint checking
46+
	@poetry run black --check $(DIRECTORIES)
47
48-
	@pylint incolumepy/ tests/
48+
.PHONY: check-flake8
49
check-flake8: ## flake8 checking
50-
lint:  ## Run all linters (check-isort, check-black, flake8, pylint, mypy, docstyle)
50+
51-
lint: mypy pylint flake8 check-docstyle check-isort check-black
51+
	@poetry run flake8 --config pyproject.toml $(DIRECTORIES)
52
53-
test: ## Run all tests avaliable and generate html coverage
53+
.PHONY: check-isort
54-
test: lint
54+
55-
	@pytest  tests/ -vv --cov=incolumepy.makefilelicense --cov-report='html'
55+
56
	@poetry run isort --check --atomic --py all $(DIRECTORIES)
57-
clean: ## Shallow clean into environment (.pyc, .cache, .egg, .log, et all)
57+
58-
	@echo -n "Cleanning environment .."
58+
.PHONY: check-mypy
59
check-mypy: ## mypy checking
60
	@echo "mypy checking .."
61
	@poetry run mypy $(DIRECTORIES)
62
63
.PHONY: check-pylint
64
check-pylint: ## pylint checking
65
	@echo "pylint checking .."
66
	@poetry run pylint $(DIRECTORIES)
67-
	@echo " Ok."
67+
68
.PHONY: check-pydocstyle
69-
clean-all: ## Deep cleanning into environment (dist, build, htmlcov, .tox, *_cache, et all)
69+
check-pydocstyle: ## docstring checking
70-
clean-all: clean
70+
	@echo "pydocstyle checking .."
71-
	@echo -n "Deep cleanning .."
71+
	@poetry run pydocstyle $(DIRECTORIES)
72
73
.PHONY: changelog
74
changelog:   ## Update changelog file
75
	@poetry run python -c "from incolumepy.utils import update_changelog; \
76-
	@rm -rf ".pytest_cache" ".mypy_cache"
76+
	update_changelog($(CHANGELOGFILE), urlcompare=$(URLCOMPARE))"
77
	@echo 'Atualização de CHANGESLOG realizada com sucesso.'
78-
	@poetry env list|awk '{print $1}'|while read a; do poetry env remove $${a}; done
78+
79-
	@echo " Ok."
79+
.PHONY: docsgen
80
docsgen: clean changelog    ## Generate documentation
81-
prerelease: ## Generate new prerelease commit version default semver
81+
	@ cd docs; make html; cd -
82-
prerelease: test format
82+
	@ git config core.hooksPath None
83-
	@v=$$(poetry version prerelease); poetry run pytest tests/ && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
83+
	@ git commit -m "docs: Updated documentation (`date +%F@%T`)" docs/ CHANGELOG.md
84
	@ git config core.hooksPath .git-hooks
85-
release: test ## Generate new release commit with version/tag default semver
85+
86
.PHONY: format
87
format: isort black   ## Formate project code with code style (isort, black)
88
89
.PHONY: help
90
help:  ## Show this instructions
91-
&& git checkout dev
91+
92
93-
format: ## Formate project code with code style (isort, black)
93+
.PHOMY: install
94-
format: clean isort black
94+
install: setup  ## Install this package using poetry and all dependences
95
	@poetry install
96-
tox: ## Run tox completly
96+
#	@poetry add $(PKGNAME)
97-
	@poetry run tox
97+
98
.PHONY: isort
99
isort:  ## isort apply
100
	@poetry run isort --atomic --py all $(DIRECTORIES) && git commit -m "style: Applied Code style isort format automaticly at `date +%F@%T`" . || echo
101
	@echo ">>>  Checked code style isort format automaticly  <<<"
102
103
.PHONY: lint
104
lint:  ## Run all linters (check-isort, check-black, flake8, pylint, mypy, pydocstyle)
105
lint: check-mypy check-pylint check-flake8 check-pydocstyle check-isort check-black
106
107
.PHONY: premajor
108
premajor:   ## Generate new premajor commit version default semver
109
	@ git config core.hooksPath None
110
	@v=$$(poetry version premajor); poetry run pytest tests/ && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
111
	@ git config core.hooksPath .git-hooks
112
113
.PHONY: premajor-force
114
premajor-force:    ## Generate new premajor commit version default semver and your tag forcing merge into main branch
115
	@ git config core.hooksPath None
116
	@msg=$$(poetry version premajor); poetry run pytest tests/; \
117
git commit -m "$$msg" pyproject.toml $$(find -name version.txt) \
118
&& git tag -f $$(poetry version -s) -m "$$msg"; \
119
git checkout main; git merge --no-ff dev -m "$$msg" \
120
&& git tag -f $$(poetry version -s) -m "$$msg" \
121
&& git checkout dev    #com tag
122
	@ git config core.hooksPath .git-hooks
123
124
.PHONY: preminor
125
preminor:  ## Generate new preminor commit version default semver
126
	@ git config core.hooksPath None
127
	@v=$$(poetry version preminor); poetry run pytest -m "not slow" tests/ && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
128
	@ git config core.hooksPath .git-hooks
129
130
.PHONY: preminor-force
131
preminor-force:    ## Generate new preminor commit version default semver and your tag forcing merge into main branch
132
	@ git config core.hooksPath None
133
	@msg=$$(poetry version preminor); poetry run pytest tests/; \
134
git commit -m "$$msg" pyproject.toml $$(find -name version.txt) \
135
&& git tag -f $$(poetry version -s) -m "$$msg"; \
136
git checkout main; git merge --no-ff dev -m "$$msg" \
137
&& git tag -f $$(poetry version -s) -m "$$msg" \
138
&& git checkout dev    #com tag
139
	@ git config core.hooksPath .git-hooks
140
141
.PHONY: prepatch
142
prepatch:  ## Generate new prepatch commit version default semver
143
	@ git config core.hooksPath None
144
	@v=$$(poetry version prepatch); poetry run pytest -m "not slow" tests/ && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
145
	@ git config core.hooksPath .git-hooks
146
147
.PHONY: prerelease
148
prerelease:   ## Generate new prerelease commit version default semver
149
	@ git config core.hooksPath None
150
	@v=$$(poetry version prerelease); poetry run pytest tests && git commit -m "$$v" pyproject.toml $$(find -name version.txt)  #sem tag
151
	@ git config core.hooksPath .git-hooks
152
153
.PHONY: prerelease-force
154
prerelease-force:   ## Generate new prerelease commit version default semver and your tag forcing merge into main branch
155
	@ git config core.hooksPath None
156
	@msg=$$(poetry version prerelease); poetry run pytest tests/; \
157
git commit -m "$$msg" pyproject.toml $$(find -name version.txt) \
158
&& git tag -f $$(poetry version -s) -m "$$msg"; \
159
git checkout main; git merge --no-ff dev -m "$$msg" \
160
&& git tag -f $$(poetry version -s) -m "$$msg" \
161
&& git checkout dev    #com tag
162
	@ git config core.hooksPath .git-hooks
163
164
.PHONY: publish-testing
165
publish-testing: ## Publish on test.pypi.org
166
	@poetry publish -r testpypi --build
167
168
.PHONY: release
169
release:    ## Generate new release commit with version/tag default semver
170
	@ git config core.hooksPath None
171
	@msg=$$(poetry version patch); poetry run pytest tests/; \
172
git commit -m "$$msg" pyproject.toml $$(find -name version.txt) \
173
&& git tag -f $$(poetry version -s) -m "$$msg"; \
174
git checkout main; git merge --no-ff dev -m "$$msg" \
175
&& git tag -f $$(poetry version -s) -m "$$msg" \
176
&& git checkout dev    #com tag
177
	@ git config core.hooksPath .git-hooks
178
179
.PHONY: retrocompatibility
180
retrocompatibility: ## Run tox and check retrompatibility betwen python versions
181
	@poetry run tox -e py36,py37,py38,py39,py310
182
183
.PHONY: safety
184
safety:  ## Check safety of packages into project.
185
	@poetry run safety check --full-report
186
187
.PHOMY: setup
188
setup: ## setup environment python with poetry
189
	@poetry env use $(PYTHON_VERSION)
190
	@git config core.hooksPath .git-hooks
191
#	@poetry shell
192
193
.PHONY: stats
194
stats: ## Run all tests avaliable and generate html coverage
195
	@poetry run pytest -sxv --cov=$(PKGNAME) --cov-report html:$(REPORT_DIR)/html --cov-report xml:$(REPORT_DIR)/cov.xml --cov-report annotate:$(REPORT_DIR)/annotate --cov-report term-missing:skip-covered tests/
196
197
.PHONY: test
198
test:   ## Tun all tests on venv
199
	@poetry run pytest tests/
200