Skip to content

Commit 8e895bc

Browse files
authored
Merge pull request #23053 from github/rust/lint
Expand Rust workspace and add shared Clippy configuration
2 parents b37f9db + ec6d6e7 commit 8e895bc

720 files changed

Lines changed: 7030 additions & 26353 deletions

File tree

Some content is hidden

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

‎.github/skills/bazel/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ In order of preference:
145145
keep its checksum field populated.
146146

147147
Vendored Rust crates under [`misc/bazel/3rdparty`](../../../misc/bazel/3rdparty) are generated. Regenerate with
148-
[`update_cargo_deps.sh`](../../../misc/bazel/3rdparty/update_cargo_deps.sh) rather than editing, and keep the
148+
[`update_all_rust_deps.sh`](../../../misc/bazel/3rdparty/update_all_rust_deps.sh) rather than editing, and keep the
149149
`use_repo` lists in sync, which `bazel mod tidy` does for module extensions.
150150

151151
## Building standalone

‎.github/workflows/cpp-bmn.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ on:
44
pull_request:
55
paths: &bmn_paths
66
- "cpp/extractor/bmn/**"
7-
- "misc/bazel/3rdparty/cpp_bmn_deps/**"
8-
- "misc/bazel/3rdparty/cpp_bmn_deps_extension.bzl"
9-
- "misc/bazel/3rdparty/update_cpp_bmn_deps.sh"
7+
- "Cargo.toml"
8+
- "Cargo.lock"
9+
- "rust-toolchain.toml"
10+
- "misc/bazel/3rdparty/rust_workspace_deps/**"
11+
- "misc/bazel/3rdparty/rust_workspace_deps_extension.bzl"
12+
- "misc/bazel/3rdparty/update_rust_workspace_deps.sh"
1013
- "misc/bazel/3rdparty/BUILD.bazel"
1114
- "misc/bazel/rust.bzl"
1215
- "MODULE.bazel"
@@ -33,7 +36,7 @@ jobs:
3336
- name: Check
3437
run: cargo check
3538
- name: Clippy
36-
run: cargo clippy -- -D warnings
39+
run: cargo clippy --all-targets --no-deps -- -D warnings
3740
- name: Test
3841
run: cargo test
3942

‎.github/workflows/ql-for-ql-build.yml‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ jobs:
3636
with:
3737
path: |
3838
ql/extractor-pack/
39-
ql/target/release/buramu
40-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('shared/tree-sitter-extractor') }}-${{ hashFiles('ql/**/*.rs') }}
39+
target/release/buramu
40+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('Cargo.toml', 'Cargo.lock') }}-${{ hashFiles('shared/tree-sitter-extractor') }}-${{ hashFiles('ql/**/*.rs') }}
4141
- name: Cache cargo
4242
if: steps.cache-extractor.outputs.cache-hit != 'true'
4343
uses: actions/cache@v3
4444
with:
4545
path: |
4646
~/.cargo/registry
4747
~/.cargo/git
48-
ql/target
49-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
48+
target
49+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('Cargo.lock') }}
5050
- name: Release build
5151
if: steps.cache-extractor.outputs.cache-hit != 'true'
5252
run: cd ql; ./scripts/create-extractor-pack.sh
@@ -59,7 +59,7 @@ jobs:
5959
key: run-ql-for-ql
6060
- name: Make database and analyze
6161
run: |
62-
./ql/target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse.
62+
./target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse.
6363
${CODEQL} database create --threads=0 -l=ql ${DB} --search-path "${{ github.workspace }}"
6464
${CODEQL} database analyze -j0 --format=sarif-latest --output=ql-for-ql.sarif ${DB} ql/ql/src/codeql-suites/ql-code-scanning.qls --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
6565
env:

‎.github/workflows/ql-for-ql-dataset_measure.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
path: |
3636
~/.cargo/registry
3737
~/.cargo/git
38-
ql/target
39-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
38+
target
39+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('Cargo.lock') }}
4040
- name: Build Extractor
4141
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
4242
env:

‎.github/workflows/ql-for-ql-tests.yml‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ name: Run QL for QL Tests
33
on:
44
push:
55
branches: [main]
6-
paths:
6+
paths: &ql_paths
77
- "ql/**"
8+
- "Cargo.toml"
9+
- "Cargo.lock"
10+
- "rust-toolchain.toml"
811
- codeql-workspace.yml
912
- .github/workflows/ql-for-ql-tests.yml
1013
pull_request:
1114
branches: [main]
12-
paths:
13-
- "ql/**"
14-
- codeql-workspace.yml
15-
- .github/workflows/ql-for-ql-tests.yml
15+
paths: *ql_paths
1616

1717
env:
1818
CARGO_TERM_COLOR: always
@@ -37,10 +37,10 @@ jobs:
3737
path: |
3838
~/.cargo/registry
3939
~/.cargo/git
40-
ql/target
41-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
40+
target
41+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
4242
- name: Check formatting
43-
run: cd ql; cargo fmt -- --check
43+
run: cd ql; cargo fmt -p codeql-extractor-ql -p buramu -p tree-sitter-blame -- --check
4444
- name: Build extractor
4545
run: |
4646
cd ql;
@@ -82,8 +82,8 @@ jobs:
8282
path: |
8383
~/.cargo/registry
8484
~/.cargo/git
85-
ql/target
86-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
85+
target
86+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
8787
- name: Build extractor
8888
if: runner.os != 'Windows'
8989
run: |

‎.github/workflows/rust.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- "!shared/yeast-macros/**"
1212
- "!shared/yeast-schema/**"
1313
- "MODULE.bazel"
14+
- Cargo.toml
15+
- Cargo.lock
16+
- rust-toolchain.toml
1417
- .github/workflows/rust.yml
1518
- .github/actions/**
1619
- codeql-workspace.yml

‎.github/workflows/tree-sitter-extractor-test.yml‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ name: Test tree-sitter-extractor
22

33
on:
44
push:
5-
paths:
5+
paths: &tree_sitter_paths
66
- "shared/tree-sitter-extractor/**"
7+
- Cargo.toml
8+
- Cargo.lock
9+
- rust-toolchain.toml
710
- .github/workflows/tree-sitter-extractor-test.yml
811
branches:
912
- main
1013
- "rc/*"
1114
pull_request:
12-
paths:
13-
- "shared/tree-sitter-extractor/**"
14-
- .github/workflows/tree-sitter-extractor-test.yml
15+
paths: *tree_sitter_paths
1516
branches:
1617
- main
1718
- "rc/*"
@@ -46,4 +47,4 @@ jobs:
4647
steps:
4748
- uses: actions/checkout@v5
4849
- name: Run clippy
49-
run: cargo clippy -- --no-deps -D warnings -A clippy::new_without_default -A clippy::too_many_arguments
50+
run: cargo clippy -- --no-deps -D warnings

‎.github/workflows/update-rust-analyzer.lock.yml‎

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

0 commit comments

Comments
 (0)