Skip to content

Commit 5db470e

Browse files
committed
Merge branch 'main' into alex/eager-scopes
* main: (60 commits) [`refurb`] Manual timezone monkeypatching (`FURB162`) (#16113) [`pyupgrade`] Do not upgrade functional TypedDicts with private field names to the class-based syntax (`UP013`) (#16219) Improve docs for PYI019 (#16229) Refactor `CallOutcome` to `Result` (#16161) Fix minor punctuation errors (#16228) Include document specific debug info (#16215) Update server to return the debug info as string (#16214) [`airflow`] Group `ImportPathMoved` and `ProviderName` to avoid misusing (`AIR303`) (#16157) Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187) Ignore source code actions for a notebook cell (#16154) Add FAQ entry for `source.*` code actions in Notebook (#16212) red-knot: move symbol lookups in `symbol.rs` (#16152) better error messages while loading configuration `extend`s (#15658) Format `index.css` (#16207) Improve API exposed on `ExprStringLiteral` nodes (#16192) Update Rust crate tempfile to v3.17.0 (#16202) Update cloudflare/wrangler-action action to v3.14.0 (#16203) Update NPM Development dependencies (#16199) Update Rust crate smallvec to v1.14.0 (#16201) Update Rust crate codspeed-criterion-compat to v2.8.0 (#16200) ...
2 parents a63c6e6 + 711af0d commit 5db470e

File tree

233 files changed

+12112
-4761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+12112
-4761
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ jobs:
712712
just test
713713
714714
benchmarks:
715-
runs-on: ubuntu-22.04
715+
runs-on: ubuntu-24.04
716716
needs: determine_changes
717717
if: ${{ github.repository == 'astral-sh/ruff' && !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
718718
timeout-minutes: 20

.github/workflows/publish-playground.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
working-directory: playground
5050
- name: "Deploy to Cloudflare Pages"
5151
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
52-
uses: cloudflare/wrangler-action@v3.13.1
52+
uses: cloudflare/wrangler-action@v3.14.0
5353
with:
5454
apiToken: ${{ secrets.CF_API_TOKEN }}
5555
accountId: ${{ secrets.CF_ACCOUNT_ID }}

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ repos:
6060
- black==25.1.0
6161

6262
- repo: https://github.com/crate-ci/typos
63-
rev: v1.29.5
63+
rev: v1.29.7
6464
hooks:
6565
- id: typos
6666

@@ -74,7 +74,7 @@ repos:
7474
pass_filenames: false # This makes it a lot faster
7575

7676
- repo: https://github.com/astral-sh/ruff-pre-commit
77-
rev: v0.9.5
77+
rev: v0.9.6
7878
hooks:
7979
- id: ruff-format
8080
- id: ruff
@@ -84,7 +84,7 @@ repos:
8484

8585
# Prettier
8686
- repo: https://github.com/rbubley/mirrors-prettier
87-
rev: v3.4.2
87+
rev: v3.5.1
8888
hooks:
8989
- id: prettier
9090
types: [yaml]

BREAKING_CHANGES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ This change only affects those using Ruff under its default rule set. Users that
209209

210210
### Remove support for emoji identifiers ([#7212](https://github.com/astral-sh/ruff/pull/7212))
211211

212-
Previously, Ruff supported the non-standard compliant emoji identifiers e.g. `📦 = 1`.
213-
We decided to remove this non-standard language extension, and Ruff now reports syntax errors for emoji identifiers in your code, the same as CPython.
212+
Previously, Ruff supported non-standards-compliant emoji identifiers such as `📦 = 1`.
213+
We decided to remove this non-standard language extension. Ruff now reports syntax errors for invalid emoji identifiers in your code, the same as CPython.
214214

215215
### Improved GitLab fingerprints ([#7203](https://github.com/astral-sh/ruff/pull/7203))
216216

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ cargo benchmark
526526
#### Benchmark-driven Development
527527
528528
Ruff uses [Criterion.rs](https://bheisler.github.io/criterion.rs/book/) for benchmarks. You can use
529-
`--save-baseline=<name>` to store an initial baseline benchmark (e.g. on `main`) and then use
529+
`--save-baseline=<name>` to store an initial baseline benchmark (e.g., on `main`) and then use
530530
`--benchmark=<name>` to compare against that benchmark. Criterion will print a message telling you
531531
if the benchmark improved/regressed compared to that baseline.
532532
@@ -678,9 +678,9 @@ utils with it:
678678
23 Newline 24
679679
```
680680

681-
- `cargo dev print-cst <file>`: Print the CST of a python file using
681+
- `cargo dev print-cst <file>`: Print the CST of a Python file using
682682
[LibCST](https://github.com/Instagram/LibCST), which is used in addition to the RustPython parser
683-
in Ruff. E.g. for `if True: pass # comment` everything including the whitespace is represented:
683+
in Ruff. For example, for `if True: pass # comment`, everything, including the whitespace, is represented:
684684

685685
```text
686686
Module {

Cargo.lock

Lines changed: 24 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/red_knot/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ red_knot_python_semantic = { workspace = true }
1616
red_knot_project = { workspace = true, features = ["zstd"] }
1717
red_knot_server = { workspace = true }
1818
ruff_db = { workspace = true, features = ["os", "cache"] }
19+
ruff_python_ast = { workspace = true }
1920

2021
anyhow = { workspace = true }
2122
chrono = { workspace = true }

crates/red_knot/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use red_knot_project::watch::ProjectWatcher;
1515
use red_knot_project::{watch, Db};
1616
use red_knot_project::{ProjectDatabase, ProjectMetadata};
1717
use red_knot_server::run_server;
18-
use ruff_db::diagnostic::{Diagnostic, Severity};
18+
use ruff_db::diagnostic::{Diagnostic, DisplayDiagnosticConfig, Severity};
1919
use ruff_db::system::{OsSystem, System, SystemPath, SystemPathBuf};
2020
use salsa::plumbing::ZalsaDatabase;
2121

@@ -231,6 +231,9 @@ impl MainLoop {
231231
result,
232232
revision: check_revision,
233233
} => {
234+
let display_config = DisplayDiagnosticConfig::default()
235+
.color(colored::control::SHOULD_COLORIZE.should_colorize());
236+
234237
let min_error_severity =
235238
if db.project().settings(db).terminal().error_on_warning {
236239
Severity::Warning
@@ -245,7 +248,7 @@ impl MainLoop {
245248
if check_revision == revision {
246249
#[allow(clippy::print_stdout)]
247250
for diagnostic in result {
248-
println!("{}", diagnostic.display(db));
251+
println!("{}", diagnostic.display(db, &display_config));
249252
}
250253
} else {
251254
tracing::debug!(

crates/red_knot/src/python_version.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl std::fmt::Display for PythonVersion {
4040
}
4141
}
4242

43-
impl From<PythonVersion> for red_knot_python_semantic::PythonVersion {
43+
impl From<PythonVersion> for ruff_python_ast::python_version::PythonVersion {
4444
fn from(value: PythonVersion) -> Self {
4545
match value {
4646
PythonVersion::Py37 => Self::PY37,
@@ -61,8 +61,8 @@ mod tests {
6161
#[test]
6262
fn same_default_as_python_version() {
6363
assert_eq!(
64-
red_knot_python_semantic::PythonVersion::from(PythonVersion::default()),
65-
red_knot_python_semantic::PythonVersion::default()
64+
ruff_python_ast::python_version::PythonVersion::from(PythonVersion::default()),
65+
ruff_python_ast::python_version::PythonVersion::default()
6666
);
6767
}
6868
}

crates/red_knot/tests/file_watching.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ use red_knot_project::metadata::pyproject::{PyProject, Tool};
99
use red_knot_project::metadata::value::{RangedValue, RelativePathBuf};
1010
use red_knot_project::watch::{directory_watcher, ChangeEvent, ProjectWatcher};
1111
use red_knot_project::{Db, ProjectDatabase, ProjectMetadata};
12-
use red_knot_python_semantic::{resolve_module, ModuleName, PythonPlatform, PythonVersion};
12+
use red_knot_python_semantic::{resolve_module, ModuleName, PythonPlatform};
1313
use ruff_db::files::{system_path_to_file, File, FileError};
1414
use ruff_db::source::source_text;
1515
use ruff_db::system::{
1616
OsSystem, System, SystemPath, SystemPathBuf, UserConfigDirectoryOverrideGuard,
1717
};
1818
use ruff_db::Upcast;
19+
use ruff_python_ast::python_version::PythonVersion;
1920

2021
struct TestCase {
2122
db: ProjectDatabase,

0 commit comments

Comments
 (0)