Skip to content

Commit d587fb3

Browse files
committed
Remove all allow flags and clean up clippy warnings
- Removed all #[allow()] attributes throughout the codebase - Fixed naming convention warning (gRPC -> GRpc) - Removed unused enum variants and dead code in Rust AST mapper - Cleaned up lifetime analysis implementation to remove unused fields and methods - Fixed compilation errors related to removed variance fields All tests pass, clippy passes without errors, and only acceptable warnings remain (dead code, unused fields for future features, complex function signatures). This improves code quality by ensuring all warnings are visible and not hidden behind allow flags, making the codebase more maintainable and following Rust best practices.
1 parent 2f8aac3 commit d587fb3

13 files changed

Lines changed: 8 additions & 226 deletions

File tree

crates/codeprism-analysis/src/duplicates.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ pub struct DuplicateSavings {
6565
/// Advanced duplicate analyzer with AST and semantic analysis
6666
pub struct DuplicateAnalyzer {
6767
/// Cache for parsed AST structures
68-
#[allow(dead_code)]
6968
ast_cache: HashMap<String, AstNode>,
7069
/// Language-specific analyzers for different programming languages
7170
language_analyzers: HashMap<String, LanguageAnalyzer>,
@@ -76,7 +75,6 @@ pub struct DuplicateAnalyzer {
7675
#[derive(Debug, Clone)]
7776
struct LanguageAnalyzer {
7877
keywords: Vec<String>,
79-
#[allow(dead_code)]
8078
operators: Vec<String>,
8179
control_structures: Vec<String>,
8280
comment_patterns: Vec<String>,

crates/codeprism-core/src/content/parsers.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,10 @@ pub struct MarkdownParser {
133133
/// Regex for code blocks
134134
code_block_regex: Regex,
135135
/// Regex for inline code
136-
#[allow(dead_code)]
137136
inline_code_regex: Regex,
138137
/// Regex for links
139-
#[allow(dead_code)]
140138
link_regex: Regex,
141139
/// Regex for lists
142-
#[allow(dead_code)]
143140
list_regex: Regex,
144141
}
145142

@@ -432,7 +429,6 @@ impl ConfigParser {
432429
}
433430

434431
/// Extract values from JSON recursively
435-
#[allow(clippy::only_used_in_recursion)]
436432
fn extract_json_values(
437433
&self,
438434
value: &Value,

crates/codeprism-core/src/linkers/symbol_resolver.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct SymbolResolver {
1818
/// Index of symbols by qualified name (module.symbol)
1919
qualified_symbols: HashMap<String, NodeId>,
2020
/// Import resolution cache
21-
#[allow(dead_code)]
2221
import_cache: HashMap<String, String>,
2322
}
2423

crates/codeprism-core/src/watcher/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ impl Debouncer {
104104
/// File system watcher
105105
pub struct FileWatcher {
106106
watcher: RecommendedWatcher,
107-
#[allow(dead_code)] // Used indirectly through Arc
108107
debouncer: Arc<Debouncer>,
109108
change_rx: mpsc::UnboundedReceiver<ChangeEvent>,
110109
watched_paths: Arc<Mutex<Vec<PathBuf>>>,

crates/codeprism-dev-tools/src/ast_visualizer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ impl AstVisualizer {
494494
}
495495

496496
/// Recursively collect AST statistics
497-
#[allow(clippy::only_used_in_recursion)]
498497
fn collect_statistics(&self, node: &Node, stats: &mut AstStatistics, depth: usize) {
499498
stats.total_nodes += 1;
500499
stats.max_depth = stats.max_depth.max(depth);
@@ -615,7 +614,6 @@ mod tests {
615614
use super::*;
616615
use tree_sitter::Parser;
617616

618-
#[allow(dead_code)]
619617
fn create_test_parser() -> Parser {
620618
// For testing, we'll use a simple language grammar
621619
// In real usage, this would use the appropriate language

crates/codeprism-dev-tools/src/diff_comparison.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ impl AstDiff {
392392
}
393393

394394
/// Calculate tree depth
395-
#[allow(clippy::only_used_in_recursion)]
396395
fn calculate_tree_depth(&self, node: &tree_sitter::Node) -> usize {
397396
let mut max_depth = 0;
398397
for i in 0..node.child_count() {

crates/codeprism-lang-js/src/analysis.rs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,6 @@ pub struct WebSocketSecurityAssessment {
580580

581581
/// WebSocket authentication methods
582582
#[derive(Debug, Clone)]
583-
#[allow(clippy::upper_case_acronyms)]
584583
pub enum WebSocketAuthMethod {
585584
Jwt,
586585
SessionBased,
@@ -612,7 +611,6 @@ pub enum ScalingStrategy {
612611
}
613612

614613
/// Advanced Node.js pattern analysis (Phase 1.3)
615-
#[allow(dead_code)]
616614
#[derive(Debug, Clone)]
617615
pub struct AdvancedNodePatternInfo {
618616
pub pattern_type: AdvancedNodePatternType,
@@ -624,7 +622,6 @@ pub struct AdvancedNodePatternInfo {
624622
}
625623

626624
/// Advanced Node.js pattern types
627-
#[allow(dead_code)]
628625
#[derive(Debug, Clone)]
629626
pub enum AdvancedNodePatternType {
630627
SecurityMiddleware,
@@ -637,7 +634,6 @@ pub enum AdvancedNodePatternType {
637634
}
638635

639636
/// Middleware information
640-
#[allow(dead_code)]
641637
#[derive(Debug, Clone)]
642638
pub struct MiddlewareInfo {
643639
pub name: String,
@@ -649,7 +645,6 @@ pub struct MiddlewareInfo {
649645
}
650646

651647
/// Middleware types
652-
#[allow(dead_code)]
653648
#[derive(Debug, Clone)]
654649
pub enum MiddlewareType {
655650
Authentication,
@@ -665,7 +660,6 @@ pub enum MiddlewareType {
665660
}
666661

667662
/// Error handling pattern information
668-
#[allow(dead_code)]
669663
#[derive(Debug, Clone)]
670664
pub struct ErrorHandlingPattern {
671665
pub pattern_type: ErrorHandlingType,
@@ -676,7 +670,6 @@ pub struct ErrorHandlingPattern {
676670
}
677671

678672
/// Error handling types
679-
#[allow(dead_code)]
680673
#[derive(Debug, Clone)]
681674
pub enum ErrorHandlingType {
682675
TryCatch,
@@ -689,7 +682,6 @@ pub enum ErrorHandlingType {
689682
}
690683

691684
/// Error classification
692-
#[allow(dead_code)]
693685
#[derive(Debug, Clone)]
694686
pub struct ErrorClassification {
695687
pub error_type: ErrorType,
@@ -699,8 +691,6 @@ pub struct ErrorClassification {
699691
}
700692

701693
/// Error types
702-
#[allow(dead_code)]
703-
#[allow(clippy::enum_variant_names)]
704694
#[derive(Debug, Clone)]
705695
pub enum ErrorType {
706696
ValidationError,
@@ -714,7 +704,6 @@ pub enum ErrorType {
714704
}
715705

716706
/// Error severity levels
717-
#[allow(dead_code)]
718707
#[derive(Debug, Clone)]
719708
pub enum ErrorSeverity {
720709
Critical,
@@ -725,7 +714,6 @@ pub enum ErrorSeverity {
725714
}
726715

727716
/// User impact levels
728-
#[allow(dead_code)]
729717
#[derive(Debug, Clone)]
730718
pub enum UserImpact {
731719
ServiceUnavailable,
@@ -735,7 +723,6 @@ pub enum UserImpact {
735723
}
736724

737725
/// Performance indicator for advanced patterns
738-
#[allow(dead_code)]
739726
#[derive(Debug, Clone)]
740727
pub struct PerformanceIndicator {
741728
pub indicator_type: PerformanceType,
@@ -746,8 +733,6 @@ pub struct PerformanceIndicator {
746733
}
747734

748735
/// Performance types
749-
#[allow(dead_code)]
750-
#[allow(clippy::upper_case_acronyms)]
751736
#[derive(Debug, Clone)]
752737
pub enum PerformanceType {
753738
Memory,
@@ -761,7 +746,6 @@ pub enum PerformanceType {
761746
}
762747

763748
/// Performance metrics
764-
#[allow(dead_code)]
765749
#[derive(Debug, Clone)]
766750
pub struct PerformanceMetrics {
767751
pub response_time: Option<f64>,
@@ -772,7 +756,6 @@ pub struct PerformanceMetrics {
772756
}
773757

774758
/// Microservice pattern information
775-
#[allow(dead_code)]
776759
#[derive(Debug, Clone)]
777760
pub struct MicroservicePattern {
778761
pub pattern_name: String,
@@ -783,21 +766,17 @@ pub struct MicroservicePattern {
783766
}
784767

785768
/// Service communication patterns
786-
#[allow(dead_code)]
787-
#[allow(clippy::upper_case_acronyms)]
788-
#[allow(non_camel_case_types)]
789769
#[derive(Debug, Clone)]
790770
pub enum ServiceCommunication {
791771
Http,
792772
GraphQL,
793-
gRPC,
773+
GRpc,
794774
MessageQueue,
795775
EventStream,
796776
WebSocket,
797777
}
798778

799779
/// Data consistency patterns
800-
#[allow(dead_code)]
801780
#[derive(Debug, Clone)]
802781
pub enum DataConsistency {
803782
Strong,
@@ -808,7 +787,6 @@ pub enum DataConsistency {
808787
}
809788

810789
/// Fault tolerance patterns
811-
#[allow(dead_code)]
812790
#[derive(Debug, Clone)]
813791
pub enum FaultTolerance {
814792
CircuitBreaker,
@@ -820,7 +798,6 @@ pub enum FaultTolerance {
820798
}
821799

822800
/// Monitoring levels
823-
#[allow(dead_code)]
824801
#[derive(Debug, Clone)]
825802
pub enum MonitoringLevel {
826803
Comprehensive,
@@ -830,7 +807,6 @@ pub enum MonitoringLevel {
830807
}
831808

832809
/// Database pattern information
833-
#[allow(dead_code)]
834810
#[derive(Debug, Clone)]
835811
pub struct DatabasePattern {
836812
pub database_type: DatabaseType,
@@ -841,7 +817,6 @@ pub struct DatabasePattern {
841817
}
842818

843819
/// Database types
844-
#[allow(dead_code)]
845820
#[derive(Debug, Clone)]
846821
pub enum DatabaseType {
847822
PostgreSQL,
@@ -855,8 +830,6 @@ pub enum DatabaseType {
855830
}
856831

857832
/// Database access patterns
858-
#[allow(dead_code)]
859-
#[allow(clippy::upper_case_acronyms)]
860833
#[derive(Debug, Clone)]
861834
pub enum DatabaseAccessPattern {
862835
DirectAccess,
@@ -868,7 +841,6 @@ pub enum DatabaseAccessPattern {
868841
}
869842

870843
/// Optimization levels
871-
#[allow(dead_code)]
872844
#[derive(Debug, Clone)]
873845
pub enum OptimizationLevel {
874846
High,
@@ -878,7 +850,6 @@ pub enum OptimizationLevel {
878850
}
879851

880852
/// Connection management patterns
881-
#[allow(dead_code)]
882853
#[derive(Debug, Clone)]
883854
pub enum ConnectionManagement {
884855
Pool,
@@ -889,8 +860,6 @@ pub enum ConnectionManagement {
889860
}
890861

891862
/// Transaction handling patterns
892-
#[allow(dead_code)]
893-
#[allow(clippy::upper_case_acronyms)]
894863
#[derive(Debug, Clone)]
895864
pub enum TransactionHandling {
896865
Acid,
@@ -907,18 +876,12 @@ pub struct JavaScriptAnalyzer {
907876
react_patterns: HashMap<String, Regex>,
908877
nodejs_patterns: HashMap<String, Regex>,
909878
typescript_patterns: HashMap<String, Regex>,
910-
#[allow(dead_code)]
911879
vue_patterns: HashMap<String, Regex>,
912-
#[allow(dead_code)]
913880
angular_patterns: HashMap<String, Regex>,
914881
// Phase 1.3 additions
915-
#[allow(dead_code)]
916882
security_patterns: HashMap<String, Regex>,
917-
#[allow(dead_code)]
918883
performance_patterns: HashMap<String, Regex>,
919-
#[allow(dead_code)]
920884
websocket_patterns: HashMap<String, Regex>,
921-
#[allow(dead_code)]
922885
advanced_typescript_patterns: HashMap<String, Regex>,
923886
}
924887

@@ -1659,7 +1622,6 @@ impl JavaScriptAnalyzer {
16591622
}
16601623
}
16611624

1662-
#[allow(dead_code)]
16631625
fn extract_route_parameters(&self, path: &str) -> Vec<String> {
16641626
let param_pattern = Regex::new(r":(\w+)").unwrap();
16651627
param_pattern

crates/codeprism-lang-python/src/analysis.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ pub struct TypeHintInfo {
400400

401401
/// Type hint types
402402
#[derive(Debug, Clone)]
403-
#[allow(clippy::enum_variant_names)]
404403
pub enum TypeHintType {
405404
SimpleType(String), // int, str, bool
406405
UnionType(Vec<String>), // Union[str, int] or str | int
@@ -1116,7 +1115,6 @@ pub enum LicenseCompatibility {
11161115
struct DependencyPattern {
11171116
name: String,
11181117
pattern: Regex,
1119-
#[allow(dead_code)]
11201118
file_type: RequirementsFileType,
11211119
extraction_method: String,
11221120
}
@@ -1541,7 +1539,6 @@ pub enum FeatureComplexity {
15411539
struct ModernFeaturePattern {
15421540
name: String,
15431541
pattern: Regex,
1544-
#[allow(dead_code)]
15451542
feature_type: String,
15461543
python_version: String,
15471544
complexity: FeatureComplexity,
@@ -1571,15 +1568,13 @@ struct DecoratorPattern {
15711568

15721569
#[derive(Debug, Clone)]
15731570
struct MetaclassPattern {
1574-
#[allow(dead_code)]
15751571
name: String,
15761572
pattern: Regex,
15771573
impact: String,
15781574
}
15791575

15801576
#[derive(Debug, Clone)]
15811577
struct SecurityPattern {
1582-
#[allow(dead_code)]
15831578
name: String,
15841579
pattern: Regex,
15851580
vulnerability_type: VulnerabilityType,
@@ -1589,7 +1584,6 @@ struct SecurityPattern {
15891584

15901585
#[derive(Debug, Clone)]
15911586
struct PerformancePattern {
1592-
#[allow(dead_code)]
15931587
name: String,
15941588
pattern: Regex,
15951589
optimization_type: OptimizationType,
@@ -1599,7 +1593,6 @@ struct PerformancePattern {
15991593

16001594
#[derive(Debug, Clone)]
16011595
struct FrameworkPattern {
1602-
#[allow(dead_code)]
16031596
name: String,
16041597
pattern: Regex,
16051598
framework: String,
@@ -4016,7 +4009,6 @@ impl PythonAnalyzer {
40164009
}
40174010

40184011
/// Calculate overall modernity score
4019-
#[allow(clippy::too_many_arguments)]
40204012
fn calculate_modernity_score(
40214013
&self,
40224014
dataclass_features: &[DataclassInfo],
@@ -4042,7 +4034,6 @@ impl PythonAnalyzer {
40424034
}
40434035

40444036
/// Generate modern feature recommendations
4045-
#[allow(clippy::too_many_arguments)]
40464037
fn get_modern_feature_recommendations(
40474038
&self,
40484039
dataclass_features: &[DataclassInfo],

0 commit comments

Comments
 (0)