Skip to content

Support typed ignore-errors directives#3944

Open
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/pyrefly-ignore-errors-codes
Open

Support typed ignore-errors directives#3944
WilliamK112 wants to merge 1 commit into
facebook:mainfrom
WilliamK112:codex/pyrefly-ignore-errors-codes

Conversation

@WilliamK112

Copy link
Copy Markdown

Summary

  • Support # pyrefly: ignore-errors[code] as a file-level suppression for selected Pyrefly error codes.
  • Reuse the existing Suppression representation for file-level directives so whole-file and line-level Pyrefly code matching share the same semantics, including parent suppression names.
  • Keep non-Pyrefly ignore-errors directives as blanket-only and document the new Pyrefly form.

Fixes #3723

Notes

This is scoped to file-level code filtering for pyrefly: ignore-errors. Related suppression lint/reporting PRs (#3832 and #3797) address separate diagnostics and unused-ignore behavior.

Validation

  • cargo fmt --check
  • git diff --check
  • cargo test -p pyrefly_python test_parse_ignore_all
  • CARGO_TARGET_DIR=/Users/William/pyrefly-target-codex cargo test -p pyrefly test_pyrefly_top_level_ignore_typed

Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@NathanTempest NathanTempest 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.

Thanks @WilliamK112, welcome, and nice work. Reusing Suppression so file-level ignore-errors[code] shares the exact same representation and bracket-parsing as line-level ignore[code] is the right call, and keeping ignore-errors[code] Pyrefly-only (blanket for mypy/pyre) matches those tools' real semantics. LGTM for importing.

One possible follow-up: parse_ignore_all_kind duplicates the split(',')/trim bracket parse from parse_ignore_comment could share a helper someday. I will address this after importing this PR, nothing for you to do and thank you for the fix

@meta-codesync

meta-codesync Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

@NathanTempest has imported this pull request. If you are a Meta employee, you can view this in D110063592.

@kinto0 kinto0 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.

Review automatically exported from Phabricator review in Meta.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support whole file suppression for specific error codes (pyrefly: ignore-errors)

3 participants