Micha Reiser
c923ffe389
Update more snapshots
2024-08-23 11:43:37 +02:00
Micha Reiser
aa7393344d
Upgrade annotation snippet
2024-08-23 11:28:59 +02:00
Micha Reiser
1ca14e4335
Move collection of parse errors to `check_file` ( #13059 )
2024-08-23 08:22:12 +02:00
Teodoro Freund
b9c8113a8a
Added bytes type and some inference ( #13061 )
...
## Summary
This PR adds the `bytes` type to red-knot:
- Added the `bytes` type
- Added support for bytes literals
- Support for the `+` operator
Improves on #12701
Big TODO on supporting and normalizing r-prefixed bytestrings
(`rb"hello\n"`)
## Test Plan
Added a test for a bytes literals, concatenation, and corner values
2024-08-22 13:27:15 -07:00
Dylan
2edd32aa31
[red-knot] `SemanticIndexBuilder` visits value before target in named expressions ( #13053 )
...
The `SemanticIndexBuilder` was causing a cycle in a salsa query by
attempting to resolve the target before the value in a named expression
(e.g. `x := x+1`). This PR swaps the order, avoiding a panic.
Closes #13012 .
2024-08-22 07:59:13 -07:00
Dhruv Manilawala
02c4373a49
Bump version to 0.6.2 ( #13056 )
2024-08-22 18:59:27 +05:30
Steve C
d37e2e5d33
[`flake8-simplify`] Extend open-file-with-context-handler to work with other standard-library IO modules (`SIM115`) ( #12959 )
...
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-08-22 14:18:55 +01:00
Dhruv Manilawala
d1d067896c
[red-knot] Remove notebook support from the server ( #13040 )
...
## Summary
This PR removes notebook sync support from server capabilities because
it isn't tested, it'll be added back once we actually add full support
for notebook.
2024-08-22 14:55:46 +05:30
Dhruv Manilawala
8144a11f98
[red-knot] Add definition for with items ( #12920 )
...
## Summary
This PR adds symbols and definitions introduced by `with` statements.
The symbols and definitions are introduced for each with item. The type
inference is updated to call the definition region type inference
instead.
## Test Plan
Add test case to check for symbol table and definitions.
2024-08-22 08:00:19 +05:30
Micha Reiser
dce87c21fd
Eagerly validate typeshed versions ( #12786 )
2024-08-21 15:49:53 +00:00
Micha Reiser
f873d2ac12
Revert "Use the system allocator for codspeed benchmarks" ( #13035 )
2024-08-21 17:13:11 +02:00
Alex Waygood
ecd9e6a650
[red-knot] Improve the `unresolved-import` check ( #13007 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-21 13:44:49 +00:00
Micha Reiser
785c39927b
Use ZIP file size metadata to allocate string ( #13032 )
2024-08-21 12:48:44 +00:00
Micha Reiser
a35cdbb275
Fix various panicks when linting black/src ( #13033 )
2024-08-21 12:35:29 +00:00
Dhruv Manilawala
0c98b5949c
Show full error context in server messages ( #13029 )
...
## Summary
Reference:
https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations
Closes : #13022
## Test Plan
```
2024-08-21 15:21:24.831 [info] [Trace - 3:21:24 PM] 0.017255167s ERROR ThreadId(04) ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml: TOML parse error at line 1, column 1
|
1 | [tool.ruff.lint]
| ^^^^^^^^^^^^^^^^
Unknown rule selector: `ME102`
```
Or,
```
2024-08-21 15:23:47.993 [info] [Trace - 3:23:47 PM] 143.179857375s ERROR ThreadId(66) ruff_server::session::index::ruff_settings: Failed to parse /Users/dhruv/playground/ruff/pyproject.toml: TOML parse error at line 2, column 42
|
2 | select = ["ALL", "TD006", "TD007", "FIX"
| ^
invalid array
expected `]`
```
2024-08-21 15:36:16 +05:30
Micha Reiser
e5f37a8254
Remove linter dependency from red_knot_server ( #13028 )
2024-08-21 10:02:42 +00:00
Micha Reiser
5c5dfc11f0
Upgrade to Salsa with tables ( #13016 )
2024-08-21 06:58:53 +00:00
Micha Reiser
678045e1aa
Use the system allocator for codspeed benchmarks ( #13005 )
2024-08-21 08:46:51 +02:00
François-Michel L'Heureux
dedefd73da
Update example for `PT001` as per the new default behavior ( #13019 )
...
## Summary
Example / Use instead were not updated with the release of ruff 0.6.0.
This updates them accordingly.
2024-08-21 09:34:18 +05:30
Alex Waygood
37a60460ed
[red-knot] Improve various tracing logs ( #13015 )
2024-08-20 18:34:51 +00:00
Micha Reiser
0bd258a370
Use `check` instead of `check_file` in benchmarks ( #13004 )
2024-08-20 12:20:40 +02:00
Dylan
9baab8672a
[`flake8-pyi`] Skip type annotations in `string-or-bytes-too-long` (`PYI053`) ( #13002 )
2024-08-20 10:53:22 +01:00
Micha Reiser
c65e3310d5
Add API to emit type-checking diagnostics ( #12988 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-08-20 07:22:30 +00:00
Micha Reiser
38c19fb96e
Fix re-entrance deadlock in Package::files ( #12948 )
2024-08-20 06:51:08 +00:00
Alex Lowe
abb4cdbf3d
pydocstyle: Add ignore setting to linter docs ( #12996 )
2024-08-20 08:33:50 +02:00
Dhruv Manilawala
1a8f29ea41
[red-knot] Add symbols defined by `match` statements ( #12926 )
...
## Summary
This PR adds symbols introduced by `match` statements.
There are three patterns that introduces new symbols:
* `as` pattern
* Sequence pattern
* Mapping pattern
The recursive nature of the visitor makes sure that all symbols are
added.
## Test Plan
Add test case for all types of patterns that introduces a symbol.
2024-08-20 05:16:27 +00:00
Dhruv Manilawala
aefaddeae7
[red-knot] Add definition for augmented assignment ( #12892 )
...
## Summary
This PR adds definition for augmented assignment. This is similar to
annotated assignment in terms of implementation.
An augmented assignment should also record a use of the variable but
that's a TODO for now.
## Test Plan
Add test case to validate that a definition is added.
2024-08-20 10:33:55 +05:30
Alex Waygood
049cda2ff3
`flake8-type-checking`: Always recognise relative imports as first-party ( #12994 )
2024-08-19 19:06:56 +01:00
Alex Waygood
e6d5a7af37
Add the `testing` feature of `ruff_db` as a dev-dependency for `ruff_workspace` ( #12985 )
2024-08-19 10:22:01 +00:00
Ken Baskett
f4c8c7eb70
[ruff] Implement check for Decimal called with a float literal (RUF032) ( #12909 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-19 09:22:19 +00:00
InSync
65de8f2c9b
Quote default values consistently ( #12981 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-19 08:02:55 +00:00
Charlie Marsh
80ade591df
Ignore unused arguments on stub functions ( #12966 )
...
## Summary
We already enforce this logic for the other `ARG` rules. I'm guessing
this was an oversight.
Closes https://github.com/astral-sh/ruff/issues/12963 .
2024-08-18 19:21:33 -04:00
Steve C
4881d32c80
[`pylint`] - remove AugAssign errors from `self-cls-assignment` (`W0642`) ( #12957 )
2024-08-18 15:31:09 +00:00
Steve C
81a2220ce1
[`pylint`] - Allow `__new__` methods to have `cls` as their first argument even if decorated with `@staticmethod` for `bad-staticmethod-argument` (`PLW0211`) ( #12958 )
2024-08-18 16:30:22 +01:00
Alex Waygood
f9d8189670
[`perflint`] Improve docs for `try-except-in-loop` (`PERF203`) ( #12947 )
2024-08-17 16:00:15 +01:00
TomerBin
52ba94191a
[`ruff`] Reduce FastAPI false positives in `unused-async` (`RUF029`) ( #12938 )
2024-08-17 14:25:14 +00:00
Micha Reiser
96802d6a7f
[`pep8-naming`] Don't flag `from` imports following conventional import names (`N817`) ( #12946 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-08-17 12:05:42 +00:00
Micha Reiser
dd0a7ec73e
Pull all types in corpus tests ( #12919 )
2024-08-17 11:59:55 +00:00
Daniel Sonbolian
25f5ae44c4
[flake8_bugbear] message based on expression location [B015] ( #12944 )
2024-08-17 13:54:19 +02:00
Alex Waygood
251efe5c41
[`ruff`] Ignore `fstring-missing-syntax` (`RUF027`) for `fastAPI` paths ( #12939 )
...
## Summary
As suggested by @MichaReiser in
https://github.com/astral-sh/ruff/pull/12886#pullrequestreview-2237679793 ,
this adds an exemption to `RUF027` for `fastAPI` paths, which require
template strings rather than eagerly evaluated f-strings.
## Test Plan
I added a fixture that causes Ruff to emit a false-positive error on
`main` but no longer does with this PR.
2024-08-17 11:10:34 +01:00
Carl Meyer
6359e55383
[red-knot] type narrowing ( #12706 )
...
Extend the `UseDefMap` to also track which constraints (provided by e.g.
`if` tests) apply to each visible definition.
Uses a custom `BitSet` and `BitSetArray` to track which constraints
apply to which definitions, while keeping data inline as much as
possible.
2024-08-16 16:34:13 -07:00
Alex Waygood
a9847af6e8
[red-knot] Use `Unknown` rather than `Unbound` for unresolved imports ( #12932 )
2024-08-16 20:10:33 +01:00
Micha Reiser
d61d75d4fa
Select stable import name when multiple possible bindings are in scope ( #12888 )
2024-08-16 20:16:57 +02:00
Alex Waygood
499c0bd875
Bump version to 0.6.1 ( #12937 )
...
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-16 17:48:06 +01:00
Alex Waygood
4cb30b598f
`N817` docs: refer to the correct setting ( #12935 )
2024-08-16 15:41:00 +00:00
Micha Reiser
aba0d83c11
[`flake8-naming`]: Respect import conventions (`N817`) ( #12922 )
2024-08-16 16:28:57 +01:00
Dhruv Manilawala
c319414e54
Ignore blank line rules for docs formatting ( #12934 )
...
## Summary
fixes : #12933
## Test Plan
`python scripts/check_docs_formatted.py --generate-docs`
2024-08-16 15:27:36 +00:00
Dhruv Manilawala
b850b812de
Use cell source code instead of the concatenated one ( #12929 )
...
## Summary
fixes : #12880
## Test Plan
Test against the notebook provided in the issue.
2024-08-16 19:50:12 +05:30
Alex Waygood
a87b27c075
[red-knot] Add support for relative imports ( #12910 )
...
Co-authored-by: Carl Meyer <carl@astral.sh>
2024-08-16 12:35:27 +01:00
Micha Reiser
9b73532b11
[`flake8-async`] Fix examples to use `async with` ( #12924 )
2024-08-16 12:24:59 +02:00