Skip to content

Commit 71b79e1

Browse files
committed
Merge branch 'main' into dcreager/function-separation
* main: [ty] support callability of bound/constrained typevars (#18389) [ty] Minor tweaks to "list all members" docs and tests (#18388) [ty] Fix broken property tests for disjointness (#18384) [ty] List available members for a given type (#18251) [`airflow`] Add unsafe fix for module moved cases (`AIR312`) (#18363) Add a `SourceFile` to `OldDiagnostic` (#18356) Update salsa past generational id change (#18362) [`airflow`] Add unsafe fix for module moved cases (`AIR311`) (#18366) [`airflow`] Add unsafe fix for module moved cases (`AIR301`) (#18367) [ty] Improve tests for `site-packages` discovery (#18374) [ty] _typeshed.Self is not a special form (#18377) [ty] Callable types are disjoint from non-callable `@final` nominal instance types (#18368) [ty] Add diagnosis for function with no return statement but with return type annotation (#18359) [`airflow`] Add unsafe fix module moved cases (`AIR302`) (#18093) Rename `ruff_linter::Diagnostic` to `OldDiagnostic` (#18355) [`refurb`] Add coverage of `set` and `frozenset` calls (`FURB171`) (#18035)
2 parents 4606b89 + ad024f9 commit 71b79e1

File tree

145 files changed

+8097
-3876
lines changed

Some content is hidden

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

145 files changed

+8097
-3876
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ regex = { version = "1.10.2" }
129129
rustc-hash = { version = "2.0.0" }
130130
rustc-stable-hash = { version = "0.1.2" }
131131
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
132-
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "4818b15f3b7516555d39f5a41cb75970448bee4c" }
132+
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "40d7844a7a7449a136e0946920a678b55a82f30b" }
133133
schemars = { version = "0.8.16" }
134134
seahash = { version = "4.1.0" }
135135
serde = { version = "1.0.197", features = ["derive"] }

crates/ruff/src/commands/check.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rayon::prelude::*;
1212
use rustc_hash::FxHashMap;
1313

