Skip to content

Commit c13f0d3

Browse files
author
Rodrigo Valin
authored
CLOUDP-77990: Adds linter. (#13)
1 parent 745aea6 commit c13f0d3

File tree

3 files changed

+133
-50
lines changed

3 files changed

+133
-50
lines changed

.evergreen.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,57 @@ functions:
55
params:
66
directory: sonar
77

8-
tests_unit:
9-
# 1. Create virtualenv
10-
- command: subprocess.exec
8+
python_venv: &python_venv
9+
command: subprocess.exec
1110
type: setup
1211
params:
1312
command: virtualenv --python /opt/python/3.7/bin/python3 ./venv
14-
# 2. Install dependencies
15-
- command: subprocess.exec
13+
14+
python_requirements: &python_requirements
15+
command: subprocess.exec
1616
type: setup
1717
params:
1818
working_dir: sonar
19-
command: ${workdir}/venv/bin/python -m pip install -r requirements.txt --quiet --no-warn-script-location
20-
# 3. Install sonar package
21-
- command: subprocess.exec
19+
command: ${workdir}/venv/bin/python -m pip install -r requirements-dev.txt --quiet --no-warn-script-location
20+
21+
sonar_install: &sonar_install
22+
command: subprocess.exec
2223
type: setup
2324
params:
2425
working_dir: sonar
2526
command: ${workdir}/venv/bin/python setup.py install
26-
# 4. Run pytest
27+
28+
tests_unit:
29+
- *python_venv
30+
- *python_requirements
31+
- *sonar_install
2732
- command: subprocess.exec
2833
type: test
2934
params:
3035
working_dir: sonar
3136
command: ${workdir}/venv/bin/python -m pytest
3237

38+
tests_lint:
39+
- *python_venv
40+
- *python_requirements
41+
- command: subprocess.exec
42+
type: test
43+
params:
44+
working_dir: sonar
45+
command: ${workdir}/venv/bin/python -m pylint sonar/ --fail-under=8
46+
3347
tasks:
3448
- name: tests_unit
3549
tags: ["tests"]
3650
commands:
3751
- func: fetch_source
3852
- func: tests_unit
3953

54+
- name: tests_lint
55+
tags: ["tests"]
56+
commands:
57+
- func: fetch_source
58+
- func: tests_lint
4059

4160
buildvariants:
4261
- name: tests_unit
@@ -46,3 +65,4 @@ buildvariants:
4665
stepback: true
4766
tasks:
4867
- name: tests_unit
68+
- name: tests_lint

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ rope
44
black
55
flake8
66
autopep8
7+
pylint==2.6.0

0 commit comments

Comments
 (0)