Skip to content

chore: black not enforced in CI quality gate #284

Description

@farhan

Summary

black --check has never been part of the effective CI quality gate on master, despite appearing to be.

Root Cause

The Makefile on master includes:

test-quality: test-lint test-codestyle test-mypy test-format
test-format:
    black --check ${SRC_FILES}

And CI's quality tox env runs make test-quality. However, requirements/quality.txt (which the quality tox env installs from) does not include black. black is only present in requirements/ci.txt and requirements/dev.txt.

As a result, black --check cannot run in the quality tox env — formatting has silently been unenforced in CI.

This was discovered during the modernization PR #283. I removed test-format from test-quality in that PR to maintain parity with what master for now and let work on it with plan.

Proposed Fix

Replace black with ruff format, which is the standard formatter for modernized Open edX Python repos and is already part of the ruff linting toolchain. Specifically:

  1. Add ruff to requirements/quality.in (or the quality dependency group in pyproject.toml after build: modernize forum repo to use uv, pyproject.toml, and semantic-release #283)
  2. Replace the test-format target:
    test-format:
        ruff format --check ${SRC_FILES}
  3. Restore test-format in test-quality so formatting is actually enforced
  4. Remove black from all requirements files

ruff format is Black-compatible by design and handles imports cleanly, satisfying the same formatting contract without the dependency overhead.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions