fix: format and lint
CI / Format (push) Successful in 48s
CI / Test (push) Failing after 7m9s
CI / Check (push) Successful in 12m6s
CI / Clippy (push) Successful in 12m10s

This commit is contained in:
Guillaume GRABÉ
2026-06-08 23:51:29 +02:00
parent 6400518beb
commit 1302ce412c
27 changed files with 563 additions and 395 deletions
+16 -13
View File
@@ -308,7 +308,10 @@ fn extract_metadata(entity: &Entity) -> Result<Value, Box<dyn std::error::Error>
}
let mut annotations = serde_json::Map::new();
if !m.resource_type.is_empty() {
annotations.insert("keycloak.org/resource-type".to_string(), json!(m.resource_type));
annotations.insert(
"keycloak.org/resource-type".to_string(),
json!(m.resource_type),
);
}
if !m.realm.is_empty() {
annotations.insert("keycloak.org/realm".to_string(), json!(m.realm));
@@ -465,10 +468,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
Some(Spec::DefectdojoSpec(s)) => {
// DefectDojo plugin spec - parse config_json if present
let mut spec = json!({});
if !s.config_json.is_empty() {
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
spec = config;
}
if !s.config_json.is_empty()
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
{
spec = config;
}
if !s.sync_status.is_empty() {
spec["sync_status"] = json!(s.sync_status);
@@ -478,10 +481,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
Some(Spec::KeycloakSpec(s)) => {
// Keycloak plugin spec - parse config_json if present
let mut spec = json!({});
if !s.config_json.is_empty() {
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
spec = config;
}
if !s.config_json.is_empty()
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
{
spec = config;
}
if !s.sync_status.is_empty() {
spec["sync_status"] = json!(s.sync_status);
@@ -497,10 +500,10 @@ fn extract_spec(entity: &Entity) -> Option<Value> {
Some(Spec::DependencytrackSpec(s)) => {
// Dependency-Track plugin spec - parse config_json if present
let mut spec = json!({});
if !s.config_json.is_empty() {
if let Ok(config) = serde_json::from_str::<Value>(&s.config_json) {
spec = config;
}
if !s.config_json.is_empty()
&& let Ok(config) = serde_json::from_str::<Value>(&s.config_json)
{
spec = config;
}
if !s.sync_status.is_empty() {
spec["sync_status"] = json!(s.sync_status);
+10 -10
View File
@@ -71,16 +71,16 @@ async fn get_locations(State(state): State<YamlAdapterState>) -> Response {
// Check cache first
{
let cache = state.cache.read().await;
if let Some(ref cached) = *cache {
if cached.cached_at.elapsed() < state.cache_ttl {
debug!("Serving /yaml/locations from cache");
return (
StatusCode::OK,
[("content-type", "text/yaml; charset=utf-8")],
cached.data.clone(),
)
.into_response();
}
if let Some(ref cached) = *cache
&& cached.cached_at.elapsed() < state.cache_ttl
{
debug!("Serving /yaml/locations from cache");
return (
StatusCode::OK,
[("content-type", "text/yaml; charset=utf-8")],
cached.data.clone(),
)
.into_response();
}
}