lint: Clarify rmtree/remove_all error message with preferred alternatives
What changed, and why it matters
This commit only rewords two lint error messages and fixes a minor code-formatting import line. It does not change any runtime behavior, security checks, or executable code paths in Bitcoin Core. There is no security issue here.
No action required; this is a non-security documentation/clarity change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch updates the human-readable text of two lint rules (one C++, one Python) that warn against dangerous recursive deletion functions, adding preferred alternatives to the message. It also splits a long use statement in the Rust lint runner across two lines. No functional logic changes.
Changed components
test/lint/test_runner/src/lint_cpp.rstest/lint/test_runner/src/lint_py.rstest/lint/test_runner/src/main.rsInspect captured patch +6 / −4
diff --git a/test/lint/test_runner/src/lint_cpp.rs b/test/lint/test_runner/src/lint_cpp.rs
index e587c4c0..727c8758 100644
--- a/test/lint/test_runner/src/lint_cpp.rs
+++ b/test/lint/test_runner/src/lint_cpp.rs
@@ -139,7 +139,8 @@ pub fn lint_remove_all() -> LintResult {
.success();
if found {
Err(r#"
-Use of fs::remove_all or std::filesystem::remove_all is dangerous and should be avoided.
+Use of fs::remove_all or std::filesystem::remove_all is dangerous and should be avoided. If removal
+is required, prefer fs::remove.
"#
.trim()
.to_string())
diff --git a/test/lint/test_runner/src/lint_py.rs b/test/lint/test_runner/src/lint_py.rs
index a335ba27..7c5c0dae 100644
--- a/test/lint/test_runner/src/lint_py.rs
+++ b/test/lint/test_runner/src/lint_py.rs
@@ -89,7 +89,8 @@ pub fn lint_rmtree() -> LintResult {
.success();
if found {
Err(r#"
-Use of shutil.rmtree() is dangerous and should be avoided.
+Use of shutil.rmtree() is dangerous and should be avoided. If it
+is really required for the test, use self.cleanup_folder(_).
"#
.trim()
.to_string())
@@ -97,4 +98,3 @@ Use of shutil.rmtree() is dangerous and should be avoided.
Ok(())
}
}
-
diff --git a/test/lint/test_runner/src/main.rs b/test/lint/test_runner/src/main.rs
index 8d34fc6e..7c0eb585 100644
--- a/test/lint/test_runner/src/main.rs
+++ b/test/lint/test_runner/src/main.rs
@@ -14,7 +14,8 @@ use std::fs;
use std::process::{Command, ExitCode};
use lint_cpp::{
- lint_boost_assert, lint_includes_build_config, lint_remove_all, lint_rpc_assert, lint_std_filesystem,
+ lint_boost_assert, lint_includes_build_config, lint_remove_all, lint_rpc_assert,
+ lint_std_filesystem,
};
use lint_docs::{lint_doc_args, lint_doc_release_note_snippets, lint_markdown};
use lint_py::{lint_py_lint, lint_rmtree};
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.