Skip to content

Commit 94c9bfe

Browse files
author
UnboundVariable
committed
Merge branch 'main' of https://github.com/astral-sh/ruff into signature_help
* 'main' of https://github.com/astral-sh/ruff: Add simple integration tests for all output formats (astral-sh#19265) [`flake8-return`] Fix false-positive for variables used inside nested functions in `RET504` (astral-sh#18433) [ty] Add a `--quiet` mode (astral-sh#19233) Treat form feed as valid whitespace before a line continuation (astral-sh#19220) [ty] Make `check_file` a salsa query (astral-sh#19255) [ty] Consolidate submodule resolving code between `types.rs` and `ide_support.rs` (astral-sh#19256) [ty] Remove countme from salsa-structs (astral-sh#19257) [ty] Improve and document equivalence for module-literal types (astral-sh#19243) [ty] Optimize protocol subtyping by removing expensive and unnecessary equivalence check from the top of `Type::has_relation_to()` (astral-sh#19230) [ty] Ecosystem analyzer: parallelize, fix race condition (astral-sh#19252) [ty] Add completion kind to playground (astral-sh#19251) [ty] Deploy ecosystem diff to Cloudflare pages (astral-sh#19234) [ty] Add semantic token provider to playground (astral-sh#19232)
2 parents c2780c8 + 08bc6d2 commit 94c9bfe

Some content is hidden

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

51 files changed

+1850
-311
lines changed

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

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ env:
1717
RUSTUP_MAX_RETRIES: 10
1818
RUST_BACKTRACE: 1
1919
REF_NAME: ${{ github.ref_name }}
20+
CF_API_TOKEN_EXISTS: ${{ secrets.CF_API_TOKEN != '' }}
2021

2122
jobs:
2223
ty-ecosystem-analyzer:
@@ -63,32 +64,75 @@ jobs:
6364
6465
cd ..
6566
66-
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@9c34dc514ee9aef6735db1dfebb80f63acbc3440"
67+
uv tool install "git+https://github.com/astral-sh/ecosystem-analyzer@f0eec0e549684d8e1d7b8bc3e351202124b63bda"
6768
6869
ecosystem-analyzer \
6970
--repository ruff \
70-
analyze \
71-
--projects ruff/projects_old.txt \
72-
--commit old_commit \
73-
--output diagnostics_old.json
71+
diff \
72+
--projects-old ruff/projects_old.txt \
73+
--projects-new ruff/projects_new.txt \
74+
--old old_commit \
75+
--new new_commit \
76+
--output-old diagnostics-old.json \
77+
--output-new diagnostics-new.json
7478
75-
ecosystem-analyzer \
76-
--repository ruff \
77-
analyze \
78-
--projects ruff/projects_new.txt \
79-
--commit new_commit \
80-
--output diagnostics_new.json
79+
mkdir dist
8180
8281
ecosystem-analyzer \
8382
generate-diff \
84-
diagnostics_old.json \
85-
diagnostics_new.json \
83+
diagnostics-old.json \
84+
diagnostics-new.json \
8685
--old-name "main (merge base)" \
8786
--new-name "$REF_NAME" \
88-
--output-html diff.html
87+
--output-html dist/diff.html
88+
89+
ecosystem-analyzer \
90+
generate-diff-statistics \
91+
diagnostics-old.json \
92+
diagnostics-new.json \
93+
--old-name "main (merge base)" \
94+
--new-name "$REF_NAME" \
95+
--output diff-statistics.md
96+
97+
echo '## `ecosystem-analyzer` results' > comment.md
98+
echo >> comment.md
99+
cat diff-statistics.md >> comment.md
100+
101+
cat diff-statistics.md >> "$GITHUB_STEP_SUMMARY"
102+
103+
echo ${{ github.event.number }} > pr-number
104+
105+
- name: "Deploy to Cloudflare Pages"
106+
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
107+
id: deploy
108+
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
109+
with:
110+
apiToken: ${{ secrets.CF_API_TOKEN }}
111+
accountId: ${{ secrets.CF_ACCOUNT_ID }}
112+
command: pages deploy dist --project-name=ty-ecosystem --branch ${{ github.head_ref }} --commit-hash ${GITHUB_SHA}
113+
114+
- name: "Append deployment URL"
115+
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
116+
env:
117+
DEPLOYMENT_URL: ${{ steps.deploy.outputs.pages-deployment-alias-url }}
118+
run: |
119+
echo >> comment.md
120+
echo "**[Full report with detailed diff]($DEPLOYMENT_URL/diff)**" >> comment.md
121+
122+
- name: Upload comment
123+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
124+
with:
125+
name: comment.md
126+
path: comment.md
127+
128+
- name: Upload pr-number
129+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
130+
with:
131+
name: pr-number
132+
path: pr-number
89133

90-
- name: Upload HTML diff report
134+
- name: Upload diagnostics diff
91135
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
92136
with:
93137
name: diff.html
94-
path: diff.html
138+
path: dist/diff.html

.github/zizmor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ rules:
1010
ignore:
1111
- build-docker.yml
1212
- publish-playground.yml
13+
- ty-ecosystem-analyzer.yaml
1314
excessive-permissions:
1415
# it's hard to test what the impact of removing these ignores would be
1516
# without actually running the release workflow...

Cargo.lock

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

crates/ruff/tests/lint.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5692,3 +5692,56 @@ class Foo:
56925692
"
56935693
);
56945694
}
5695+
5696+
#[test_case::test_case("concise")]
5697+
#[test_case::test_case("full")]
5698+
#[test_case::test_case("json")]
5699+
#[test_case::test_case("json-lines")]
5700+
#[test_case::test_case("junit")]
5701+
#[test_case::test_case("grouped")]
5702+
#[test_case::test_case("github")]
5703+
#[test_case::test_case("gitlab")]
5704+
#[test_case::test_case("pylint")]
5705+
#[test_case::test_case("rdjson")]
5706+
#[test_case::test_case("azure")]
5707+
#[test_case::test_case("sarif")]
5708+
fn output_format(output_format: &str) -> Result<()> {
5709+
const CONTENT: &str = "\
5710+
import os # F401
5711+
x = y # F821
5712+
match 42: # invalid-syntax
5713+
case _: ...
5714+
";
5715+
5716+
let tempdir = TempDir::new()?;
5717+
let input = tempdir.path().join("input.py");
5718+
fs::write(&input, CONTENT)?;
5719+
5720+
let snapshot = format!("output_format_{output_format}");
5721+
5722+
insta::with_settings!({
5723+
filters => vec![
5724+
(tempdir_filter(&tempdir).as_str(), "[TMP]/"),
5725+
(r#""[^"]+\\?/?input.py"#, r#""[TMP]/input.py"#),
5726+
]
5727+
}, {
5728+
assert_cmd_snapshot!(
5729+
snapshot,
5730+
Command::new(get_cargo_bin(BIN_NAME))
5731+
.args([
5732+
"check",
5733+
"--no-cache",
5734+
"--output-format",
5735+
output_format,
5736+
"--select",
5737+
"F401,F821",
5738+
"--target-version",
5739+
"py39",
5740+
"input.py",
5741+
])
5742+
.current_dir(&tempdir),
5743+
);
5744+
});
5745+
5746+
Ok(())
5747+
}

0 commit comments

Comments
 (0)