-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
60 lines (58 loc) · 1.8 KB
/
Jenkinsfile
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
pipeline {
agent none
options {
buildDiscarder(logRotator(numToKeepStr:'50'))
}
// TODO: checkout https://pre-commit.com/
// https://github.com/PyCQA/prospector#pre-commit
stages {
// formatter
// ---------
// https://github.com/ambv/black
// https://github.com/google/yapf
// https://medium.com/3yourmind/auto-formatters-for-python-8925065f9505
//
// linter
// ------
// https://github.com/PyCQA/prospector
// https://prospector.readthedocs.io/en/latest/supported_tools.html#optional-extras
stage('lint') {
agent { docker { alwaysPull true; image 'python:3' } }
steps {
// numpy is installed first because it is a chicken-or-the-egg dependency.
// ASAP is installed to silence 'cannot import <dependency>' warnings.
//
// autoformat with black to silence warnings that can be auto-fixed.
// black excludes .git/ and .venv/ by default.
//
// max-line-length default is 80
sh '''\
python -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install numpy
pip install .
pip install 'prospector[with_everything] >=1.1.7' black
black --quiet .
prospector \
--max-line-length 120 \
--output-format pylint:prospector.log \
--zero-exit \
--strictness veryhigh \
--doc-warnings \
--test-warnings \
--member-warnings \
--full-pep8 \
--with-tool pyroma \
--with-tool vulture \
--with-tool frosted \
--with-tool mypy
'''.stripIndent()
recordIssues(tools: [pyLint(pattern: 'prospector.log')])
}
post {
cleanup { deleteDir() }
}
}
}
}