1414
use ruff_db::panic::catch_unwind;
15-
use ruff_linter::Diagnostic;
15+
use ruff_linter::OldDiagnostic;
1616
use ruff_linter::message::Message;
1717
use ruff_linter::package::PackageRoot;
1818
use ruff_linter::registry::Rule;
@@ -131,8 +131,7 @@ pub(crate) fn check(
131131

132132
Diagnostics::new(
133133
vec![Message::from_diagnostic(
134-
Diagnostic::new(IOError { message }, TextRange::default()),
135-
dummy,
134+
OldDiagnostic::new(IOError { message }, TextRange::default(), &dummy),
136135
None,
137136
)],
138137
FxHashMap::default(),

crates/ruff/src/diagnostics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use colored::Colorize;
1212
use log::{debug, warn};
1313
use rustc_hash::FxHashMap;
1414

15-
use ruff_linter::Diagnostic;
15+
use ruff_linter::OldDiagnostic;
1616
use ruff_linter::codes::Rule;
1717
use ruff_linter::linter::{FixTable, FixerResult, LinterResult, ParseSource, lint_fix, lint_only};
1818
use ruff_linter::message::Message;
@@ -64,13 +64,13 @@ impl Diagnostics {
6464
let source_file = SourceFileBuilder::new(name, "").finish();
6565
Self::new(
6666
vec![Message::from_diagnostic(
67-
Diagnostic::new(
67+
OldDiagnostic::new(
6868
IOError {
6969
message: err.to_string(),
7070
},
7171
TextRange::default(),
72+
&source_file,
7273
),
73-
source_file,
7474
None,
7575
)],
7676
FxHashMap::default(),
@@ -235,7 +235,7 @@ pub(crate) fn lint_path(
235235
};
236236
let source_file =
237237
SourceFileBuilder::new(path.to_string_lossy(), contents).finish();
238-
lint_pyproject_toml(source_file, settings)
238+
lint_pyproject_toml(&source_file, settings)
239239
} else {
240240
vec![]
241241
};
@@ -396,7 +396,7 @@ pub(crate) fn lint_stdin(
396396
}
397397

398398
return Ok(Diagnostics {
399-
messages: lint_pyproject_toml(source_file, &settings.linter),
399+
messages: lint_pyproject_toml(&source_file, &settings.linter),
400400
fixed: FixMap::from_iter([(fs::relativize_path(path), FixTable::default())]),
401401
notebook_indexes: FxHashMap::default(),
402402
});

crates/ruff_db/src/testing.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ pub fn assert_function_query_was_not_run<Db, Q, QDb, I, R>(
1313
Q: Fn(QDb, I) -> R,
1414
I: salsa::plumbing::AsId + std::fmt::Debug + Copy,
1515
{
16-
let id = input.as_id().as_u32();
16+
let id = input.as_id();
1717
let (query_name, will_execute_event) = find_will_execute_event(db, query, input, events);
1818

1919
db.attach(|_| {
2020
if let Some(will_execute_event) = will_execute_event {
21-
panic!("Expected query {query_name}({id}) not to have run but it did: {will_execute_event:?}\n\n{events:#?}");
21+
panic!("Expected query {query_name}({id:?}) not to have run but it did: {will_execute_event:?}\n\n{events:#?}");
2222
}
2323
});
2424
}
@@ -65,7 +65,7 @@ pub fn assert_function_query_was_run<Db, Q, QDb, I, R>(
6565
Q: Fn(QDb, I) -> R,
6666
I: salsa::plumbing::AsId + std::fmt::Debug + Copy,
6767
{
68-
let id = input.as_id().as_u32();
68+
let id = input.as_id();
6969
let (query_name, will_execute_event) = find_will_execute_event(db, query, input, events);
7070

7171
db.attach(|_| {
@@ -224,7 +224,7 @@ fn query_was_not_run() {
224224
}
225225

226226
#[test]
227-
#[should_panic(expected = "Expected query len(0) not to have run but it did:")]
227+
#[should_panic(expected = "Expected query len(Id(0)) not to have run but it did:")]
228228
fn query_was_not_run_fails_if_query_was_run() {
229229
use crate::tests::TestDb;
230230
use salsa::prelude::*;
@@ -287,7 +287,7 @@ fn const_query_was_not_run_fails_if_query_was_run() {
287287
}
288288

289289
#[test]
290-
#[should_panic(expected = "Expected query len(0) to have run but it did not:")]
290+
#[should_panic(expected = "Expected query len(Id(0)) to have run but it did not:")]
291291
fn query_was_run_fails_if_query_was_not_run() {
292292
use crate::tests::TestDb;
293293
use salsa::prelude::*;

crates/ruff_linter/resources/test/fixtures/airflow/AIR301_names.py

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,10 @@
1010
PY312,
1111
)
1212
from airflow.api_connexion.security import requires_access
13-
from airflow.configuration import (
14-
as_dict,
15-
get,
16-
getboolean,
17-
getfloat,
18-
getint,
19-
has_option,
20-
remove_option,
21-
set,
22-
)
2313
from airflow.contrib.aws_athena_hook import AWSAthenaHook
2414
from airflow.datasets import DatasetAliasEvent
25-
from airflow.hooks.base_hook import BaseHook
2615
from airflow.operators.subdag import SubDagOperator
2716
from airflow.secrets.local_filesystem import LocalFilesystemBackend
28-
from airflow.sensors.base_sensor_operator import BaseSensorOperator
2917
from airflow.triggers.external_task import TaskStateTrigger
3018
from airflow.utils import dates
3119
from airflow.utils.dag_cycle_tester import test_cycle
@@ -40,13 +28,10 @@
4028
)
4129
from airflow.utils.db import create_session
4230
from airflow.utils.decorators import apply_defaults
43-
from airflow.utils.file import TemporaryDirectory, mkdirs
44-
from airflow.utils.helpers import chain as helper_chain
45-
from airflow.utils.helpers import cross_downstream as helper_cross_downstream
46-
from airflow.utils.log import secrets_masker
31+
from airflow.utils.file import mkdirs
4732
from airflow.utils.state import SHUTDOWN, terminating_states
4833
from airflow.utils.trigger_rule import TriggerRule
49-
from airflow.www.auth import has_access
34+
from airflow.www.auth import has_access, has_access_dataset
5035
from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
5136

5237
# airflow root
@@ -55,11 +40,6 @@
5540
# airflow.api_connexion.security
5641
requires_access
5742

58-
59-
# airflow.configuration
60-
get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
61-
62-
6343
# airflow.contrib.*
6444
AWSAthenaHook()
6545

@@ -68,10 +48,6 @@
6848
DatasetAliasEvent()
6949

7050

71-
# airflow.hooks
72-
BaseHook()
73-
74-
7551
# airflow.operators.subdag.*
7652
SubDagOperator()
7753

@@ -81,10 +57,6 @@
8157
LocalFilesystemBackend()
8258

8359

84-
# airflow.sensors.base_sensor_operator
85-
BaseSensorOperator()
86-
87-
8860
# airflow.triggers.external_task
8961
TaskStateTrigger()
9062

@@ -114,15 +86,8 @@
11486
apply_defaults
11587

11688
# airflow.utils.file
117-
TemporaryDirectory()
11889
mkdirs
11990

120-
# airflow.utils.helpers
121-
helper_chain
122-
helper_cross_downstream
123-
124-
# airflow.utils.log
125-
secrets_masker
12691

12792
# airflow.utils.state
12893
SHUTDOWN
@@ -135,37 +100,8 @@
135100

136101
# airflow.www.auth
137102
has_access
103+
has_access_dataset
138104

139105
# airflow.www.utils
140106
get_sensitive_variables_fields
141107
should_hide_value_for_key
142-
143-
# airflow.operators.python
144-
from airflow.operators.python import get_current_context
145-
146-
get_current_context()
147-
148-
# airflow.providers.mysql
149-
from airflow.providers.mysql.datasets.mysql import sanitize_uri
150-
151-
sanitize_uri
152-
153-
# airflow.providers.postgres
154-
from airflow.providers.postgres.datasets.postgres import sanitize_uri
155-
156-
sanitize_uri
157-
158-
# airflow.providers.trino
159-
from airflow.providers.trino.datasets.trino import sanitize_uri
160-
161-
sanitize_uri
162-
163-
# airflow.notifications.basenotifier
164-
from airflow.notifications.basenotifier import BaseNotifier
165-
166-
BaseNotifier()
167-
168-
# airflow.auth.manager
169-
from airflow.auth.managers.base_auth_manager import BaseAuthManager
170-
171-
BaseAuthManager()

0 commit comments

Comments
 (0)