Switch linter from flake8 to ruff

This commit is contained in:
Adam Yoblick 2023-08-11 15:13:14 -05:00
parent 894fd5e4f4
commit 86a0ede4c1

View file

@ -1,111 +1,131 @@
# This pipeline is used to run PR validation and CI builds against the debugpy public repo.
# Seperate internal pipelines are used for generating wheels, signing, and releasing to pypi.org
# Trigger ci builds for commits into master and any release branches
trigger:
branches:
include:
- main
- release/*
# Trigger pr builds for commits into master and any release branches
# Ignore draft PR's
pr:
branches:
include:
- main
- release/*
drafts: false
variables: variables:
architecture: "x64" architecture: "x64"
jobs: jobs:
- job: "Lint" - job: "Lint"
timeoutInMinutes: 15 displayName: "Lint"
displayName: "Lint" pool: { vmImage: "ubuntu-latest" }
pool: { vmImage: "ubuntu-latest" }
variables: variables:
python.version: "3.8" python.version: "3.8"
steps: steps:
- template: "templates/use_python.yml"
- script: | - template: "templates/use_python.yml"
python3 -m pip install -U flake8
python3 -m pip install -U git+https://github.com/karthiknadig/flake8reports
displayName: "Setup flake8"
- script: | # Install and run ruff
python3 -m flake8 --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-flake8.xml # See https://github.com/astral-sh/ruff and https://beta.ruff.rs/docs/
displayName: "Run flake8" - script: python3 -m pip install -U ruff
displayName: "Install ruff"
- task: "PublishTestResults@2" # To unblock the build even with lint errors, add "--exit-zero" to the command line
condition: "always()" - script: python3 -m ruff check --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml .
inputs: displayName: "Run ruff"
testRunTitle: "$(Agent.JobName)"
testResultsFiles: "lint-*.xml" - task: "PublishTestResults@2"
searchFolder: "$(Build.ArtifactStagingDirectory)" displayName: "Publish linting results"
displayName: "Publish linting results" inputs:
testRunTitle: "$(Agent.JobName)"
testResultsFiles: "lint-*.xml"
searchFolder: "$(Build.ArtifactStagingDirectory)"
condition: "always()"
- job: "Test_Linux" - job: "Test_Linux"
timeoutInMinutes: 30 timeoutInMinutes: 30
displayName: "Tests - Linux" displayName: "Tests - Linux"
pool: { vmImage: "ubuntu-latest" } pool: { vmImage: "ubuntu-latest" }
strategy: strategy:
matrix: matrix:
py37: py37:
python.version: "3.7" python.version: "3.7"
py38: py38:
python.version: "3.8" python.version: "3.8"
py39: py39:
python.version: "3.9" python.version: "3.9"
py310: py310:
python.version: "3.10" python.version: "3.10"
steps: steps:
- script: | - script: |
sudo apt-get update sudo apt-get update
sudo apt-get --yes install gdb sudo apt-get --yes install gdb
sudo sysctl kernel.yama.ptrace_scope=0 sudo sysctl kernel.yama.ptrace_scope=0
displayName: "Setup gdb" displayName: "Setup gdb"
- template: "templates/use_python.yml" - template: "templates/use_python.yml"
- template: "templates/run_tests.yml" - template: "templates/run_tests.yml"
- job: "Test_MacOS" - job: "Test_MacOS"
timeoutInMinutes: 30 timeoutInMinutes: 30
displayName: "Tests - macOS" displayName: "Tests - macOS"
pool: { vmImage: "macOS-11" } pool: { vmImage: "macOS-11" }
strategy: strategy:
matrix: matrix:
py37: py37:
python.version: "3.7" python.version: "3.7"
py38: py38:
python.version: "3.8" python.version: "3.8"
py39: py39:
python.version: "3.9" python.version: "3.9"
py310: py310:
python.version: "3.10" python.version: "3.10"
steps: steps:
- script: | - script: |
ulimit -Sn 8192 ulimit -Sn 8192
displayName: "Increase file descriptor limit" displayName: "Increase file descriptor limit"
- template: "templates/use_python.yml" - template: "templates/use_python.yml"
- script: | - script: |
python -m ensurepip --user python -m ensurepip --user
displayName: "Bootstrap pip" displayName: "Bootstrap pip"
- template: "templates/run_tests.yml" - template: "templates/run_tests.yml"
- job: "Test_Windows" - job: "Test_Windows"
timeoutInMinutes: 40 timeoutInMinutes: 40
displayName: "Tests - Windows" displayName: "Tests - Windows"
pool: { vmImage: "windows-latest" } pool: { vmImage: "windows-latest" }
strategy: strategy:
matrix: matrix:
py37: py37:
python.version: "3.7" python.version: "3.7"
py38: py38:
python.version: "3.8" python.version: "3.8"
py39: py39:
python.version: "3.9" python.version: "3.9"
py310: py310:
python.version: "3.10" python.version: "3.10"
py39_32: py39_32:
python.version: "3.9" python.version: "3.9"
architecture: "x86" architecture: "x86"
steps: steps:
- template: "templates/use_python.yml" - template: "templates/use_python.yml"
- template: "templates/run_tests.yml" - template: "templates/run_tests.yml"