Skip to content

Fix ruff lint and formatting issues#267

Open
salman2013 wants to merge 1 commit into
salman/modernize-branchfrom
salman/fix-quality-issues
Open

Fix ruff lint and formatting issues#267
salman2013 wants to merge 1 commit into
salman/modernize-branchfrom
salman/fix-quality-issues

Conversation

@salman2013

Copy link
Copy Markdown
Contributor

Description

Fix linting and documentation formatting issues introduced during the repository's migration to Ruff-based formatting.

Parent PR: #251

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Manual testing instructions provided
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

- Fix F401 re-exports in __init__.py files using explicit `X as X` syntax
- Fix F841 unused variables by removing assignments or using _ prefix
- Remove unused imports auto-fixed by ruff
- Auto-format 48 files with ruff format
- Fix 3 E501 long lines in lti.py
- Update docs/changelog.rst to point to GitHub Releases (CHANGELOG.rst removed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 23, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @salman2013!

This repository is currently maintained by @openedx/axim-engineering.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the core contributor PR author is a Core Contributor (who may or may not have write access to this repo). label Jun 23, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jun 23, 2026
@farhan farhan requested a review from Copilot June 24, 2026 10:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Ruff linting and formatting issues introduced during the repo’s migration to Ruff-based formatting, primarily by normalizing string quoting, trailing commas, and line-wrapping across the codebase and tests.

Changes:

  • Apply Ruff-compatible formatting updates across multiple XBlocks (video, lti, problem/capa, word_cloud, discussion, html, poll, annotatable, pdf) and their tests.
  • Update package __init__.py re-exports to use Ruff’s explicit re-export pattern (as Name).
  • Adjust docs formatting, including replacing the Sphinx include-based changelog page with a short “GitHub Releases” link page.

Reviewed changes

Copilot reviewed 61 out of 62 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
xblocks_contrib/word_cloud/word_cloud.py Ruff formatting/quoting updates; minor line-wrapping changes.
xblocks_contrib/word_cloud/tests/test_word_cloud.py Update expected structures/strings to match formatting conventions.
xblocks_contrib/word_cloud/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/video/video.py Extensive quoting/formatting normalization; minor refactors for readability.
xblocks_contrib/video/video_xfields.py Formatting updates to XFields module (note: docstring/lint directive issue flagged).
xblocks_contrib/video/video_utils.py Formatting/quoting updates; list comprehension compacting.
xblocks_contrib/video/video_transcripts_utils.py Formatting/quoting updates and minor cleanup.
xblocks_contrib/video/video_static_content_utils.py Formatting/quoting updates.
xblocks_contrib/video/video_handlers.py Formatting/quoting updates; handler formatting cleanup.
xblocks_contrib/video/validation.py Minor formatting (blank line) cleanup.
xblocks_contrib/video/tests/test_utils.py Formatting/quoting updates for test helpers.
xblocks_contrib/video/tests/test_studio_metadata_mixin.py Formatting/quoting updates for tests and patch contexts.
xblocks_contrib/video/studio_metadata_mixin.py Formatting/quoting updates for metadata shaping.
xblocks_contrib/video/mixin.py Formatting/quoting updates for XML license helpers.
xblocks_contrib/video/constants.py Quote normalization for constants.
xblocks_contrib/video/cache_utils.py Formatting/quoting updates.
xblocks_contrib/video/bumper_utils.py Formatting/quoting updates; line wrapping.
xblocks_contrib/video/ajax_handler_mixin.py Formatting/quoting updates for handler response.
xblocks_contrib/video/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/problem/tests/test_capa_block.py Formatting cleanup (assert wrapping, whitespace).
xblocks_contrib/problem/capa/xqueue_interface.py Remove unused variables by renaming to underscore-prefixed.
xblocks_contrib/problem/capa/tests/test_xqueue_submission.py Formatting cleanup; string literal normalization.
xblocks_contrib/problem/capa/tests/test_xqueue_interface.py Formatting cleanup; string literal normalization.
xblocks_contrib/problem/capa/tests/test_shuffle.py Formatting cleanup; slice spacing normalization.
xblocks_contrib/problem/capa/tests/test_responsetypes.py Formatting cleanup (whitespace).
xblocks_contrib/problem/capa/tests/test_inputtypes.py Remove unused assigned variable in test.
xblocks_contrib/problem/capa/tests/response_xml_factory.py Formatting cleanup (whitespace).
xblocks_contrib/problem/capa/safe_exec/tests/test_safe_exec.py Formatting cleanup (whitespace).
xblocks_contrib/problem/capa/safe_exec/safe_exec.py Formatting cleanup (whitespace).
xblocks_contrib/problem/capa/safe_exec/lazymod.py Remove unused variable by renaming to underscore-prefixed.
xblocks_contrib/problem/capa/safe_exec/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/problem/capa/responsetypes.py Formatting/line-wrapping updates around dynamic code assembly and helpers.
xblocks_contrib/problem/capa/inputtypes.py Formatting cleanup (whitespace).
xblocks_contrib/problem/capa/customrender.py Formatting/quoting update for etree serialization in f-string.
xblocks_contrib/problem/capa/capa_problem.py Formatting cleanup; slice spacing normalization.
xblocks_contrib/problem/capa_block.py Formatting updates for long strings and slice spacing.
xblocks_contrib/problem/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/poll/tests/test_poll.py Remove unused imports; keep tests intact.
xblocks_contrib/poll/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/lti/tests/test_lti20_unit.py Formatting updates (note: BAD_DISPATCH_INPUTS concatenation bug flagged).
xblocks_contrib/lti/tests/test_lti_unit.py Formatting cleanup for test setup and patching.
xblocks_contrib/lti/tests/helpers.py Formatting cleanup (regex literals, loops, signatures).
xblocks_contrib/lti/lti.py Formatting/quoting updates across fields, handlers, and OAuth logic.
xblocks_contrib/lti/lti_2_util.py Formatting/quoting updates; minor expression formatting.
xblocks_contrib/lti/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/legacy_utils/xml_utils.py Broad formatting/quoting updates; tuple/list wrapping normalization.
xblocks_contrib/html/tests/test_html.py Formatting cleanup (whitespace).
xblocks_contrib/html/html.py Formatting cleanup (whitespace).
xblocks_contrib/html/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/discussion/tests/test_discussion.py Formatting/quoting updates; line wrapping.
xblocks_contrib/discussion/discussion.py Formatting/quoting updates; line wrapping and template rendering calls.
xblocks_contrib/discussion/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/annotatable/annotatable.py Formatting/quoting updates; slice spacing normalization.
xblocks_contrib/annotatable/init.py Explicit re-export pattern for Ruff.
xblocks_contrib/init.py Explicit re-export pattern for Ruff for top-level exports.
xblock_pdf/utils.py Quote normalization in helpers.
xblock_pdf/tests/test_pdf.py Formatting/quoting updates; remove unused import/variable.
xblock_pdf/pdf.py Formatting/quoting updates for handlers and templates.
xblock_pdf/init.py Explicit re-export pattern for Ruff.
docs/conf.py Minor formatting (blank line) cleanup.
docs/changelog.rst Replace include-based changelog with a short “GitHub Releases” reference page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to 4
"""# lint-amnesty, pylint: disable=cyclic-import
XFields for video block.
"""

Comment on lines 87 to 91
BAD_DISPATCH_INPUTS = [
None,
"",
"abcd"
"notuser/abcd"
"user/"
"user//"
"user/gbere/"
"user/gbere/xsdf"
"user/ಠ益ಠ", # not alphanumeric
"abcdnotuser/abcduser/user//user/gbere/user/gbere/xsdfuser/ಠ益ಠ", # not alphanumeric
]

@farhan farhan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 , let me review the base PR now, better to merge it later on.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to In Eng Review in Contributions Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: In Eng Review

Development

Successfully merging this pull request may close these issues.

5 participants