blob: 11071caaa376feb67e7916e31ab4ded63a18007e [file] [log] [blame]
garciadeblas56e0be72024-07-09 14:30:15 +02001#######################################################################################
2# Copyright ETSI Contributors and Others.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#######################################################################################
17
18[tox]
19envlist = black, flake8, pylint, safety
20
21[tox:jenkins]
22toxworkdir = /tmp/.tox
23
24[testenv]
25usedevelop = True
26basepython = python3.10
27setenv = VIRTUAL_ENV={envdir}
28 PYTHONDONTWRITEBYTECODE = 1
29deps = -r{toxinidir}/requirements.txt
30parallel_show_output = true
31
32#######################################################################################
33[testenv:black]
34deps = black==24.4.2
35skip_install = true
36commands =
37 black --check --diff osm_ee/ --exclude="frontend_pb2.py"
38 black --check --diff setup.py
39
40
41#######################################################################################
42[testenv:flake8]
43deps = flake8==7.1.0
44commands =
45 flake8 osm_ee/ setup.py
46
47
48#######################################################################################
49[testenv:pylint]
50deps = {[testenv]deps}
51 pylint==3.1.1
52commands =
53 pylint -E osm_ee
54
55
56#######################################################################################
57[testenv:safety]
58deps = {[testenv]deps}
59 safety
60commands =
61 - safety check --full-report
62
63
64#######################################################################################
garciadeblas302826f2024-07-09 14:32:13 +020065[testenv:proto]
66skip_install = true
67commands =
68 protoc --python_out=. osm_ee/frontend.proto
69allowlist_externals = protoc
70
71
72#######################################################################################
73[testenv:protodocker]
74skip_install = true
75commands =
76 docker build -f Dockerfile-proto . -t protobuf
77 docker run --rm -it -v ./osm_ee:/work -w /work protobuf --python_out=. frontend.proto
78allowlist_externals = docker
79
80
81#######################################################################################
garciadeblas56e0be72024-07-09 14:30:15 +020082[testenv:pip-compile]
83deps = pip-tools==6.13.0
84skip_install = true
85allowlist_externals = bash
86 [
87commands =
88 - bash -c "for file in requirements*.in ; do \
89 UNSAFE="" ; \
90 if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
91 pip-compile --resolver=backtracking -rU --no-header $UNSAFE $file ;\
92 out=`echo $file | sed 's/.in/.txt/'` ; \
93 sed -i -e '1 e head -16 tox.ini' $out ;\
94 done"
95
96
97#######################################################################################
98[flake8]
99ignore =
100# W291,
101# W293,
102# W503,
103# E123,
104# E125,
105# E226,
106# E241,
107# E203
108exclude =
109 .git,
110 __pycache__,
111 .tox,
112 osm_ee/frontend_pb2.py,
113max-line-length = 120
114show-source = True
115builtins = _