Skip to main content

check

Function check 

Source
pub fn check(text: &str) -> Result<(), String>
Expand description

Says if text can be the notes of a lead: Err has the reason.

use riff_core::notes::check;

assert!(check("").is_ok());
// A branch name, a path and a requirement ID are no token.
assert!(check("branch claude-token-keyring-instead-of-a-file-1166").is_ok());
assert!(check("see crates/riff/src/lead.rs and 01M59258K3TYR09HC4AWHWZPEX").is_ok());
// A hash is hex.
assert!(check(&format!("sha {}", "ab12".repeat(16))).is_ok());
// A token.
assert!(check("GH_TOKEN=ghp_abcdefghijklmnopqrstuvwxyz0123456789").is_err());
assert!(check("key abcdefghijklmnopqrstuvwxyz0123456789ABCD").is_err());
assert!(check("-----BEGIN OPENSSH PRIVATE KEY-----").is_err());