MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / validate_globs

Function validate_globs

src/dashboard/settings_api.rs:253–269  ·  view source on GitHub ↗
(field: &str, globs: &[String], errors: &mut Vec<Value>)

Source from the content-addressed store, hash-verified

251}
252
253fn validate_globs(field: &str, globs: &[String], errors: &mut Vec<Value>) {
254 for pattern in globs {
255 if pattern.trim().is_empty() {
256 errors.push(validation_error(
257 field,
258 &format!("{field} patterns must not be empty"),
259 ));
260 continue;
261 }
262 if let Err(err) = glob::Pattern::new(pattern) {
263 errors.push(validation_error(
264 field,
265 &format!("invalid glob pattern '{pattern}': {err}"),
266 ));
267 }
268 }
269}
270
271fn validation_error(field: &str, message: &str) -> Value {
272 json!({ "field": field, "message": message })

Callers 1

patch_project_settingsFunction · 0.85

Calls 3

validation_errorFunction · 0.85
pushMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected