Skip to content

Commit

Permalink
feat: assorted improvements
Browse files Browse the repository at this point in the history
Improve the diagnostic message for if-change-then-change to be more
actionable and support `DONOTLAND` as a do-not-land token.
  • Loading branch information
sxlijin committed Oct 18, 2022
1 parent ddd997e commit 14c4ba7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/rules/if_change_then_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ pub fn ictc(hunks: &Vec<Hunk>) -> anyhow::Result<Vec<diagnostic::Diagnostic>> {
severity: diagnostic::Severity::Error,
code: "if-change-then-change".to_string(),
message: format!(
"{}[{}, {}) was modified, but no if-change-then-change block in {} was modified",
"Expected change in {} because {}[{}, {}) was modified",
b.thenchange.display(),
b.path.display(),
b.begin,
b.end,
b.thenchange.display()
),
})
.collect();
Expand Down
4 changes: 2 additions & 2 deletions src/rules/pls_no_land.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::io::{BufRead, BufReader};
use std::path::PathBuf;

lazy_static::lazy_static! {
static ref RE: Regex = Regex::new(r"(?i)(DO[\s_-]+NOT[\s_-]+LAND)").unwrap();
static ref RE: Regex = Regex::new(r"(?i)(DO[\s_-]*NOT[\s_-]*LAND)").unwrap();
}

// Checks for $re and other forms thereof in source code
Expand Down Expand Up @@ -44,7 +44,7 @@ fn pls_no_land_impl(path: &PathBuf) -> anyhow::Result<Vec<diagnostic::Diagnostic
let mut ret = Vec::new();

for (i, line) in lines_view.iter().enumerate() {
if line.contains("trunk-ignore(|-begin|-end|-all)\\(horton/do-not-land\\)") {
if line.contains("trunk-ignore(|-begin|-end|-all)\\(trunk-toolbox/do-not-land\\)") {
continue;
}

Expand Down

0 comments on commit 14c4ba7

Please sign in to comment.