Skip to content

Commit bb6cf4d

Browse files
committed
Merge branch 'dcreager/non-non-inferable' into dcreager/real-constraint-sets
* dcreager/non-non-inferable: Don't use codspeed or depot runners in CI jobs on forks (#20894) [ty] cache Type::is_redundant_with (#20477) Fix run-away for mutually referential instance attributes (#20645) [ty] Limit shown import paths to at most 5 unless ty runs with `-v` (#20912) [ty] Use field-specifier return type as the default type for the field (#20915) [ty] Do not assume that `field`s have a default value (#20914) [ty] Fix match pattern value narrowing to use equality semantics (#20882) Update setup instructions for Zed 0.208.0+ (#20902) Move TOML indent size config (#20905) [syntax-errors]: implement F702 as semantic syntax error (#20869) [ty] Heterogeneous unpacking support for unions (#20377) [ty] refactor `Place` (#20871) Auto-accept snapshot changes as part of typeshed-sync PRs (#20892) [`airflow`] Add warning to `airflow.datasets.DatasetEvent` usage (`AIR301`) (#20551) [`flake8-pyi`] Fix operator precedence by adding parentheses when needed (`PYI061`) (#20508) [`pyupgrade`] Fix false negative for `TypeVar` with default argument in `non-pep695-generic-class` (`UP046`) (#20660) Update parser snapshots (#20893) Fix syntax error false positives for escapes and quotes in f-strings (#20867)
2 parents 1137b85 + 642ed43 commit bb6cf4d

File tree

84 files changed

+2564
-1179
lines changed

Some content is hidden

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

84 files changed

+2564
-1179
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ indent_style = space
1010
insert_final_newline = true
1111
indent_size = 2
1212

13-
[*.{rs,py,pyi}]
13+
[*.{rs,py,pyi,toml}]
1414
indent_size = 4
1515

1616
[*.snap]
1717
trim_trailing_whitespace = false
1818

1919
[*.md]
2020
max_line_length = 100
21-
22-
[*.toml]
23-
indent_size = 4

.github/workflows/ci.yaml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ jobs:
237237

238238
cargo-test-linux:
239239
name: "cargo test (linux)"
240-
runs-on: depot-ubuntu-22.04-16
240+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
241241
needs: determine_changes
242242
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
243243
timeout-minutes: 20
@@ -299,7 +299,7 @@ jobs:
299299

300300
cargo-test-linux-release:
301301
name: "cargo test (linux, release)"
302-
runs-on: depot-ubuntu-22.04-16
302+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
303303
needs: determine_changes
304304
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
305305
timeout-minutes: 20
@@ -332,7 +332,7 @@ jobs:
332332

333333
cargo-test-windows:
334334
name: "cargo test (windows)"
335-
runs-on: depot-windows-2022-16
335+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-windows-2022-16' || 'windows-latest' }}
336336
needs: determine_changes
337337
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
338338
timeout-minutes: 20
@@ -424,7 +424,7 @@ jobs:
424424
425425
cargo-build-msrv:
426426
name: "cargo build (msrv)"
427-
runs-on: depot-ubuntu-latest-8
427+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-latest-8' || 'ubuntu-latest' }}
428428
needs: determine_changes
429429
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
430430
timeout-minutes: 20
@@ -538,7 +538,7 @@ jobs:
538538

539539
ecosystem:
540540
name: "ecosystem"
541-
runs-on: depot-ubuntu-latest-8
541+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-latest-8' || 'ubuntu-latest' }}
542542
needs:
543543
- cargo-test-linux
544544
- determine_changes
@@ -663,7 +663,7 @@ jobs:
663663

664664
fuzz-ty:
665665
name: "Fuzz for new ty panics"
666-
runs-on: depot-ubuntu-22.04-16
666+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
667667
needs:
668668
- cargo-test-linux
669669
- determine_changes
@@ -723,7 +723,7 @@ jobs:
723723

724724
ty-completion-evaluation:
725725
name: "ty completion evaluation"
726-
runs-on: depot-ubuntu-22.04-16
726+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
727727
needs: determine_changes
728728
if: ${{ needs.determine_changes.outputs.ty == 'true' || github.ref == 'refs/heads/main' }}
729729
steps:
@@ -769,7 +769,7 @@ jobs:
769769

