Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08d1683

Browse files
authored
CI Include linting in CircleCI (#25475)
1 parent 4499409 commit 08d1683

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

.circleci/config.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
version: 2.1
22

33
jobs:
4+
lint:
5+
docker:
6+
- image: cimg/python:3.8.12
7+
steps:
8+
- checkout
9+
- run:
10+
name: dependencies
11+
command: |
12+
source build_tools/shared.sh
13+
# Include pytest compatibility with mypy
14+
pip install pytest flake8 $(get_dep mypy min) $(get_dep black min)
15+
- run:
16+
name: linting
17+
command: ./build_tools/linting.sh
18+
419
doc-min-dependencies:
520
docker:
621
- image: cimg/python:3.8.12
@@ -98,8 +113,13 @@ workflows:
98113
version: 2
99114
build-doc-and-deploy:
100115
jobs:
101-
- doc
102-
- doc-min-dependencies
116+
- lint
117+
- doc:
118+
requires:
119+
- lint
120+
- doc-min-dependencies:
121+
requires:
122+
- lint
103123
- deploy:
104124
requires:
105125
- doc

azure-pipelines.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,12 @@ jobs:
3333
inputs:
3434
versionSpec: '3.9'
3535
- bash: |
36+
source build_tools/shared.sh
3637
# Include pytest compatibility with mypy
37-
pip install pytest flake8 mypy==0.961 black==22.3.0
38+
pip install pytest flake8 $(get_dep mypy min) $(get_dep black min)
3839
displayName: Install linters
3940
- bash: |
40-
black --check --diff .
41-
displayName: Run black
42-
- bash: |
43-
./build_tools/azure/linting.sh
44-
displayName: Run linting
45-
- bash: |
46-
mypy sklearn/
47-
displayName: Run mypy
41+
./build_tools/linting.sh
4842
4943
- template: build_tools/azure/posix.yml
5044
parameters:

build_tools/azure/linting.sh renamed to build_tools/linting.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ set -e
44
# pipefail is necessary to propagate exit codes
55
set -o pipefail
66

7+
black --check --diff .
8+
echo -e "No problem detected by black\n"
9+
710
flake8 --show-source .
811
echo -e "No problem detected by flake8\n"
912

13+
mypy sklearn/
14+
echo -e "No problem detected by mypy\n"
15+
1016
# For docstrings and warnings of deprecated attributes to be rendered
1117
# properly, the property decorator must come before the deprecated decorator
1218
# (else they are treated as functions)

0 commit comments

Comments
 (0)