diff --git a/.circleci/config.yml b/.circleci/config.yml index eb634d02aeefa..6d9ae3c84226c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 @@ -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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3285ff0aacad9..172b7c6fdfb5e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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) 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: diff --git a/build_tools/azure/linting.sh b/build_tools/linting.sh similarity index 93% rename from build_tools/azure/linting.sh rename to build_tools/linting.sh index 9cc57c5f06066..84d0414190300 100755 --- a/build_tools/azure/linting.sh +++ b/build_tools/linting.sh @@ -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)