Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[red-knot] Allow any Ranged argument for report_lint and report_diagnostic #16252

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Feb 19, 2025

Summary

Restricting report_lint and report_diagnostic to only take ast nodes as arguments is too restrictive.
E.g., we may want to highlight a comparision like 10 not in b but there's no single node that represents just the not in ... comparision.

This PR relaxes the argument representing the range to accept any Ranged type.

Test Plan

cargo test

@MichaReiser MichaReiser added the red-knot Multi-file analysis & type inference label Feb 19, 2025
@MichaReiser MichaReiser force-pushed the micha/report-non-nodes branch from a1751a8 to 25cce39 Compare February 19, 2025 13:15
@MichaReiser MichaReiser force-pushed the micha/report-non-nodes branch from 25cce39 to 66372f1 Compare February 19, 2025 13:27
@MichaReiser MichaReiser merged commit 55ea094 into main Feb 19, 2025
20 checks passed
@MichaReiser MichaReiser deleted the micha/report-non-nodes branch February 19, 2025 13:34
dcreager added a commit that referenced this pull request Feb 19, 2025
* main:
  [red-knot] Allow any `Ranged` argument for `report_lint` and `report_diagnostic` (#16252)
  [pycodestyle] Exempt `site.addsitedir(...)` calls (E402) (#16251)
  red_knot_python_semantic: improve diagnostic message for "invalid argument type"
  ruff_db: add "secondary" messages to `Diagnostic` trait
  ruff_db: refactor snippet rendering
  red_knot_python_semantic: remove `Ranged` impl for `TypeCheckDiagnostic`
  [red-knot] Refactor `infer_chained_boolean_types` to have access to `TypeInferenceBuilder` (#16222)
  Add `red_knot/README.md` (#16230)
  [airflow] move class attributed related cases to AIR302_class_attribute (AIR302) (#16226)
  [red-knot] Update tests for attributes inferred from parameters (#16208)
  [red-knot] update TODO comment in mdtest (#16242)
  [`refurb`] Correctly handle lengths of literal strings in `slice-to-remove-prefix-or-suffix` (`FURB188`) (#16237)
  Pass `ast::PythonVersion` to `type_hint_resolves_to_any` (#16236)
  Use `ast::PythonVersion` internally in the formatter and linter (#16170)
  Add `SECURITY.md` (#16224)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants