Check Rust code formatting.
(self)
| 89 | return all_passed |
| 90 | |
| 91 | def _check_rust_formatting(self) -> Tuple[bool, str, Optional[str]]: |
| 92 | """Check Rust code formatting.""" |
| 93 | try: |
| 94 | cargo_path = shutil.which("cargo") |
| 95 | if not cargo_path: |
| 96 | raise FileNotFoundError("cargo executable not found in PATH") |
| 97 | result = subprocess.run([cargo_path, "fmt", "--all", "--", "--check"], capture_output=True, text=True, cwd=self.root_path, timeout=120, shell=False) # nosec |
| 98 | |
| 99 | return result.returncode == 0, result.stdout, result.stderr if result.returncode != 0 else None |
| 100 | |
| 101 | except subprocess.TimeoutExpired: |
| 102 | return False, "", "Rust formatting check timed out" |
| 103 | except Exception as e: |
| 104 | return False, "", str(e) |
| 105 | |
| 106 | def _check_rust_linting(self) -> Tuple[bool, str, Optional[str]]: |
| 107 | """Check Rust code with clippy.""" |