Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or https://opensource.org/license/mit/.5use std::io::ErrorKind;6use std::process::Command;8use crate::util::{check_output, get_pathspecs_default_excludes, git, LintResult};10pub fn lint_py_lint() -> LintResult {11let bin_name = "ruff";12let files = check_output(13git()14.args(["ls-files", "--", "*.py"])15.args(get_pathspecs_default_excludes()),16)?;18let mut cmd = Command::new(bin_name);19cmd.arg("check").args(files.lines());21match cmd.status() {22Ok(status) if status.success() => Ok(()),23Ok(_) => Err(format!("`{bin_name}` found errors!")),24Err(e) if e.kind() == ErrorKind::NotFound => {25println!("`{bin_name}` was not found in $PATH, skipping those checks.");26Ok(())27}28Err(e) => Err(format!("Error running `{bin_name}`: {e}")),29}30}32pub fn lint_rmtree() -> LintResult {33let found = git()34.args([35"grep",36"--line-number",37"rmtree",38"--",39"test/functional/",40":(exclude)test/functional/test_framework/test_framework.py",41])42.status()43.expect("command error")44.success();45if found {46Err(r#"47Use of shutil.rmtree() is dangerous and should be avoided. If it48is really required for the test, use self.cleanup_folder(_).49"#50.trim()51.to_string())52} else {53Ok(())54}55}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.