You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improvement 1: Downscope 5 pub functions in tools.rs to pub(crate)
Category: API Surface File(s): guards/github-guard/rust-guard/src/tools.rs Effort: Small (< 15 min) Risk: Low
Problem
Five classification functions in tools.rs are declared pub, but they are only ever called from within the same crate (via tools:: in lib.rs). Because this is a WASM library (no public Rust API consumers), pub(crate) is the correct visibility.
Three test assertions pass the raw string "github" as a scope argument where the rest of the codebase consistently uses the scope_names::GITHUB constant:
All other writer_integrity/reader_integrity calls in the same file and in tool_rules.rs use scope_names::GITHUB or scope_names::USER. These three are inconsistent outliers.
(Ensure scope_names is in scope — already available via the existing labels::constants import or a use labels::constants::scope_names; in the test module.)
Why This Matters
Consistency and refactor-safety. If scope_names::GITHUB ever changed value, these three hardcoded string tests would silently test the wrong scope. Using the constant ties expectations directly to the definition.
🦀 Rust Guard Improvement Report
Improvement 1: Downscope 5
pubfunctions intools.rstopub(crate)Category: API Surface
File(s):
guards/github-guard/rust-guard/src/tools.rsEffort: Small (< 15 min)
Risk: Low
Problem
Five classification functions in
tools.rsare declaredpub, but they are only ever called from within the same crate (viatools::inlib.rs). Because this is a WASM library (no public Rust API consumers),pub(crate)is the correct visibility.Affected functions (lines 145–189):
All five are called only from
lib.rs:Note:
is_lock_operationandis_unlock_operationwere already correctly scoped aspub(crate). These five were missed in that pass.Suggested Change
Change
pub fn→pub(crate) fnfor each of the five functions.Before
After
Why This Matters
is_lock_operation/is_unlock_operationwhich are alreadypub(crate)rustc/clippyto flag accidental dead code without#[allow(dead_code)]Improvement 2: Replace 3 raw
"github"literals inlib.rstests withscope_names::GITHUBCategory: Centralization
File(s):
guards/github-guard/rust-guard/src/lib.rsEffort: Small (< 15 min)
Risk: Low
Problem
Three test assertions pass the raw string
"github"as a scope argument where the rest of the codebase consistently uses thescope_names::GITHUBconstant:All other
writer_integrity/reader_integritycalls in the same file and intool_rules.rsusescope_names::GITHUBorscope_names::USER. These three are inconsistent outliers.Before
After
(Ensure
scope_namesis in scope — already available via the existinglabels::constantsimport or ause labels::constants::scope_names;in the test module.)Why This Matters
Consistency and refactor-safety. If
scope_names::GITHUBever changed value, these three hardcoded string tests would silently test the wrong scope. Using the constant ties expectations directly to the definition.Codebase Health Summary
Generated by Rust Guard Improver • Run: §29820027294
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.