Skip to content

Commit 3dea6d8

Browse files
authored
Remove unused callListMethod function (#2657)
Removes the unused `callListMethod` generic helper from `internal/mcp/connection.go`. This function was never called anywhere in the codebase and was flagged by `golangci-lint`. The similar `callParamMethod` helper IS used and remains untouched.
2 parents 972510c + a5ac332 commit 3dea6d8

4 files changed

Lines changed: 5 additions & 14 deletions

File tree

guards/github-guard/rust-guard/src/labels/constants.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/// Common label string constants to ensure consistency across the codebase
66
pub mod label_constants {
77
pub const NONE: &str = "none";
8+
#[cfg(test)]
89
pub const SECRET: &str = "secret";
910
pub const PRIVATE_USER: &str = "private:user";
1011
pub const READER_PREFIX: &str = "unapproved:";

guards/github-guard/rust-guard/src/labels/helpers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ pub fn ensure_integrity_baseline(
326326
// ============================================================================
327327

328328
/// Returns a vec with the "secret" label
329+
#[cfg(test)]
329330
#[inline]
330331
pub fn secret_label() -> Vec<String> {
331332
vec![label_constants::SECRET.to_string()]

guards/github-guard/rust-guard/src/labels/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ pub use helpers::{
4949
has_author_association, is_blocked_user, is_bot, is_graphql_wrapper, is_mcp_text_wrapper,
5050
is_search_result_wrapper, issue_integrity, limit_items_with_log, make_item_path,
5151
merged_integrity, none_integrity, pr_integrity, private_scope_label, private_user_label,
52-
project_github_label, reader_integrity, search_result_total_count, secret_label,
52+
project_github_label, reader_integrity, search_result_total_count,
5353
writer_integrity, MinIntegrity, PolicyContext, PolicyScopeEntry, ScopeKind,
5454
};
5555
#[cfg(test)]
5656
pub use helpers::has_approval_label;
57+
#[cfg(test)]
58+
pub use helpers::secret_label;
5759

5860
// Re-export response labeling functions (wrappers that pass PolicyContext)
5961
pub fn apply_tool_labels(

internal/mcp/connection.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -502,19 +502,6 @@ func unmarshalParams(params interface{}, target interface{}) error {
502502
return nil
503503
}
504504

505-
// callListMethod is a generic helper for SDK list operations with no additional parameters.
506-
// It handles the common pattern of: requireSession → SDK call → marshalToResponse.
507-
func (c *Connection) callListMethod(call func() (interface{}, error)) (*Response, error) {
508-
if err := c.requireSession(); err != nil {
509-
return nil, err
510-
}
511-
result, err := call()
512-
if err != nil {
513-
return nil, err
514-
}
515-
return marshalToResponse(result)
516-
}
517-
518505
// callParamMethod is a generic helper for SDK operations that require typed parameters.
519506
// It handles the common pattern of: requireSession → unmarshalParams → fn(params) → marshalToResponse.
520507
// P is the type of the parameter struct to unmarshal into.

0 commit comments

Comments
 (0)