Skip to content

Commit 4695270

Browse files
committed
parse boolean as string in description key
1 parent ecb051c commit 4695270

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

sbuild-linter/src/validator.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,17 @@ impl FieldValidator {
271271
}
272272

273273
for (key, val) in map {
274-
if let Some(key_str) = key.as_str() {
274+
let map_key = match key {
275+
Value::String(s) => Some(s.to_string()),
276+
Value::Bool(b) => Some(b.to_string()),
277+
_ => None,
278+
};
279+
280+
if let Some(key_str) = map_key {
275281
if let Some(val_str) = val.as_str() {
276282
if !val_str.trim().is_empty() {
277283
validated_map.insert(
278-
Value::String(key_str.to_string()),
284+
Value::String(key_str),
279285
Value::String(val_str.to_string()),
280286
);
281287
} else {
@@ -299,7 +305,7 @@ impl FieldValidator {
299305
} else {
300306
visitor.record_error(
301307
self.name.to_string(),
302-
"Package name must be a string".to_string(),
308+
"Description key must be a string".to_string(),
303309
line_number,
304310
Severity::Error,
305311
);

sbuild/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ fn get_soar_env() -> SoarEnv {
5454
return soar_env;
5555
} else {
5656
eprintln!(
57-
"Error: Command produced errors: {}",
57+
"Error: `soar env` produced errors: {}",
5858
String::from_utf8_lossy(&cmd_output.stderr)
5959
);
6060
}
6161
} else {
62-
eprintln!("Error: Command exited with a non-zero status.");
62+
eprintln!("Error: `soar env` exited with a non-zero status.");
6363
}
6464
} else {
65-
eprintln!("Error: Failed to execute command.");
65+
eprintln!("Error: Failed to execute command `soar env`.");
6666
}
6767
std::process::exit(1);
6868
}

0 commit comments

Comments
 (0)