-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
executable file
·138 lines (110 loc) · 3.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
submissions: \
pollos_petrel/example_python_submission.csv \
pollos_petrel/example_r_submission.csv
pollos_petrel/example_python_submission.csv: setup_python src/example_submission.py
@echo "Creating Python submission..."
src/example_submission.py
pollos_petrel/example_r_submission.csv: setup_r src/example_submission.R
@echo "Creating R submission..."
src/example_submission.R
module = pollos_petrel
define lint
pylint \
--disable=bad-continuation \
--disable=missing-class-docstring \
--disable=missing-function-docstring \
--disable=missing-module-docstring \
${1}
endef
.PHONY: \
check \
clean \
coverage \
coverage_python \
coverage_r \
format \
init \
init_python \
init_r \
install_python \
install_r \
linter \
mutants \
mutants_python \
mutants_r \
setup \
setup_python \
setup_r \
submissions \
tests \
tests_python \
tests_r
check:
R -e "library(styler)" \
-e "resumen <- style_dir('R')" \
-e "resumen <- rbind(resumen, style_dir('src'))" \
-e "resumen <- rbind(resumen, style_dir('tests'))" \
-e "any(resumen[[2]])" \
| grep FALSE
black --check --line-length 100 ${module}
black --check --line-length 100 src
black --check --line-length 100 tests
flake8 --max-line-length 100 ${module}
flake8 --max-line-length 100 src
flake8 --max-line-length 100 tests
mypy ${module}
mypy src
mypy tests
clean:
rm --force --recursive ${module}.egg-info
rm --force --recursive ${module}/__pycache__
rm --force --recursive .*_cache
rm --force --recursive SeleccionAnalista2022.Rcheck
rm --force --recursive tests/__pycache__
rm --force --recursive tests/testthat/_snaps
rm --force .mutmut-cache
rm --force NAMESPACE
rm --force SeleccionAnalista2022_*.tar.gz
rm --force coverage.xml
rm --force pollos_petrel/example_*_submission.csv
coverage: coverage_python coverage_r
coverage_python: setup_python
pytest --cov=${module} --cov-report=term-missing --verbose
coverage_r: setup_r
Rscript tests/testthat/coverage.R
format:
black --line-length 100 ${module}
black --line-length 100 src
black --line-length 100 tests
R -e "library(styler)" \
-e "style_dir('R')" \
-e "style_dir('src')" \
-e "style_dir('tests')"
init:
@echo "⛔ Please use 'make init_python' or 'make init_r' instead ⛔"
init_python: setup_python tests_python
init_r: setup_r tests_r
install_python:
pip install --editable .
install_r:
R -e "devtools::document()" && \
R CMD build . && \
R CMD check SeleccionAnalista2022_0.1.0.tar.gz && \
R CMD INSTALL SeleccionAnalista2022_0.1.0.tar.gz
linter:
$(call lint, ${module})
$(call lint, tests)
mutants: mutants_python mutants_r
mutants_python: setup_python tests_python
mutmut run --paths-to-mutate ${module}
mutmut run --paths-to-mutate src
mutants_r: setup_r tests_r
@echo "🙁🏹 No mutation testing on R 👾🎉👾"
setup: setup_python setup_r
setup_python: clean install_python
setup_r: clean install_r
tests: tests_python tests_r
tests_python:
pytest --verbose
tests_r:
Rscript -e "devtools::test(stop_on_failure = TRUE)"