openedx / openedx/forum

chore: black not enforced in CI quality gate

Open
#284 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5
Forks
26
Avg merge
7d 11h
Merged PRs (30d)
2

Description

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 #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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Makefile's test-quality and test-format targets, then inspect the quality tox environment and requirements/quality.in, requirements/ci.txt, and requirements/dev.txt. Verify which dependency configuration applies after #283. Done means the quality gate runs formatting checks successfully with the intended dependency and no longer relies on the ineffective setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.