Merge pull request #437 from rustfs/feat/add-formatting-rules-and-type-inference

feat: add comprehensive formatting rules and type inference guidelines
This commit is contained in:
安正超
2025-05-28 16:20:59 +08:00
committed by GitHub
28 changed files with 792 additions and 383 deletions
+11 -5
View File
@@ -94,7 +94,10 @@ mod tests {
// Test event config properties
assert!(!config.event.store_path.is_empty(), "Store path should not be empty");
assert!(config.event.channel_capacity >= 1000, "Channel capacity should be reasonable for production");
assert!(
config.event.channel_capacity >= 1000,
"Channel capacity should be reasonable for production"
);
// Test that store path is a valid path format
let store_path = &config.event.store_path;
@@ -106,13 +109,13 @@ mod tests {
match adapter {
crate::event::adapters::AdapterConfig::Webhook(_) => {
// Webhook adapter should be properly configured
},
}
crate::event::adapters::AdapterConfig::Kafka(_) => {
// Kafka adapter should be properly configured
},
}
crate::event::adapters::AdapterConfig::Mqtt(_) => {
// MQTT adapter should be properly configured
},
}
}
}
}
@@ -153,7 +156,10 @@ mod tests {
// Test that observability config has Debug trait
let observability_debug = format!("{:?}", config.observability);
assert!(!observability_debug.is_empty(), "Observability config should have debug output");
assert!(observability_debug.contains("ObservabilityConfig"), "Debug output should contain type name");
assert!(
observability_debug.contains("ObservabilityConfig"),
"Debug output should contain type name"
);
// Test that event config has Debug trait
let event_debug = format!("{:?}", config.event);
+15 -6
View File
@@ -53,7 +53,10 @@ mod tests {
// Verify store path is set
assert!(!config.store_path.is_empty(), "Store path should not be empty");
assert!(config.store_path.contains("event-notification"), "Store path should contain event-notification");
assert!(
config.store_path.contains("event-notification"),
"Store path should contain event-notification"
);
// Verify channel capacity is reasonable
assert_eq!(config.channel_capacity, 10000, "Channel capacity should be 10000");
@@ -153,7 +156,10 @@ mod tests {
assert!(!debug_str.is_empty(), "Debug output should not be empty");
assert!(debug_str.contains("NotifierConfig"), "Debug output should contain struct name");
assert!(debug_str.contains("store_path"), "Debug output should contain store_path field");
assert!(debug_str.contains("channel_capacity"), "Debug output should contain channel_capacity field");
assert!(
debug_str.contains("channel_capacity"),
"Debug output should contain channel_capacity field"
);
assert!(debug_str.contains("adapters"), "Debug output should contain adapters field");
}
@@ -217,13 +223,13 @@ mod tests {
match adapter {
AdapterConfig::Webhook(_) => {
// Webhook adapter should be properly configured
},
}
AdapterConfig::Kafka(_) => {
// Kafka adapter should be properly configured
},
}
AdapterConfig::Mqtt(_) => {
// MQTT adapter should be properly configured
},
}
}
}
}
@@ -320,6 +326,9 @@ mod tests {
// DEFAULT_CONFIG_FILE is a const, so is_empty() check is redundant
// assert!(!DEFAULT_CONFIG_FILE.is_empty(), "Config file name should not be empty");
assert!(!DEFAULT_CONFIG_FILE.contains('/'), "Config file name should not contain path separators");
assert!(!DEFAULT_CONFIG_FILE.contains('\\'), "Config file name should not contain Windows path separators");
assert!(
!DEFAULT_CONFIG_FILE.contains('\\'),
"Config file name should not contain Windows path separators"
);
}
}