Skip to content

CI Include linting in CircleCI #25475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
version: 2.1

jobs:
lint:
docker:
- image: cimg/python:3.8.12
steps:
- checkout
- run:
name: dependencies
command: |
source build_tools/shared.sh
# Include pytest compatibility with mypy
pip install pytest flake8 $(get_dep mypy min) $(get_dep black min)
- run:
name: linting
command: ./build_tools/linting.sh

doc-min-dependencies:
docker:
- image: cimg/python:3.8.12
Expand Down Expand Up @@ -98,8 +113,13 @@ workflows:
version: 2
build-doc-and-deploy:
jobs:
- doc
- doc-min-dependencies
- lint
- doc:
requires:
- lint
- doc-min-dependencies:
requires:
- lint
- deploy:
requires:
- doc
12 changes: 3 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,12 @@ jobs:
inputs:
versionSpec: '3.9'
- bash: |
source build_tools/shared.sh
# Include pytest compatibility with mypy
pip install pytest flake8 mypy==0.961 black==22.3.0
pip install pytest flake8 $(get_dep mypy min) $(get_dep black min)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice I was not aware these versions were in sklearn/_min_dependencies.py

displayName: Install linters
- bash: |
black --check --diff .
displayName: Run black
- bash: |
./build_tools/azure/linting.sh
displayName: Run linting
- bash: |
mypy sklearn/
displayName: Run mypy
./build_tools/linting.sh

- template: build_tools/azure/posix.yml
parameters:
Expand Down
6 changes: 6 additions & 0 deletions build_tools/azure/linting.sh → build_tools/linting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ set -e
# pipefail is necessary to propagate exit codes
set -o pipefail

black --check --diff .
echo -e "No problem detected by black\n"

flake8 --show-source .
echo -e "No problem detected by flake8\n"

mypy sklearn/
echo -e "No problem detected by mypy\n"

# For docstrings and warnings of deprecated attributes to be rendered
# properly, the property decorator must come before the deprecated decorator
# (else they are treated as functions)
Expand Down