770770
pre-commit:
771771
name: "pre-commit"
772-
runs-on: depot-ubuntu-22.04-16
772+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
773773
timeout-minutes: 10
774774
steps:
775775
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -943,8 +943,12 @@ jobs:
943943
runs-on: ubuntu-24.04
944944
needs: determine_changes
945945
if: |
946-
github.ref == 'refs/heads/main' ||
947-
(needs.determine_changes.outputs.formatter == 'true' || needs.determine_changes.outputs.linter == 'true')
946+
github.repository == 'astral-sh/ruff' &&
947+
(
948+
github.ref == 'refs/heads/main' ||
949+
needs.determine_changes.outputs.formatter == 'true' ||
950+
needs.determine_changes.outputs.linter == 'true'
951+
)
948952
timeout-minutes: 20
949953
steps:
950954
- name: "Checkout Branch"
@@ -978,8 +982,11 @@ jobs:
978982
runs-on: ubuntu-24.04
979983
needs: determine_changes
980984
if: |
981-
github.ref == 'refs/heads/main' ||
982-
needs.determine_changes.outputs.ty == 'true'
985+
github.repository == 'astral-sh/ruff' &&
986+
(
987+
github.ref == 'refs/heads/main' ||
988+
needs.determine_changes.outputs.ty == 'true'
989+
)
983990
timeout-minutes: 20
984991
steps:
985992
- name: "Checkout Branch"

.github/workflows/mypy_primer.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929
jobs:
3030
mypy_primer:
3131
name: Run mypy_primer
32-
runs-on: depot-ubuntu-22.04-32
32+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
3333
timeout-minutes: 20
3434
steps:
3535
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -72,7 +72,7 @@ jobs:
7272

7373
memory_usage:
7474
name: Run memory statistics
75-
runs-on: depot-ubuntu-22.04-32
75+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
7676
timeout-minutes: 20
7777
steps:
7878
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/sync_typeshed.yaml

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ name: Sync typeshed
1616
# 3. Once the Windows worker is done, a MacOS worker:
1717
# a. Checks out the branch created by the Linux worker
1818
# b. Syncs all docstrings available on MacOS that are not available on Linux or Windows
19-
# c. Commits the changes and pushes them to the same upstream branch
20-
# d. Creates a PR against the `main` branch using the branch all three workers have pushed to
19+
# c. Attempts to update any snapshots that might have changed
20+
# (this sub-step is allowed to fail)
21+
# d. Commits the changes and pushes them to the same upstream branch
22+
# e. Creates a PR against the `main` branch using the branch all three workers have pushed to
2123
# 4. If any of steps 1-3 failed, an issue is created in the `astral-sh/ruff` repository
2224

2325
on:
@@ -27,7 +29,12 @@ on:
2729
- cron: "0 0 1,15 * *"
2830

2931
env:
30-
FORCE_COLOR: 1
32+
# Don't set this flag globally for the workflow: it does strange things
33+
# to the snapshots in the `cargo insta test --accept` step in the MacOS job.
34+
#
35+
# FORCE_COLOR: 1
36+
37+
CARGO_TERM_COLOR: always
3138
GH_TOKEN: ${{ github.token }}
3239

