Repository navigation
Support typed ignore-errors directives - #3944
WilliamK112 wants to merge 1 commit into
Conversation
Signed-off-by: WilliamK112 <164879897+WilliamK112@users.noreply.github.com>
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
NathanTempest
left a comment
There was a problem hiding this comment.
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
|
@NathanTempest has imported this pull request. If you are a Meta employee, you can view this in D110063592. |
kinto0
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
kinto0
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
@NathanTempest merged this pull request in 6f9791b. |
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 meta#3723 Import note (maintainer changes on top of the PR, addressing Devmate review nits): - Dedupe the `[code, code]` parse into a shared `parse_error_codes` helper used by both the line-level and file-level parsers. - Reject malformed file-level directives with a missing closing `]` (previously silently accepted as valid). - Drop empty entries so `# pyrefly: ignore-errors[]` (and trailing commas) act as a blanket ignore rather than a directive matching nothing. - Update the `parse_ignore_all` docstring to reflect its `Vec<Suppression>` return shape. ## Notes This is scoped to file-level code filtering for `pyrefly: ignore-errors`. Related suppression lint/reporting PRs (meta#3832 and meta#3797) address separate diagnostics and unused-ignore behavior. Pull Request resolved: meta#3944 Test Plan: buck test pyrefly:pyrefly_library -- test_pyrefly_top_level_ignore (6 pass); buck test pyrefly_python -- test_parse_ignore (4 pass, incl. empty-bracket + missing-bracket cases). Reviewed By: kinto0 Differential Revision: D110063592 Pulled By: NathanTempest fbshipit-source-id: 734d71d546e8d39f696b31af3eaeb0a53d6f094f
Summary
# pyrefly: ignore-errors[code]as a file-level suppression for selected Pyrefly error codes.Suppressionrepresentation for file-level directives so whole-file and line-level Pyrefly code matching share the same semantics, including parent suppression names.ignore-errorsdirectives 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 --checkgit diff --checkcargo test -p pyrefly_python test_parse_ignore_allCARGO_TARGET_DIR=/Users/William/pyrefly-target-codex cargo test -p pyrefly test_pyrefly_top_level_ignore_typed