Files
edx-platform/.github/workflows/quality-checks.yml
Feanil Patel 467495cb22 feanil/pycodestyle to ruff (#38076)
* feat: add ruff and configure it to match current pycodestyle rules

Adds ruff to testing requirements and configures it in pyproject.toml
to enforce the same E/W rules that pycodestyle 2.8.x was enforcing.
Two additional rules (E714, E721) that pycodestyle 2.8.x did not enforce
are explicitly ignored for now and can be cleaned up in a follow-up.

Part of the migration from pycodestyle → ruff.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add ruff Makefile target

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: add ruff to quality CI workflow alongside pycodestyle

Runs ruff alongside pycodestyle so we can validate parity before
removing pycodestyle in the next commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: remove pycodestyle, replaced by ruff

- Remove pycodestyle from requirements
- Remove pycodestyle version constraint (pinned to <2.9.0 due to a
  false positive E275 bug that is no longer relevant)
- Remove [pycodestyle] config from setup.cfg (config now lives in
  pyproject.toml under [tool.ruff])
- Remove pycodestyle Makefile target
- Remove make pycodestyle from quality CI workflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* style: Apply suggestions from code review

Remove unnecessary ignores.

Co-authored-by: Braden MacDonald <braden@opencraft.com>

* style: Fix a style isusue and remove ignores.

Most of these ignores are unnecessary as we're passing them now and we
want to check them in the future. E714 only had one fixable violation so
we just fixed it.

* style: Update ruff config and workflows

* Update the call to `ruff` so that it outputs in a github friendly
manner.

* Remove ruff exclusions that are already covered by .gitignore which
  ruff respects.

* chore: Recompile requirements.

Update the requirements to drop pycodestyle and add ruff.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Braden MacDonald <braden@opencraft.com>
2026-03-04 17:33:06 +00:00

96 lines
2.3 KiB
YAML

name: Quality checks
on:
pull_request:
merge_group:
push:
branches:
- master
- open-release/lilac.master
jobs:
run_tests:
name: Quality Others
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]
python-version:
- "3.11"
node-version: [20]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Fetch base branch for comparison
run: git fetch --depth=1 origin ${{ github.base_ref }}
- name: Install Required System Packages
run: sudo apt-get update && sudo apt-get install libxmlsec1-dev
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Setup npm
run: npm i -g npm@8.5.x
- name: Get pip cache dir
id: pip-cache-dir
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip dependencies
id: cache-dependencies
uses: actions/cache@v5
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/edx/testing.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install Required Python Dependencies
env:
PIP_SRC: ${{ runner.temp }}
run: |
make test-requirements
- name: Install npm
env:
PIP_SRC: ${{ runner.temp }}
run: npm ci
- name: Install python packages
env:
PIP_SRC: ${{ runner.temp }}
run: |
pip install -e .
- name: Run Quality Tests
env:
PIP_SRC: ${{ runner.temp }}
TARGET_BRANCH: ${{ github.base_ref }}
run: |
ruff check --output-format=github .
make xsslint
make pii_check
make check_keywords
- name: Save Job Artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: Build-Artifacts
path: |
**/reports/**/*
test_root/log/**/*.log
*.log
overwrite: true