3340
# The name of the upstream branch that the first worker creates,
@@ -86,6 +93,8 @@ jobs:
8693
git commit -m "Sync typeshed. Source commit: https://github.com/python/typeshed/commit/$(git -C ../typeshed rev-parse HEAD)" --allow-empty
8794
- name: Sync Linux docstrings
8895
if: ${{ success() }}
96+
env:
97+
FORCE_COLOR: 1
8998
run: |
9099
cd ruff
91100
./scripts/codemod_docstrings.sh
@@ -125,6 +134,8 @@ jobs:
125134
- name: Sync Windows docstrings
126135
id: docstrings
127136
shell: bash
137+
env:
138+
FORCE_COLOR: 1
128139
run: ./scripts/codemod_docstrings.sh
129140
- name: Commit the changes
130141
if: ${{ steps.docstrings.outcome == 'success' }}
@@ -161,26 +172,63 @@ jobs:
161172
git config --global user.name typeshedbot
162173
git config --global user.email '<>'
163174
- name: Sync macOS docstrings
164-
run: ./scripts/codemod_docstrings.sh
165-
- name: Commit and push the changes
166175
if: ${{ success() }}
176+
env:
177+
FORCE_COLOR: 1
167178
run: |
179+
./scripts/codemod_docstrings.sh
168180
git commit -am "Sync macOS docstrings" --allow-empty
169-
181+
- name: Format the changes
182+
if: ${{ success() }}
183+
env:
184+
FORCE_COLOR: 1
185+
run: |
170186
# Here we just reformat the codemodded stubs so that they are
171187
# consistent with the other typeshed stubs around them.
172188
# Typeshed formats code using black in their CI, so we just invoke
173189
# black on the stubs the same way that typeshed does.
174190
uvx black "${VENDORED_TYPESHED}/stdlib" --config "${VENDORED_TYPESHED}/pyproject.toml" || true
175191
git commit -am "Format codemodded docstrings" --allow-empty
176-
192+
- name: Remove typeshed pyproject.toml file
193+
if: ${{ success() }}
194+
run: |
177195
rm "${VENDORED_TYPESHED}/pyproject.toml"
178196
git commit -am "Remove pyproject.toml file"
179-
180-
git push
181-
- name: Create a PR
197+
- uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
198+
- name: "Install Rust toolchain"
199+
if: ${{ success() }}
200+
run: rustup show
201+
- name: "Install mold"
202+
if: ${{ success() }}
203+
uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
204+
- name: "Install cargo nextest"
205+
if: ${{ success() }}
206+
uses: taiki-e/install-action@522492a8c115f1b6d4d318581f09638e9442547b # v2.62.21
207+
with:
208+
tool: cargo-nextest
209+
- name: "Install cargo insta"
210+
if: ${{ success() }}
211+
uses: taiki-e/install-action@522492a8c115f1b6d4d318581f09638e9442547b # v2.62.21
212+
with:
213+
tool: cargo-insta
214+
- name: Update snapshots
182215
if: ${{ success() }}
183216
run: |
217+
# The `cargo insta` docs indicate that `--unreferenced=delete` might be a good option,
218+
# but from local testing it appears to just revert all changes made by `cargo insta test --accept`.
219+
#
220+
# If there were only snapshot-related failures, `cargo insta test --accept` will have exit code 0,
221+
# but if there were also other mdtest failures (for example), it will return a nonzero exit code.
222+
# We don't care about other tests failing here, we just want snapshots updated where possible,
223+
# so we use `|| true` here to ignore the exit code.
224+
cargo insta test --accept --color=always --all-features --test-runner=nextest || true
225+
- name: Commit snapshot changes
226+
if: ${{ success() }}
227+
run: git commit -am "Update snapshots" || echo "No snapshot changes to commit"
228+
- name: Push changes upstream and create a PR
229+
if: ${{ success() }}
230+
run: |
231+
git push
184232
gh pr list --repo "${GITHUB_REPOSITORY}" --head "${UPSTREAM_BRANCH}" --json id --jq length | grep 1 && exit 0 # exit if there is existing pr
185233
gh pr create --title "[ty] Sync vendored typeshed stubs" --body "Close and reopen this PR to trigger CI" --label "ty"
186234

.github/workflows/ty-ecosystem-analyzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
jobs:
2323
ty-ecosystem-analyzer:
2424
name: Compute diagnostic diff
25-
runs-on: depot-ubuntu-22.04-32
25+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
2626
timeout-minutes: 20
2727
if: contains(github.event.label.name, 'ecosystem-analyzer')
2828
steps:

.github/workflows/ty-ecosystem-report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
ty-ecosystem-report:
2121
name: Create ecosystem report
22-
runs-on: depot-ubuntu-22.04-32
22+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
2323
timeout-minutes: 20
2424
steps:
2525
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/typing_conformance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ env:
2929
jobs:
3030
typing_conformance:
3131
name: Compute diagnostic diff
32-
runs-on: depot-ubuntu-22.04-32
32+
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
3333
timeout-minutes: 10
3434
steps:
3535
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

Cargo.lock

Lines changed: 6 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
@@ -146,7 +146,7 @@ regex-automata = { version = "0.4.9" }
146146
rustc-hash = { version = "2.0.0" }
147147
rustc-stable-hash = { version = "0.1.2" }
148148
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
149-
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "29ab321b45d00daa4315fa2a06f7207759a8c87e", default-features = false, features = [
149+
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "ef9f9329be6923acd050c8dddd172e3bc93e8051", default-features = false, features = [
150150
"compact_str",
151151
"macros",
152152
"salsa_unstable",

crates/ruff_graph/src/db.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ impl Db for ModuleDb {
9898
fn lint_registry(&self) -> &LintRegistry {
9999
default_lint_registry()
100100
}
101+
102+
fn verbose(&self) -> bool {
103+
false
104+
}
101105
}
102106

103107
#[salsa::db]

0 commit comments

Comments
 (0)