From eb3f42f61cce279e6c5d551d29c8718a1dc69ba1 Mon Sep 17 00:00:00 2001 From: Juliette Pretot Date: Mon, 20 May 2024 16:31:25 +0000 Subject: [PATCH] Ensure the todo linter works okay with across mulitple lines. By no longer matching that the line must end in a period. This does allow TODOs that do not end in a period, even if the TODO is not broken up among multiple lines. Imo this the desired behavior. The current check is flaky and not worth it. It already only applies to one form of the accepted todos (a bug). We could try to make it work across multiple lines but it'd get into the territory of overengineering quickly, as that leads to lots of subtle problems such as dealing with indentation, differentiating comments and code. Bug-Id: 333067027 Change-Id: I52d5c9e974d5944c6825e557d90f1f517f4be400 --- xtask/src/check_todo.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xtask/src/check_todo.rs b/xtask/src/check_todo.rs index 631b5725361..ff8ef638b83 100644 --- a/xtask/src/check_todo.rs +++ b/xtask/src/check_todo.rs @@ -22,7 +22,7 @@ use crate::internal::*; static PATTERN: Lazy = // Break up "TO" and "DO" to avoid false positives on this code. Lazy::new(|| { - Regex::new(&format!(r"({}DO\(#\d+\)|{}DO: .+ - .+\.)", "TO", "TO")) + Regex::new(&format!(r"({}DO\(#\d+\)|{}DO: .+ - \w+)", "TO", "TO")) .expect("couldn't parse regex") }); @@ -76,8 +76,6 @@ mod tests { assert!(!CheckTodo::is_invalid_todo(&format!("{}DO(#123)", "TO"))); assert!(!CheckTodo::is_invalid_todo(&format!("{}DO: b/123 - do something.", "TO"))); - // Missing full stop. - assert!(CheckTodo::is_invalid_todo(&format!("{}DO: b/123 - do something", "TO"))); // Missing link separator. assert!(CheckTodo::is_invalid_todo(&format!("{}DO: do something.", "TO"))); // Empty link.