-
Notifications
You must be signed in to change notification settings - Fork 83
refactor(taskfile): Refactor Rust lint tasks (fixes #1451): #1472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
c4d8d8c
47c4924
2fa23eb
6b17825
799a015
f432e1e
87c722b
becbc71
c3ca815
1fea11a
d532f48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,8 @@ | ||||||||||
| version: "3" | ||||||||||
|
|
||||||||||
| includes: | ||||||||||
| toolchains: "./toolchains.yaml" | ||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
LinZhihao-723 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| vars: | ||||||||||
| # Ignore https://github.com/msgpack/msgpack-c/issues/1098 | ||||||||||
| G_CLANG_TIDY_LINE_FILTER_IGNORE_MSGPACK_1098: >- | ||||||||||
|
|
@@ -796,27 +799,27 @@ tasks: | |||||||||
|
|
||||||||||
| check-rust-format: | ||||||||||
| cmds: | ||||||||||
| - task: "rust-workspace-fmt" | ||||||||||
| - task: "cargo-workspace-fmt" | ||||||||||
| vars: | ||||||||||
| RUSTFMT_FLAGS: "--check" | ||||||||||
| CARGO_FMT_FLAGS: "--check" | ||||||||||
|
|
||||||||||
| fix-rust-format: | ||||||||||
| cmds: | ||||||||||
| - task: "rust-workspace-fmt" | ||||||||||
| - task: "cargo-workspace-fmt" | ||||||||||
LinZhihao-723 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| vars: | ||||||||||
| RUSTFMT_FLAGS: "" | ||||||||||
| CARGO_FMT_FLAGS: "" | ||||||||||
|
|
||||||||||
| check-rust-static: | ||||||||||
| cmds: | ||||||||||
| - task: "rust-workspace-clippy" | ||||||||||
| - task: "cargo-workspace-clippy" | ||||||||||
| vars: | ||||||||||
| RUST_CLIPPY_FLAGS: "-- -D warnings" | ||||||||||
| CARGO_CLIPPY_FLAGS: "-- -D warnings" | ||||||||||
|
|
||||||||||
| fix-rust-static: | ||||||||||
| cmds: | ||||||||||
| - task: "rust-workspace-clippy" | ||||||||||
| - task: "cargo-workspace-clippy" | ||||||||||
| vars: | ||||||||||
| RUST_CLIPPY_FLAGS: "--fix --allow-dirty --allow-staged" | ||||||||||
| CARGO_CLIPPY_FLAGS: "--fix --allow-dirty --allow-staged" | ||||||||||
|
|
||||||||||
| rust-lint-configs: | ||||||||||
| internal: true | ||||||||||
|
|
@@ -826,25 +829,31 @@ tasks: | |||||||||
| {{.ROOT_DIR}}/tools/yscope-dev-utils/exports/lint-configs/.rustfmt.toml \ | ||||||||||
| {{.ROOT_DIR}}/.rustfmt.toml | ||||||||||
|
|
||||||||||
| rust-workspace-fmt: | ||||||||||
| # Runs `cargo +nightly fmt` in the root Rust workspace directory with the specified flags. | ||||||||||
| # | ||||||||||
| # @param {string} CARGO_FMT_FLAGS The flags to pass to the `cargo +nightly fmt` command. | ||||||||||
| cargo-workspace-fmt: | ||||||||||
| internal: true | ||||||||||
| deps: ["rust-lint-configs", ":toolchains:rust"] | ||||||||||
| dir: "{{.ROOT_DIR}}" | ||||||||||
| requires: | ||||||||||
| vars: ["RUSTFMT_FLAGS"] | ||||||||||
| vars: ["CARGO_FMT_FLAGS"] | ||||||||||
| dir: "{{.ROOT_DIR}}" | ||||||||||
| deps: ["rust-lint-configs", "toolchains:rust"] | ||||||||||
| cmd: |- | ||||||||||
| . "$HOME/.cargo/env" | ||||||||||
| cargo +nightly fmt --all -- {{.RUSTFMT_FLAGS}} | ||||||||||
| cargo +nightly fmt --all -- {{.CARGO_FMT_FLAGS}} | ||||||||||
|
Comment on lines
842
to
+843
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Not really important but does this work? If so and you'd like to update, there are plenty other similar cases.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer the current way as this is not just a binary call. It could set up some env variables that have side effects. |
||||||||||
|
|
||||||||||
LinZhihao-723 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| rust-workspace-clippy: | ||||||||||
| # Runs `cargo +nightly clippy` in the root Rust workspace directory with the specified flags. | ||||||||||
| # | ||||||||||
| # @param {string} CARGO_CLIPPY_FLAGS The flags to pass to the `cargo +nightly clippy` command. | ||||||||||
| cargo-workspace-clippy: | ||||||||||
| internal: true | ||||||||||
| deps: [":toolchains:rust"] | ||||||||||
| dir: "{{.ROOT_DIR}}" | ||||||||||
| requires: | ||||||||||
| vars: ["RUST_CLIPPY_FLAGS"] | ||||||||||
| vars: ["CARGO_CLIPPY_FLAGS"] | ||||||||||
| dir: "{{.ROOT_DIR}}" | ||||||||||
| deps: ["toolchains:rust"] | ||||||||||
| cmd: |- | ||||||||||
| . "$HOME/.cargo/env" | ||||||||||
| cargo +nightly clippy --all-targets --all-features {{.RUST_CLIPPY_FLAGS}} | ||||||||||
| cargo +nightly clippy --all-targets --all-features {{.CARGO_CLIPPY_FLAGS}} | ||||||||||
|
|
||||||||||
LinZhihao-723 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| venv: | ||||||||||
| internal: true | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,10 +2,11 @@ version: "3" | |||||||
|
|
||||||||
| includes: | ||||||||
| integration: "integration.yaml" | ||||||||
| toolchains: "../toolchains.yaml" | ||||||||
|
|
||||||||
| tasks: | ||||||||
| rust-all: | ||||||||
| deps: [":toolchains:rust"] | ||||||||
| deps: ["toolchains:rust"] | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Good fix on namespaced dep; consider object form for clarity. String form works; object form reads better and avoids quoting/linters nitpicks. - deps: ["toolchains:rust"]
+ deps:
+ - task: toolchains:rust📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| dir: "{{.ROOT_DIR}}" | ||||||||
| cmd: |- | ||||||||
| . "$HOME/.cargo/env" | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems a
targetdirectory is generated at the project root for build cache. shall we add the directory to.gitignoreor set CARGO_TARGET_DIR to somewhere withinbuild/?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure we can set it under
buildThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing to
build/rust-targets