-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Comparing changes
Open a pull request
base repository: astral-sh/ruff
base: 0.5.3
head repository: astral-sh/ruff
compare: 0.5.4
- 17 commits
- 45 files changed
- 11 contributors
Commits on Jul 18, 2024
-
[red-knot] support implicit global name lookups (#12374)
Support falling back to a global name lookup if a name isn't defined in the local scope, in the cases where that is correct according to Python semantics. In class scopes, a name lookup checks the local namespace first, and if the name isn't found there, looks it up in globals. In function scopes (and type parameter scopes, which are function-like), if a name has any definitions in the local scope, it is a local, and accessing it when none of those definitions have executed yet just results in an `UnboundLocalError`, it does not fall back to a global. If the name does not have any definitions in the local scope, then it is an implicit global. Public symbol type lookups never include such a fall back. For example, if a name is not defined in a class scope, it is not available as a member on that class, even if a name lookup within the class scope would have fallen back to a global lookup. This PR makes the `@override` lint rule work again. Not yet included/supported in this PR: * Support for free variables / closures: a free symbol in a nested function-like scope referring to a symbol in an outer function-like scope. * Support for `global` and `nonlocal` statements, which force a symbol to be treated as global or nonlocal even if it has definitions in the local scope. * Module-global lookups should fall back to builtins if the name isn't found in the module scope. I would like to expose nicer APIs for the various kinds of symbols (explicit global, implicit global, free, etc), but this will also wait for a later PR, when more kinds of symbols are supported.
Configuration menu - View commit details
-
Copy full SHA for 519eca9 - Browse repository at this point
Copy the full SHA 519eca9View commit details -
[red-knot] rename module_global to global (#12385)
Per comments in #12269, "module global" is kind of long, and arguably redundant. I tried just using "module" but there were too many cases where I felt this was ambiguous. I like the way "global" works out better, though it does require an understanding that in Python "global" generally means "module global" not "globally global" (though in a sense module globals are also globally global since modules are singletons).
Configuration menu - View commit details
-
Copy full SHA for 181e7b3 - Browse repository at this point
Copy the full SHA 181e7b3View commit details -
[red-knot] use a simpler builtin in the benchmark (#12393)
In preparation for supporting resolving builtins, simplify the benchmark so it doesn't look up `str`, which is actually a complex builtin to deal with because it inherits `Sequence[str]`. Co-authored-by: Alex Waygood <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for fa5b19d - Browse repository at this point
Copy the full SHA fa5b19dView commit details -
[pydocstyle] Escaped docstring in docstring (D301 ) (#12192)
<!-- Thank you for contributing to Ruff! To help us out with reviewing, please consider the following: - Does this pull request include a summary of the change? (See below.) - Does this pull request include a descriptive title? - Does this pull request include references to any relevant issues? --> ## Summary <!-- What's the purpose of the change? What does it do, and why? --> This PR updates D301 rule to allow inclduing escaped docstring, e.g. `\"""Foo.\"""` or `\"\"\"Bar.\"\"\"`, within a docstring. Related issue: #12152 ## Test Plan Add more test cases to D301.py and update the snapshot file. <!-- How was it tested? -->
Configuration menu - View commit details
-
Copy full SHA for 0ba7fc6 - Browse repository at this point
Copy the full SHA 0ba7fc6View commit details -
[
ruff
] RenameRUF007
tozip-instead-of-pairwise
(#12399)## Summary <!-- What's the purpose of the change? What does it do, and why? --> Renames the rule [RUF007](https://docs.astral.sh/ruff/rules/pairwise-over-zipped/) from `pairwise-over-zipped` to `zip-instead-of-pairwise`. This closes #12397. Specifically, in this PR: - The file containing the rule was renamed - The struct was renamed - The function implementing the rule was renamed ## Testing <!-- How was it tested? --> - `cargo test` - Docs re-built locally and verified that new rule name is displayed. (Screenshots below). <img width="939" alt="New rule name in rule summary" src="https://github.com/user-attachments/assets/bf638bc9-1b7a-4675-99bf-e4de88fec167"> <img width="805" alt="New rule name in rule details" src="https://github.com/user-attachments/assets/6fffd745-2568-424a-84e5-f94a41351022">
Configuration menu - View commit details
-
Copy full SHA for d617470 - Browse repository at this point
Copy the full SHA d617470View commit details
Commits on Jul 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for a62e2d2 - Browse repository at this point
Copy the full SHA a62e2d2View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad19b3f - Browse repository at this point
Copy the full SHA ad19b3fView commit details -
[red-knot] Fix bug where module resolution would not be invalidated i…
…f an entire package was deleted (#12378)
Configuration menu - View commit details
-
Copy full SHA for 5f96f69 - Browse repository at this point
Copy the full SHA 5f96f69View commit details -
[red-knot] trace file when inferring types (#12401)
When poring over traces, the ones that just include a definition or symbol or expression ID aren't very useful, because you don't know which file it comes from. This adds that information to the trace. I guess the downside here is that if calling `.file(db)` on a scope/definition/expression would execute other traced code, it would be marked as outside the span? I don't think that's a concern, because I don't think a simple field access on a tracked struct should ever execute our code. If I'm wrong and this is a problem, it seems like the tracing crate has this feature where you can record a field as `tracing::field::Empty` and then fill in its value later with `span.record(...)`, but when I tried this it wasn't working for me, not sure why. I think there's a lot more we can do to make our tracing output more useful for debugging (e.g. record an event whenever a definition/symbol/expression/use id is created with the details of that definition/symbol/expression/use), this is just dipping my toes in the water.
Configuration menu - View commit details
-
Copy full SHA for f82bb67 - Browse repository at this point
Copy the full SHA f82bb67View commit details -
[red-knot] fix incremental benchmark (#12400)
We should write `BAR_CODE` to `bar.py`, not to `foo.py`.
Configuration menu - View commit details
-
Copy full SHA for 1c7b840 - Browse repository at this point
Copy the full SHA 1c7b840View commit details -
[red-knot] Resolve symbols from
builtins.pyi
in the stdlib if they ……cannot be found in other scopes (#12390) Co-authored-by: Carl Meyer <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d8cf8ac - Browse repository at this point
Copy the full SHA d8cf8acView commit details -
Update docs Settings output-format default (#12409)
## Update docs Settings output-format default Fixes #12350 ## Test Plan Run all automation mentioned here https://github.com/astral-sh/ruff/blob/fe04f2b09d0b676f1fa09f732e907ef64deffbb1/CONTRIBUTING.md#development Manually verified changes in the generated MkDocs site. Co-authored-by: Oleksandr Zavertniev <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ca22248 - Browse repository at this point
Copy the full SHA ca22248View commit details -
Fix the Github link error for Neovim in the setup for editors in the …
…docs. (#12410) ## Summary Fix Github link error for Neovim setup editors . ## Test Plan Click Neovim Github link with mkdocs on local.
Configuration menu - View commit details
-
Copy full SHA for c0a2b49 - Browse repository at this point
Copy the full SHA c0a2b49View commit details
Commits on Jul 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 4bcc96a - Browse repository at this point
Copy the full SHA 4bcc96aView commit details -
Insert parentheses for multi-argument generators (#12422)
## Summary Closes #12420.
Configuration menu - View commit details
-
Copy full SHA for 2c1926b - Browse repository at this point
Copy the full SHA 2c1926bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3664f85 - Browse repository at this point
Copy the full SHA 3664f85View commit details -
Configuration menu - View commit details
-
Copy full SHA for 53b84ab - Browse repository at this point
Copy the full SHA 53b84abView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 0.5.3...0.5.4