##// END OF EJS Templates
makefile: added ruff check
super-admin -
r5176:5680b223 default
parent child Browse files
Show More
@@ -1,172 +1,178 b''
1 # required for pushd to work..
1 # required for pushd to work..
2 SHELL = /bin/bash
2 SHELL = /bin/bash
3
3
4
4
5 # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
5 # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
6 OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
6 OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
7
7
8 NODE_PATH=./node_modules
8 NODE_PATH=./node_modules
9 WEBPACK=./node_binaries/webpack
9 WEBPACK=./node_binaries/webpack
10 GRUNT=./node_binaries/grunt
10 GRUNT=./node_binaries/grunt
11
11
12 .PHONY: clean
12 .PHONY: clean
13 ## Cleanup compiled and cache py files
13 ## Cleanup compiled and cache py files
14 clean:
14 clean:
15 make test-clean
15 make test-clean
16 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
16 find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
17 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
17 find . -type d -name "build" -prune -exec rm -rf '{}' ';'
18
18
19 .PHONY: test
19 .PHONY: test
20 ## run test-clean and tests
20 ## run test-clean and tests
21 test:
21 test:
22 make test-clean
22 make test-clean
23 make test-only
23 make test-only
24
24
25
25
26 .PHONY: test-clean
26 .PHONY: test-clean
27 ## run test-clean and tests
27 ## run test-clean and tests
28 test-clean:
28 test-clean:
29 rm -rf coverage.xml htmlcov junit.xml pylint.log result
29 rm -rf coverage.xml htmlcov junit.xml pylint.log result
30 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
30 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
31 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
31 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
32
32
33
33
34 .PHONY: test-only
34 .PHONY: test-only
35 ## Run tests only without cleanup
35 ## Run tests only without cleanup
36 test-only:
36 test-only:
37 PYTHONHASHSEED=random \
37 PYTHONHASHSEED=random \
38 py.test -x -vv -r xw -p no:sugar \
38 py.test -x -vv -r xw -p no:sugar \
39 --cov-report=term-missing --cov-report=html \
39 --cov-report=term-missing --cov-report=html \
40 --cov=rhodecode rhodecode
40 --cov=rhodecode rhodecode
41
41
42
42
43 .PHONY: test-only-mysql
43 .PHONY: test-only-mysql
44 ## run tests against mysql
44 ## run tests against mysql
45 test-only-mysql:
45 test-only-mysql:
46 PYTHONHASHSEED=random \
46 PYTHONHASHSEED=random \
47 py.test -x -vv -r xw -p no:sugar \
47 py.test -x -vv -r xw -p no:sugar \
48 --cov-report=term-missing --cov-report=html \
48 --cov-report=term-missing --cov-report=html \
49 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \
49 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \
50 --cov=rhodecode rhodecode
50 --cov=rhodecode rhodecode
51
51
52
52
53 .PHONY: test-only-postgres
53 .PHONY: test-only-postgres
54 ## run tests against postgres
54 ## run tests against postgres
55 test-only-postgres:
55 test-only-postgres:
56 PYTHONHASHSEED=random \
56 PYTHONHASHSEED=random \
57 py.test -x -vv -r xw -p no:sugar \
57 py.test -x -vv -r xw -p no:sugar \
58 --cov-report=term-missing --cov-report=html \
58 --cov-report=term-missing --cov-report=html \
59 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \
59 --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \
60 --cov=rhodecode rhodecode
60 --cov=rhodecode rhodecode
61
61
62 .PHONY: ruff-check
63 ## run a ruff analysis
64 ruff-check:
65 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
66
67
62 .PHONY: docs
68 .PHONY: docs
63 ## build docs
69 ## build docs
64 docs:
70 docs:
65 (cd docs; nix-build default.nix -o result; make clean html)
71 (cd docs; nix-build default.nix -o result; make clean html)
66
72
67
73
68 .PHONY: docs-clean
74 .PHONY: docs-clean
69 ## Cleanup docs
75 ## Cleanup docs
70 docs-clean:
76 docs-clean:
71 (cd docs; make clean)
77 (cd docs; make clean)
72
78
73
79
74 .PHONY: docs-cleanup
80 .PHONY: docs-cleanup
75 ## Cleanup docs
81 ## Cleanup docs
76 docs-cleanup:
82 docs-cleanup:
77 (cd docs; make cleanup)
83 (cd docs; make cleanup)
78
84
79
85
80 .PHONY: web-build
86 .PHONY: web-build
81 ## Build JS packages static/js
87 ## Build JS packages static/js
82 # https://hub.docker.com/r/huli/grunt
88 # https://hub.docker.com/r/huli/grunt
83 web-build:
89 web-build:
84 NODE_PATH=$(NODE_PATH) $(GRUNT)
90 NODE_PATH=$(NODE_PATH) $(GRUNT)
85
91
86 # check required files
92 # check required files
87 STATIC_CHECK="/robots.txt /502.html \
93 STATIC_CHECK="/robots.txt /502.html \
88 /js/scripts.min.js /js/rhodecode-components.js \
94 /js/scripts.min.js /js/rhodecode-components.js \
89 /css/style.css /css/style-polymer.css /css/style-ipython.css"
95 /css/style.css /css/style-polymer.css /css/style-ipython.css"
90
96
91 for file in $STATIC_CHECK;
97 for file in $STATIC_CHECK;
92 do
98 do
93 if [ ! -f rhodecode/public/$file ]; then
99 if [ ! -f rhodecode/public/$file ]; then
94 echo "Missing $file expected after web-build"
100 echo "Missing $file expected after web-build"
95 exit 1
101 exit 1
96 fi
102 fi
97 done
103 done
98
104
99 .PHONY: pip-packages
105 .PHONY: pip-packages
100 ## Show outdated packages
106 ## Show outdated packages
101 pip-packages:
107 pip-packages:
102 python ${OUTDATED_PACKAGES}
108 python ${OUTDATED_PACKAGES}
103
109
104
110
105 .PHONY: build
111 .PHONY: build
106 ## Build sdist/egg
112 ## Build sdist/egg
107 build:
113 build:
108 python -m build
114 python -m build
109
115
110
116
111 .PHONY: dev-env
117 .PHONY: dev-env
112 ## make dev-env based on the requirements files and install develop of packages
118 ## make dev-env based on the requirements files and install develop of packages
113 dev-env:
119 dev-env:
114 pip install build virtualenv
120 pip install build virtualenv
115 pushd ../rhodecode-vcsserver/ && make dev-env && popd
121 pushd ../rhodecode-vcsserver/ && make dev-env && popd
116 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
122 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
117 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
123 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt
118 pip install -e .
124 pip install -e .
119
125
120
126
121 .PHONY: dev-srv
127 .PHONY: dev-srv
122 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
128 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
123 dev-srv:
129 dev-srv:
124 pserve --reload .dev/dev.ini
130 pserve --reload .dev/dev.ini
125
131
126 .PHONY: dev-srv-g
132 .PHONY: dev-srv-g
127 ## run gunicorn multi process workers
133 ## run gunicorn multi process workers
128 dev-srv-g:
134 dev-srv-g:
129 gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py
135 gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py
130
136
131
137
132 # Default command on calling make
138 # Default command on calling make
133 .DEFAULT_GOAL := show-help
139 .DEFAULT_GOAL := show-help
134
140
135 .PHONY: show-help
141 .PHONY: show-help
136 show-help:
142 show-help:
137 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
143 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
138 @echo
144 @echo
139 @sed -n -e "/^## / { \
145 @sed -n -e "/^## / { \
140 h; \
146 h; \
141 s/.*//; \
147 s/.*//; \
142 :doc" \
148 :doc" \
143 -e "H; \
149 -e "H; \
144 n; \
150 n; \
145 s/^## //; \
151 s/^## //; \
146 t doc" \
152 t doc" \
147 -e "s/:.*//; \
153 -e "s/:.*//; \
148 G; \
154 G; \
149 s/\\n## /---/; \
155 s/\\n## /---/; \
150 s/\\n/ /g; \
156 s/\\n/ /g; \
151 p; \
157 p; \
152 }" ${MAKEFILE_LIST} \
158 }" ${MAKEFILE_LIST} \
153 | LC_ALL='C' sort --ignore-case \
159 | LC_ALL='C' sort --ignore-case \
154 | awk -F '---' \
160 | awk -F '---' \
155 -v ncol=$$(tput cols) \
161 -v ncol=$$(tput cols) \
156 -v indent=19 \
162 -v indent=19 \
157 -v col_on="$$(tput setaf 6)" \
163 -v col_on="$$(tput setaf 6)" \
158 -v col_off="$$(tput sgr0)" \
164 -v col_off="$$(tput sgr0)" \
159 '{ \
165 '{ \
160 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
166 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
161 n = split($$2, words, " "); \
167 n = split($$2, words, " "); \
162 line_length = ncol - indent; \
168 line_length = ncol - indent; \
163 for (i = 1; i <= n; i++) { \
169 for (i = 1; i <= n; i++) { \
164 line_length -= length(words[i]) + 1; \
170 line_length -= length(words[i]) + 1; \
165 if (line_length <= 0) { \
171 if (line_length <= 0) { \
166 line_length = ncol - indent - length(words[i]) - 1; \
172 line_length = ncol - indent - length(words[i]) - 1; \
167 printf "\n%*s ", -indent, " "; \
173 printf "\n%*s ", -indent, " "; \
168 } \
174 } \
169 printf "%s ", words[i]; \
175 printf "%s ", words[i]; \
170 } \
176 } \
171 printf "\n"; \
177 printf "\n"; \
172 }'
178 }'
General Comments 0
You need to be logged in to leave comments. Login now