Skip to main content

testing_conventions/
violation.rs

1//! The shared `Violation` type emitted by the deterministic test-code lints.
2//!
3//! Both the Python `lint` module and the Rust `isolation` module report findings
4//! as a [`Violation`], so the CLI prints every rule the same way
5//! (`path:line: rule — message`). Hoisted here (#44) so neither lint module owns
6//! the other's type.
7
8use std::path::PathBuf;
9
10/// A single lint violation found in a test file.
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct Violation {
13    /// File the violation was found in.
14    pub file: PathBuf,
15    /// 1-based line number of the offending construct.
16    pub line: usize,
17    /// Short lint identifier (e.g. `no-monkeypatch`, `no-out-of-module-call`).
18    pub rule: &'static str,
19    /// Human-readable explanation.
20    pub message: String,
21}