Skip to content

Commit

Permalink
Ensure the todo linter works okay with across mulitple lines.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jul-sh committed May 21, 2024
1 parent f74cc14 commit eb3f42f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions xtask/src/check_todo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::internal::*;
static PATTERN: Lazy<Regex> =
// 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")
});

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit eb3f42f

Please sign in to comment.