mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
lint: Call lint_scripted_diff from test_runner
Allowing to call the check from the test_runner allows for consistent error messages and better UX by having a single test_runner for all checks. This requires the env var to be set for now. The next commit makes the commit range optional.
This commit is contained in:
parent
35bf426e02
commit
fa673cf344
2 changed files with 23 additions and 1 deletions
|
@ -25,7 +25,6 @@ export COMMIT_RANGE
|
||||||
echo
|
echo
|
||||||
git log --no-merges --oneline "$COMMIT_RANGE"
|
git log --no-merges --oneline "$COMMIT_RANGE"
|
||||||
echo
|
echo
|
||||||
test/lint/commit-script-check.sh "$COMMIT_RANGE"
|
|
||||||
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
|
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
|
||||||
|
|
||||||
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then
|
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then
|
||||||
|
|
|
@ -68,6 +68,11 @@ fn get_linter_list() -> Vec<&'static Linter> {
|
||||||
name: "subtree",
|
name: "subtree",
|
||||||
lint_fn: lint_subtree
|
lint_fn: lint_subtree
|
||||||
},
|
},
|
||||||
|
&Linter {
|
||||||
|
description: "Check scripted-diffs",
|
||||||
|
name: "scripted_diff",
|
||||||
|
lint_fn: lint_scripted_diff
|
||||||
|
},
|
||||||
&Linter {
|
&Linter {
|
||||||
description: "Check that tabs are not used as whitespace",
|
description: "Check that tabs are not used as whitespace",
|
||||||
name: "tabs_whitespace",
|
name: "tabs_whitespace",
|
||||||
|
@ -173,6 +178,11 @@ fn get_git_root() -> PathBuf {
|
||||||
PathBuf::from(check_output(git().args(["rev-parse", "--show-toplevel"])).unwrap())
|
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
|
/// Return all subtree paths
|
||||||
fn get_subtrees() -> Vec<&'static str> {
|
fn get_subtrees() -> Vec<&'static str> {
|
||||||
vec![
|
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 {
|
fn lint_py_lint() -> LintResult {
|
||||||
let bin_name = "ruff";
|
let bin_name = "ruff";
|
||||||
let checks = format!(
|
let checks = format!(
|
||||||
|
|
Loading…
Add table
Reference in a new issue