Skip to content

build: restore pylint to the quality checks - #294

Open
farhan wants to merge 2 commits into
mainfrom
farhan/restore-pylint-289
Open

build: restore pylint to the quality checks#294
farhan wants to merge 2 commits into
mainfrom
farhan/restore-pylint-289

Conversation

@farhan

@farhan farhan commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Important

Generated with Claude, then manually reviewed (both this PR description and the code commits).

Related

Summary

Restores pylint to the quality gate alongside ruff. Per #289, ruff is not a drop-in replacement for pylint — it does not run the edx_lint plugins and does not catch the class of issues (undefined attributes, type mismatches, etc.) that pylint does. Ruff stays responsible for style, imports, formatting, and unused-import; pylint is added back for the deeper static analysis.

Ruff / pylint ownership

Each check is owned by exactly one tool, so nothing is enforced twice:

  • unused-import (F401) → ruff. It's auto-fixable via ruff check --fix, so pylint disables unused-import. The package __init__ re-exports use the explicit import X as X alias idiom (PEP 484), which ruff recognizes as intentional re-exports (no F401). This idiom is used instead of __all__ because Sphinx (built with -W) re-documents __all__ re-exports under every import path, producing duplicate-object and ambiguous-cross-reference warnings that fail the docs check — the alias idiom is not re-documented by autodoc, so docs stays green. pylint's useless-import-alias (C0414) is disabled since it is a false positive on this deliberate re-export idiom.
  • line-length (E501 / C0301) → pylint. Ruff ignores E501; pylint's C0301 enforces the 120-char limit (including trailing comments).

Everything else in ruff's select (E, W, F, I, B, C4, UP, DJ) stays active. This keeps pylint on its edx-lint defaults and mirrors how edx-platform runs the two tools side by side.

Testing

tox -e quality passes end to end (ruff check, ruff format --check, pylint xblocks_contrib xblock_pdf), and tox -e docs builds cleanly with warnings-as-errors (-W). CI already runs uv run tox with both quality and docs in the matrix, so they run there automatically — no workflow change needed.

@farhan
farhan marked this pull request as draft August 21, 2026 08:11
@farhan
farhan force-pushed the farhan/restore-pylint-289 branch from 5efa33b to 23291e6 Compare August 21, 2026 10:47
@farhan farhan self-assigned this Aug 21, 2026
@farhan
farhan marked this pull request as ready for review August 21, 2026 13:10
@farhan farhan moved this to 👀 In review in Aximprovements Team Aug 21, 2026
@farhan
farhan requested review from a team and kdmccormick August 21, 2026 13:24
@farhan
farhan requested a review from a team August 24, 2026 10:20
@farhan
farhan force-pushed the farhan/restore-pylint-289 branch from 52f4df8 to ee34323 Compare August 24, 2026 13:24

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR!

nit: do you mind changing the commit title to build: ... ? that way, if somebody squash-merges, we end up with the correct commit message title. The commit titles matter more now that we're using them as input to semantic releases.

Comment thread pyproject.toml Outdated
@farhan
farhan force-pushed the farhan/restore-pylint-289 branch 3 times, most recently from 25b6d6d to 6b7ead8 Compare August 31, 2026 13:39
Restores pylint to the quality gate alongside ruff. Ruff is not a
drop-in replacement for pylint -- it does not run the edx_lint plugins
or catch issues such as undefined attributes and type mismatches. Ruff
owns style, imports, formatting, and unused-import; pylint provides the
deeper static analysis.

Ownership is split so no check runs in both tools:

- unused-import (F401) -> ruff. It is auto-fixable, so pylint disables
  unused-import. Package __init__ re-exports are declared with __all__
  so ruff treats them as intentional re-exports (no F401).
- line-length (E501 / C0301) -> pylint. Ruff ignores E501; pylint's
  C0301 enforces the 120-char limit.

Also renames the Makefile `lint` target to `quality`, removes stale
pylint useless-suppression comments, and wraps one over-length line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@farhan
farhan force-pushed the farhan/restore-pylint-289 branch from 6b7ead8 to 0b3f0c8 Compare August 31, 2026 13:41
@farhan
farhan requested a review from kdmccormick August 31, 2026 14:07
@farhan farhan changed the title feat: restore pylint to the quality checks build: restore pylint to the quality checks Aug 31, 2026
Adding __all__ to the package __init__ files made Sphinx (run with -W)
document ProblemBlock and safe_exec at several import paths, producing
duplicate-object and ambiguous-cross-reference warnings that failed the
docs check. Revert those re-exports to the `import X as X` idiom, which
marks the intentional re-export for ruff without being re-documented by
autodoc, and disable pylint's useless-import-alias (a false positive on
this PEP 484 idiom) so the quality check stays green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@farhan
farhan requested a review from feanil August 31, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore pylint: ruff is not a drop-in replacement

3 participants