**Progress: 1,178 → 57 test errors (95% reduction)** ## Status Summary - ✅ Production code: Compiles cleanly (0 errors) - ⚠️ Test code: 57 errors remain (massive improvement) - ⚙️ All services build successfully - 📊 Warning count: 253 (target: <20) - AGENTS WILL FIX ## Remaining Test Errors (57 total) ### Primary Issues: 1. 23× E0308 mismatched types 2. 17× E0433 undeclared Decimal 3. 15× E0433 compliance module not found 4. 6× E0624 private method access 5. Various import and type issues ## Next Phase: Wave 33-2 Launch 10+ parallel agents to: - Fix remaining 57 test compilation errors - Reduce 253 warnings to <20 - Achieve 95% test coverage - Ensure all tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
165 lines
7.2 KiB
TOML
165 lines
7.2 KiB
TOML
# Rustfmt Configuration for Foxhunt HFT System
|
|
# IMPORT STANDARDIZATION AND TYPE GOVERNANCE SUPPORT
|
|
|
|
# =============================================================================
|
|
# 🎯 IMPORT ORGANIZATION - CRITICAL FOR TYPE GOVERNANCE
|
|
# =============================================================================
|
|
|
|
# Group imports to enforce canonical type usage patterns
|
|
imports_granularity = "Module" # Group by module for clarity
|
|
group_imports = "StdExternalCrate" # Separate std, external, and local
|
|
imports_layout = "Vertical" # Vertical layout for readability
|
|
|
|
# =============================================================================
|
|
# 📋 STANDARD IMPORT ORDER FOR ALL CRATES
|
|
# =============================================================================
|
|
#
|
|
# This order enforces the type governance hierarchy:
|
|
# 1. Standard library (std::)
|
|
# 2. External crates (serde, tokio, etc.)
|
|
# 3. Prelude import (trading_engine::types::prelude::*)
|
|
# 4. Configuration imports (config::*)
|
|
# 5. Local crate imports
|
|
# 6. Generated code imports (proto, etc.)
|
|
|
|
# =============================================================================
|
|
# 🔒 TYPE GOVERNANCE FORMATTING RULES
|
|
# =============================================================================
|
|
|
|
# Force prelude imports to be clearly visible
|
|
reorder_imports = true # Automatic import reordering
|
|
reorder_modules = true # Module order consistency
|
|
merge_imports = false # Keep imports separate for clarity
|
|
|
|
# Ensure wildcard imports (required for prelude) are formatted consistently
|
|
use_small_heuristics = "Max" # Better formatting decisions
|
|
|
|
# =============================================================================
|
|
# 📏 LINE LENGTH AND WRAPPING
|
|
# =============================================================================
|
|
|
|
max_width = 100 # Consistent with HFT code standards
|
|
hard_tabs = false # Use spaces for consistency
|
|
tab_spaces = 4 # 4-space indentation
|
|
|
|
# Import-specific line handling
|
|
use_try_shorthand = true # Use ? operator
|
|
imports_indent = "Block" # Indent wrapped imports
|
|
merge_derives = true # Combine #[derive(...)] attributes
|
|
|
|
# =============================================================================
|
|
# 🧹 CODE STRUCTURE FOR MAINTAINABILITY
|
|
# =============================================================================
|
|
|
|
# Function and type formatting that supports type governance
|
|
fn_args_layout = "Tall" # Vertical function arguments
|
|
brace_style = "SameLineWhere" # Consistent brace placement
|
|
where_single_line = true # Compact where clauses when possible
|
|
|
|
# Struct and enum formatting (important for canonical types)
|
|
struct_field_align_threshold = 20 # Align fields in structs
|
|
enum_discrim_align_threshold = 20 # Align enum discriminants
|
|
use_field_init_shorthand = true # Use shorthand field initialization
|
|
|
|
# =============================================================================
|
|
# 📝 DOCUMENTATION AND COMMENTS
|
|
# =============================================================================
|
|
|
|
# Ensure type governance documentation is preserved
|
|
format_code_in_doc_comments = true # Format code examples
|
|
wrap_comments = true # Wrap long comments
|
|
comment_width = 80 # Comment line length
|
|
normalize_comments = true # Consistent comment formatting
|
|
normalize_doc_attributes = true # Consistent doc attributes
|
|
|
|
# =============================================================================
|
|
# ⚡ HFT-SPECIFIC FORMATTING
|
|
# =============================================================================
|
|
|
|
# Performance-critical code formatting
|
|
single_line_if_else_max_width = 50 # Compact conditionals
|
|
force_multiline_blocks = false # Allow compact blocks
|
|
overflow_delimited_expr = true # Handle long expressions
|
|
|
|
# Match expression formatting (common in trading logic)
|
|
match_block_trailing_comma = true # Consistent comma usage
|
|
match_arm_blocks = false # Compact match arms where possible
|
|
newline_style = "Unix" # Consistent line endings
|
|
|
|
# =============================================================================
|
|
# 🎨 VISUAL ORGANIZATION
|
|
# =============================================================================
|
|
|
|
# Make type governance violations more visible through formatting
|
|
blank_lines_lower_bound = 0 # Minimum blank lines
|
|
blank_lines_upper_bound = 2 # Maximum blank lines
|
|
empty_item_single_line = false # No empty items on single line
|
|
|
|
# Indent and alignment for complex types
|
|
array_width = 60 # Array formatting threshold
|
|
attr_fn_like_width = 70 # Attribute formatting
|
|
chain_width = 60 # Method chain formatting
|
|
fn_call_width = 60 # Function call formatting
|
|
struct_lit_width = 18 # Struct literal formatting
|
|
struct_variant_width = 35 # Enum struct variant formatting
|
|
|
|
# =============================================================================
|
|
# 🔧 MACRO AND SPECIAL SYNTAX
|
|
# =============================================================================
|
|
|
|
# Handle Rust macros (common in HFT for performance)
|
|
format_macro_matchers = true # Format macro matchers
|
|
format_macro_bodies = true # Format macro bodies
|
|
macro_use_wildcards = false # Explicit macro imports
|
|
|
|
# Generated code formatting (protobuf, etc.)
|
|
format_generated_files = false # Don't format generated files
|
|
skip_children = false # Format all Rust files
|
|
|
|
# =============================================================================
|
|
# 🚨 TYPE GOVERNANCE INTEGRATION
|
|
# =============================================================================
|
|
|
|
# These settings specifically support type governance:
|
|
|
|
# 1. Import grouping makes prelude imports clearly visible
|
|
# 2. Consistent formatting helps identify duplicate type definitions
|
|
# 3. Documentation formatting preserves governance comments
|
|
# 4. Line length and structure support code review for violations
|
|
|
|
# =============================================================================
|
|
# 🎯 VALIDATION AND ENFORCEMENT
|
|
# =============================================================================
|
|
|
|
# Integration with type governance validation:
|
|
# - CI runs `cargo fmt --check` to ensure consistent formatting
|
|
# - Consistent imports make duplicate detection easier
|
|
# - Clear structure supports code review for governance violations
|
|
|
|
# =============================================================================
|
|
# 🏗️ EXAMPLES OF ENFORCED PATTERNS
|
|
# =============================================================================
|
|
#
|
|
# Standard service import pattern:
|
|
# ```rust
|
|
# use std::collections::HashMap;
|
|
# use std::time::Duration;
|
|
#
|
|
# use serde::{Deserialize, Serialize};
|
|
# use tokio::sync::RwLock;
|
|
#
|
|
# use trading_engine::types::prelude::*; // CANONICAL TYPES
|
|
# use config::*; // CONFIGURATION ONLY
|
|
#
|
|
# use crate::repository::OrderRepository;
|
|
# use crate::service::OrderService;
|
|
# ```
|
|
#
|
|
# Test import pattern:
|
|
# ```rust
|
|
# use std::time::SystemTime;
|
|
#
|
|
# use trading_engine::types::prelude::*; // CANONICAL TYPES ONLY
|
|
#
|
|
# use crate::test_utils::*;
|
|
# ``` |