diff --git a/.ci/pipeline/ci.yml b/.ci/pipeline/ci.yml index bffbc08a0e..b9c234366f 100644 --- a/.ci/pipeline/ci.yml +++ b/.ci/pipeline/ci.yml @@ -48,13 +48,18 @@ jobs: pool: vmImage: 'ubuntu-22.04' steps: + - script: | + echo "##vso[task.setvariable variable=ISORT_VERSION]$(grep -zoP '(?<=isort\n rev: ).*' .pre-commit-config.yaml)" + echo "##vso[task.setvariable variable=BLACK_VERSION]$(grep -zoP '(?<=black\n rev: ).*' .pre-commit-config.yaml)" + echo "##vso[task.setvariable variable=PYTHON_LINT_VERSION]$(grep -oP -m 1 '(?<=python).*' .pre-commit-config.yaml)" + displayName: 'Collect lint versions' - task: UsePythonVersion@0 inputs: - versionSpec: '3.9' + versionSpec: $(PYTHON_LINT_VERSION) addToPath: true - script: | python -m pip install --upgrade pip setuptools - pip install isort black[jupyter]==24.1.1 + pip install isort==${ISORT_VERSION} black[jupyter]==${BLACK_VERSION} isort --profile black --check . && black --check . displayName: 'Linting' - job: LinuxCondaEnv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69b711d5ea..c4f49656f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,12 +16,12 @@ repos: - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 24.1.1 hooks: - id: black language_version: python3.10 - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort language_version: python3.10 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bab6fcc8a9..ef1fd870d8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ Continuous Integration (CI) testing is enabled for the repository. Your pull req ## Code Style -We use [black](https://black.readthedocs.io/en/stable/) and [isort](https://pycqa.github.io/isort/) formatters for Python* code. The line length is 90 characters; use default options otherwise. You can find the linter configuration in [.pyproject.toml](https://github.com/intel/scikit-learn-intelex/blob/main/pyproject.toml). +We use [black](https://black.readthedocs.io/en/stable/) version 24.1.1 and [isort](https://pycqa.github.io/isort/) version 5.13.2 formatters for Python* code. The line length is 90 characters; use default options otherwise. You can find the linter configuration in [.pyproject.toml](https://github.com/intel/scikit-learn-intelex/blob/main/pyproject.toml). A GitHub* Action verifies if your changes comply with the output of the auto-formatting tools.