Skip to main content

record_candidates

Function record_candidates 

Source
pub fn record_candidates(text: &str) -> Vec<String>
Expand description

Every word in text shaped like a record id of this repository: I and four digits, M and three.

The shape alone, with nothing resolved. Both halves of the question read it: the changelog asks which candidates the layer holds, and the commit validator asks which it does not — and a repository that scanned for one direction and not the other is how a commit came to name a record nobody had, with nothing to say so. One scan, two callers, no way for the two to disagree about what counts as an id.

use majordomus_cli::release::commits::record_candidates;
assert_eq!(record_candidates("done under I1305 for M000"), vec!["I1305", "M000"]);
// a word that merely starts with the letter is never a candidate
assert!(record_candidates("Interesting M1 and I12345 are not ids").is_empty());
// and each is offered once, in the order it was written
assert_eq!(record_candidates("I1305 again I1305"), vec!["I1305"]);