diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index cdf0f60147d..2824356506b 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -25,7 +25,6 @@ export COMMIT_RANGE echo git log --no-merges --oneline "$COMMIT_RANGE" echo -test/lint/commit-script-check.sh "$COMMIT_RANGE" RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner" if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs index 8479fd2d64a..36f82f14b1a 100644 --- a/test/lint/test_runner/src/main.rs +++ b/test/lint/test_runner/src/main.rs @@ -68,6 +68,11 @@ fn get_linter_list() -> Vec<&'static Linter> { name: "subtree", lint_fn: lint_subtree }, + &Linter { + description: "Check scripted-diffs", + name: "scripted_diff", + lint_fn: lint_scripted_diff + }, &Linter { description: "Check that tabs are not used as whitespace", name: "tabs_whitespace", @@ -173,6 +178,11 @@ fn get_git_root() -> PathBuf { PathBuf::from(check_output(git().args(["rev-parse", "--show-toplevel"])).unwrap()) } +/// Return the commit range, or panic +fn commit_range() -> String { + env::var("COMMIT_RANGE").unwrap() +} + /// Return all subtree paths fn get_subtrees() -> Vec<&'static str> { vec![ @@ -210,6 +220,19 @@ fn lint_subtree() -> LintResult { } } +fn lint_scripted_diff() -> LintResult { + if Command::new("test/lint/commit-script-check.sh") + .arg(commit_range()) + .status() + .expect("command error") + .success() + { + Ok(()) + } else { + Err("".to_string()) + } +} + fn lint_py_lint() -> LintResult { let bin_name = "ruff"; let checks = format!(