1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#![cfg_attr(coverage_nightly, coverage(off))]
//! Refactoring state machine and operation models.
//!
//! This module defines the state machine that orchestrates the automated
//! refactoring process. The state machine ensures refactoring operations
//! are applied systematically with proper validation at each step.
//!
//! # State Machine Flow
//!
//! 1. **Scan**: Identify target files for refactoring
//! 2. **Analyze**: Analyze code quality metrics
//! 3. **Plan**: Generate refactoring plan based on violations
//! 4. **Refactor**: Apply refactoring operations
//! 5. **Test**: Run tests to validate changes
//! 6. **Lint**: Check code style and quality
//! 7. **Emit**: Report results
//! 8. **Complete**: Summarize refactoring session
//!
//! # Example
//!
//! ```
//! use pmat::models::refactor::{RefactorStateMachine, RefactorConfig, State};
//! use std::path::PathBuf;
//!
//! let config = RefactorConfig::default();
//! let targets = vec![PathBuf::from("src/complex_module.rs")];
//!
//! let mut state_machine = RefactorStateMachine::new(targets, config);
//!
//! // Start with scanning
//! match &state_machine.current {
//! State::Scan { targets } => {
//! println!("Scanning {} files", targets.len());
//! }
//! _ => {}
//! }
//! ```
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
// Type definitions: structs, enums, and repr types
include!("refactor_types.rs");
// Impl blocks: Default impls, RefactorStateMachine, Violation::to_op
include!("refactor_impls.rs");
// Unit tests
#[cfg_attr(coverage_nightly, coverage(off))]
#[cfg(test)]
mod tests {
use super::*;
include!("refactor_tests.rs");
include!("refactor_tests_part2.rs");
}
// Property-based tests
include!("refactor_property_tests.rs");