fix(ci): CodeQL-friendly session shell tests#109
Merged
Conversation
CodeQL's Rust extractor warns on assert! macro expansion when POSIX and Windows cfg branches live in the same test function. Use separate #[test] items with #[cfg] on each function.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Rust unit tests in the Tauri desktop app’s session.rs to avoid a GitHub CodeQL Rust analysis warning caused by mixing #[cfg(...)] branches inside a single #[test].
Changes:
- Split
builds_local_shell_command_from_explicit_shellinto two OS-specific tests using#[cfg(not(target_os = "windows"))]and#[cfg(target_os = "windows")]. - Add a short explanatory comment about the CodeQL extractor behavior to justify the split.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GitHub CodeQL Rust analysis reported a warning on
session.rs(macro expansion /panic_2021) when a single#[test]mixed#[cfg(not(target_os = "windows"))]and#[cfg(target_os = "windows")]assert!branches.Change
Split
builds_local_shell_command_from_explicit_shellinto:builds_local_shell_command_from_explicit_shell_posix(#[cfg(not(target_os = "windows"))])builds_local_shell_command_from_explicit_shell_windows(#[cfg(target_os = "windows")])Behavior is unchanged;
cargo test session::testspasses locally.