ferrous_forge/standards/
defaults.rs

1//! Default implementations for coding standards
2
3use super::types::*;
4
5impl Default for CodingStandards {
6    fn default() -> Self {
7        Self {
8            edition: EditionStandards {
9                required_edition: "2024".to_string(),
10                min_rust_version: "1.82.0".to_string(),
11                auto_upgrade: false,
12            },
13            file_limits: FileLimits {
14                max_lines: 300,
15                max_line_length: 100,
16                exempt_files: vec!["tests.rs".to_string(), "benches.rs".to_string()],
17            },
18            function_limits: FunctionLimits {
19                max_lines: 50,
20                max_complexity: 10,
21                exempt_functions: vec!["main".to_string(), "test_*".to_string()],
22            },
23            documentation: DocumentationStandards {
24                require_public_docs: true,
25                require_private_docs: false,
26                min_coverage: 80.0,
27                require_examples: false,
28            },
29            banned_patterns: BannedPatterns {
30                ban_unwrap: true,
31                ban_expect: true,
32                ban_panic: true,
33                ban_todo: true,
34                ban_unimplemented: true,
35                ban_underscore_bandaid: true,
36                custom_patterns: vec![
37                    BannedPattern {
38                        name: "print_debug".to_string(),
39                        pattern: r"(println!|print!|eprintln!|eprint!|dbg!)".to_string(),
40                        message: "Debug print statements should not be in production code"
41                            .to_string(),
42                        severity: "warning".to_string(),
43                    },
44                    BannedPattern {
45                        name: "sleep_in_async".to_string(),
46                        pattern: r"std::thread::sleep".to_string(),
47                        message: "Use tokio::time::sleep in async code".to_string(),
48                        severity: "error".to_string(),
49                    },
50                ],
51            },
52            dependencies: DependencyStandards {
53                max_dependencies: 100,
54                require_license_check: true,
55                banned_licenses: vec!["GPL-3.0".to_string(), "AGPL-3.0".to_string()],
56                require_msrv_compatible: true,
57            },
58            security: SecurityStandards {
59                ban_unsafe: true,
60                require_audit: true,
61                max_cve_score: 7.0,
62            },
63        }
64    }
65}