Enforce no dbg! and todo! in Rust code via clippy lints in the CI job (#4005)
Release Notes: - N/A
This commit is contained in:
@@ -1,15 +0,0 @@
|
|||||||
name: 'Check formatting'
|
|
||||||
description: 'Checks code formatting use cargo fmt'
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- name: Install Rust
|
|
||||||
shell: bash -euxo pipefail {0}
|
|
||||||
run: |
|
|
||||||
rustup set profile minimal
|
|
||||||
rustup update stable
|
|
||||||
|
|
||||||
- name: cargo fmt
|
|
||||||
shell: bash -euxo pipefail {0}
|
|
||||||
run: cargo fmt --all -- --check
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
name: "Check formatting"
|
||||||
|
description: "Checks code formatting use cargo fmt"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: cargo fmt
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
- name: cargo clippy
|
||||||
|
shell: bash -euxo pipefail {0}
|
||||||
|
# clippy.toml is not currently supporting specifying allowed lints
|
||||||
|
# so specify those here, and disable the rest until Zed's workspace
|
||||||
|
# will have more fixes & suppression for the standard lint set
|
||||||
|
run: |
|
||||||
|
cargo clippy --workspace --all-features --all-targets -- -A clippy::all -D clippy::dbg_macro -D clippy::todo
|
||||||
@@ -2,29 +2,26 @@ name: "Run tests"
|
|||||||
description: "Runs the tests"
|
description: "Runs the tests"
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
run: |
|
run: |
|
||||||
rustup set profile minimal
|
cargo install cargo-nextest
|
||||||
rustup update stable
|
|
||||||
rustup target add wasm32-wasi
|
|
||||||
cargo install cargo-nextest
|
|
||||||
|
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "18"
|
node-version: "18"
|
||||||
|
|
||||||
- name: Limit target directory size
|
- name: Limit target directory size
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
run: script/clear-target-dir-if-larger-than 100
|
run: script/clear-target-dir-if-larger-than 100
|
||||||
|
|
||||||
- name: Run check
|
- name: Run check
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
run: cargo check --tests --workspace
|
run: cargo check --tests --workspace
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
shell: bash -euxo pipefail {0}
|
shell: bash -euxo pipefail {0}
|
||||||
run: cargo nextest run --workspace --no-fail-fast
|
run: cargo nextest run --workspace --no-fail-fast
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ env:
|
|||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rustfmt:
|
style:
|
||||||
name: Check formatting
|
name: Check formatting and Clippy lints
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
@@ -33,19 +33,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up default .cargo/config.toml
|
- name: Set up default .cargo/config.toml
|
||||||
run: cp ./.cargo/ci-config.toml ~/.cargo/config.toml
|
run: cp ./.cargo/ci-config.toml ~/.cargo/config.toml
|
||||||
|
|
||||||
- name: Run rustfmt
|
- name: Run style checks
|
||||||
uses: ./.github/actions/check_formatting
|
uses: ./.github/actions/check_style
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
needs: rustfmt
|
needs: style
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -75,14 +76,6 @@ jobs:
|
|||||||
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
|
APPLE_NOTARIZATION_USERNAME: ${{ secrets.APPLE_NOTARIZATION_USERNAME }}
|
||||||
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
|
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
|
||||||
run: |
|
|
||||||
rustup set profile minimal
|
|
||||||
rustup update stable
|
|
||||||
rustup target add aarch64-apple-darwin
|
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
rustup target add wasm32-wasi
|
|
||||||
|
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -3,41 +3,36 @@ name: Randomized Tests
|
|||||||
concurrency: randomized-tests
|
concurrency: randomized-tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- randomized-tests-runner
|
- randomized-tests-runner
|
||||||
# schedule:
|
# schedule:
|
||||||
# - cron: '0 * * * *'
|
# - cron: '0 * * * *'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
CARGO_INCREMENTAL: 0
|
CARGO_INCREMENTAL: 0
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
ZED_SERVER_URL: https://zed.dev
|
ZED_SERVER_URL: https://zed.dev
|
||||||
ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
|
ZED_CLIENT_SECRET_TOKEN: ${{ secrets.ZED_CLIENT_SECRET_TOKEN }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
name: Run randomized tests
|
name: Run randomized tests
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- randomized-tests
|
- randomized-tests
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
- name: Install Node
|
||||||
run: |
|
uses: actions/setup-node@v3
|
||||||
rustup set profile minimal
|
with:
|
||||||
rustup update stable
|
node-version: "18"
|
||||||
|
|
||||||
- name: Install Node
|
- name: Checkout repo
|
||||||
uses: actions/setup-node@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
clean: false
|
||||||
|
submodules: "recursive"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Run randomized tests
|
||||||
uses: actions/checkout@v3
|
run: script/randomized-test-ci
|
||||||
with:
|
|
||||||
clean: false
|
|
||||||
submodules: 'recursive'
|
|
||||||
|
|
||||||
- name: Run randomized tests
|
|
||||||
run: script/randomized-test-ci
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ env:
|
|||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
rustfmt:
|
style:
|
||||||
name: Check formatting
|
name: Check formatting and Clippy lints
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
@@ -25,16 +25,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
clean: false
|
clean: false
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Run rustfmt
|
- name: Run style checks
|
||||||
uses: ./.github/actions/check_formatting
|
uses: ./.github/actions/check_style
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
runs-on:
|
runs-on:
|
||||||
- self-hosted
|
- self-hosted
|
||||||
- test
|
- test
|
||||||
needs: rustfmt
|
needs: style
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -59,14 +60,6 @@ jobs:
|
|||||||
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
|
DIGITALOCEAN_SPACES_ACCESS_KEY: ${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }}
|
||||||
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
|
DIGITALOCEAN_SPACES_SECRET_KEY: ${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }}
|
||||||
steps:
|
steps:
|
||||||
- name: Install Rust
|
|
||||||
run: |
|
|
||||||
rustup set profile minimal
|
|
||||||
rustup update stable
|
|
||||||
rustup target add aarch64-apple-darwin
|
|
||||||
rustup target add x86_64-apple-darwin
|
|
||||||
rustup target add wasm32-wasi
|
|
||||||
|
|
||||||
- name: Install Node
|
- name: Install Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -104,12 +104,10 @@ async fn test_channel_guest_promotion(cx_a: &mut TestAppContext, cx_b: &mut Test
|
|||||||
});
|
});
|
||||||
assert!(project_b.read_with(cx_b, |project, _| project.is_read_only()));
|
assert!(project_b.read_with(cx_b, |project, _| project.is_read_only()));
|
||||||
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
assert!(editor_b.update(cx_b, |e, cx| e.read_only(cx)));
|
||||||
assert!(dbg!(
|
assert!(room_b
|
||||||
room_b
|
.update(cx_b, |room, cx| room.share_microphone(cx))
|
||||||
.update(cx_b, |room, cx| room.share_microphone(cx))
|
.await
|
||||||
.await
|
.is_err());
|
||||||
)
|
|
||||||
.is_err());
|
|
||||||
|
|
||||||
// B is promoted
|
// B is promoted
|
||||||
active_call_a
|
active_call_a
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ mod test {
|
|||||||
|
|
||||||
let mut cx1 = VisualTestContext::from_window(cx.window, &cx);
|
let mut cx1 = VisualTestContext::from_window(cx.window, &cx);
|
||||||
let editor1 = cx.editor.clone();
|
let editor1 = cx.editor.clone();
|
||||||
dbg!(editor1.entity_id());
|
|
||||||
|
|
||||||
let buffer = cx.new_model(|_| Buffer::new(0, 0, "a = 1\nb = 2\n"));
|
let buffer = cx.new_model(|_| Buffer::new(0, 0, "a = 1\nb = 2\n"));
|
||||||
let (editor2, cx2) = cx.add_window_view(|cx| Editor::for_buffer(buffer, None, cx));
|
let (editor2, cx2) = cx.add_window_view(|cx| Editor::for_buffer(buffer, None, cx));
|
||||||
|
|||||||
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.75"
|
channel = "1.75"
|
||||||
components = [ "rustfmt" ]
|
profile = "minimal"
|
||||||
|
components = [ "rustfmt", "clippy" ]
|
||||||
targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", "wasm32-wasi" ]
|
targets = [ "x86_64-apple-darwin", "aarch64-apple-darwin", "wasm32-wasi" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user