Skip to content

MAINT: Enable the full Ruff F rule family - #4466

Open
Cheikh Ahmed Tidiane Thiandoum (imRYiUK) wants to merge 5 commits into
microsoft:mainfrom
imRYiUK:maint/enable-ruff-f-family
Open

Cheikh Ahmed Tidiane Thiandoum (imRYiUK) wants to merge 5 commits into
microsoft:mainfrom
imRYiUK:maint/enable-ruff-f-family

Conversation

@imRYiUK

Copy link
Copy Markdown

Description

Fixes the outstanding pyflakes findings and selects the full F family in Ruff (it was limited to F401 and F821). This is the F stage of #3721; the ASYNC240/ASYNC250 stage is tracked separately.

  • pyrit/: rename loop variables that shadowed imports in memory_interface.py and memory_models.py, drop a redundant TYPE_CHECKING import in scenario.py, and remove an unused variable in wildguard_scorer.py.
  • tests/, docker/, doc/: remove unused variables and placeholder-less f-strings, plus a few redundant imports.
  • Two pairs of duplicate test names (test_seed.py, test_fallback_scorer.py) had their first definition silently shadowed and never run. The later ones are renamed so both run, and both pass.
  • Fixture imports used as test parameters (benchmark_app, sqlite_instance, ...) are marked # noqa: F811.
  • pyproject.toml: select F, and ignore F704 under doc/**, since top-level await is valid in notebooks and Ruff reports it as F704. This sits next to the existing PLE1142 ignore.

Measured with Ruff 0.17.4 (the pre-commit pin) on current main. ruff check . and ruff format --check . pass.

Related to #3721

Copilot AI balanced review requested due to automatic review settings November 20, 2026 08:22

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@imRYiUK

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@imRYiUK

Copy link
Copy Markdown
Author

CLA is signed. build_and_test passes on my fork (all pre-commit hooks, plus unit tests on Python 3.11–3.14 across ubuntu, macOS and Windows): https://github.com/imRYiUK/PyRIT/actions/runs/44713138340

Roman Lutz (@romanlutz) could you approve the workflow run here and take a look when you have a moment?

@jbolor21 jbolor21 self-assigned this Nov 20, 2026
Fix the outstanding pyflakes findings and select F instead of only F401 and F821. Top-level await in doc/ notebooks is reported as F704, so it is ignored there like PLE1142.
remove F704 to narrow this ruff exception
adding F704 back
Tightened the [schema test] - Renamed to `test_print_schema_lists_id_for_prompt_memory_entry`. Kept the setup and `obj._print_schema()` call. Replaced the output assertions with these so an `id` from a different table cannot make the test pass

This branch has not been deployed

No deployments
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.

3 participants