Skip to content

Commit 93b149c

Browse files
committed
Merge branch 'main' into dcreager/terminal-visibility
* main: [red-knot] MDTests: Do not depend on precise public-symbol type inference (#15691) [red-knot] Make `infer.rs` unit tests independent of public symbol inference (#15690) Tidy knot CLI tests (#15685) [red-knot] Port comprehension tests to Markdown (#15688) Create Unknown rule diagnostics with a source range (#15648) [red-knot] Port 'deferred annotations' unit tests to Markdown (#15686) [red-knot] Support custom typeshed Markdown tests (#15683) Don't run the linter ecosystem check on PRs that only touch red-knot crates (#15687) Add `rules` table to configuration (#15645) [red-knot] Make `Diagnostic::file` optional (#15640) [red-knot] Add test for nested attribute access (#15684) [red-knot] Anchor relative paths in configurations (#15634) [`pyupgrade`] Handle multiple base classes for PEP 695 generics (`UP046`) (#15659) [`pyflakes`] Treat arguments passed to the `default=` parameter of `TypeVar` as type expressions (`F821`) (#15679) Upgrade zizmor to the latest version in CI (#15649) [`pyupgrade`] Add rules to use PEP 695 generics in classes and functions (`UP046`, `UP047`) (#15565) [red-knot] Ensure a gradual type can always be assigned to itself (#15675)
2 parents 81a3164 + 15394a8 commit 93b149c

File tree

80 files changed

+3311
-1361
lines changed

Some content is hidden

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

80 files changed

+3311
-1361
lines changed

.github/workflows/build-binaries.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ concurrency:
2323
group: ${{ github.workflow }}-${{ github.ref }}
2424
cancel-in-progress: true
2525

26+
permissions: {}
27+
2628
env:
2729
PACKAGE_NAME: ruff
2830
MODULE_NAME: ruff

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: CI
22

3+
permissions: {}
4+
35
on:
46
push:
57
branches: [main]
@@ -59,6 +61,7 @@ jobs:
5961
- Cargo.toml
6062
- Cargo.lock
6163
- crates/**
64+
- "!crates/red_knot*/**"
6265
- "!crates/ruff_python_formatter/**"
6366
- "!crates/ruff_formatter/**"
6467
- "!crates/ruff_dev/**"

.github/zizmor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ rules:
1010
ignore:
1111
- build-docker.yml
1212
- publish-playground.yml
13+
excessive-permissions:
14+
# it's hard to test what the impact of removing these ignores would be
15+
# without actually running the release workflow...
16+
ignore:
17+
- build-docker.yml
18+
- publish-playground.yml
19+
- publish-docs.yml

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ tracing.folded
2929
tracing-flamechart.svg
3030
tracing-flamegraph.svg
3131

32+
# insta
33+
.rs.pending-snap
34+
35+
3236
###
3337
# Rust.gitignore
3438
###

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ repos:
9191
# zizmor detects security vulnerabilities in GitHub Actions workflows.
9292
# Additional configuration for the tool is found in `.github/zizmor.yml`
9393
- repo: https://github.com/woodruffw/zizmor-pre-commit
94-
rev: v1.1.1
94+
rev: v1.2.2
9595
hooks:
9696
- id: zizmor
9797

Cargo.lock

Lines changed: 1 addition & 0 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
@@ -33,6 +33,7 @@ tracing-tree = { workspace = true }
3333

3434
[dev-dependencies]
3535
ruff_db = { workspace = true, features = ["testing"] }
36+
ruff_python_trivia = { workspace = true }
3637

3738
insta = { workspace = true, features = ["filters"] }
3839
insta-cmd = { workspace = true }

crates/red_knot/src/main.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use colored::Colorize;
77
use crossbeam::channel as crossbeam_channel;
88
use python_version::PythonVersion;
99
use red_knot_project::metadata::options::{EnvironmentOptions, Options};
10+
use red_knot_project::metadata::value::{RangedValue, RelativePathBuf};
1011
use red_knot_project::watch;
1112
use red_knot_project::watch::ProjectWatcher;
1213
use red_knot_project::{ProjectDatabase, ProjectMetadata};
@@ -69,22 +70,18 @@ struct Args {
6970
}
7071

7172
impl Args {
72-
fn to_options(&self, cli_cwd: &SystemPath) -> Options {
73+
fn to_options(&self) -> Options {
7374
Options {
7475
environment: Some(EnvironmentOptions {
75-
python_version: self.python_version.map(Into::into),
76-
venv_path: self
77-
.venv_path
78-
.as_ref()
79-
.map(|venv_path| SystemPath::absolute(venv_path, cli_cwd)),
80-
typeshed: self
81-
.typeshed
82-
.as_ref()
83-
.map(|typeshed| SystemPath::absolute(typeshed, cli_cwd)),
76+
python_version: self
77+
.python_version
78+
.map(|version| RangedValue::cli(version.into())),
79+
venv_path: self.venv_path.as_ref().map(RelativePathBuf::cli),
80+
typeshed: self.typeshed.as_ref().map(RelativePathBuf::cli),
8481
extra_paths: self.extra_search_path.as_ref().map(|extra_search_paths| {
8582
extra_search_paths
8683
.iter()
87-
.map(|path| SystemPath::absolute(path, cli_cwd))
84+
.map(RelativePathBuf::cli)
8885
.collect()
8986
}),
9087
..EnvironmentOptions::default()
@@ -158,8 +155,8 @@ fn run() -> anyhow::Result<ExitStatus> {
158155
.transpose()?
159156
.unwrap_or_else(|| cli_base_path.clone());
160157

161-
let system = OsSystem::new(cwd.clone());
162-
let cli_options = args.to_options(&cwd);
158+
let system = OsSystem::new(cwd);
159+
let cli_options = args.to_options();
163160
let mut workspace_metadata = ProjectMetadata::discover(system.current_directory(), &system)?;
164161
workspace_metadata.apply_cli_options(cli_options.clone());
165162

0 commit comments

Comments
 (0)