@@ -27,7 +27,7 @@ public void SaveConfiguration<T>(T toSerialize)
27
27
}
28
28
29
29
/// <summary> Loads the configuration from Rubberduck.config xml file. </summary>
30
- /// <remarks> If an IOException occurs returns a default configuration.</remarks>
30
+ /// <remarks> If an IOException occurs, returns a default configuration.</remarks>
31
31
public Configuration LoadConfiguration ( )
32
32
{
33
33
try
@@ -49,7 +49,11 @@ public Configuration LoadConfiguration()
49
49
config . UserSettings . CodeInspectionSettings = new CodeInspectionSettings ( GetDefaultCodeInspections ( ) ) ;
50
50
}
51
51
52
- //todo: check for implemented inspections that aren't in config file
52
+ var implementedInspections = GetImplementedCodeInspections ( ) ;
53
+ var configInspections = config . UserSettings . CodeInspectionSettings . CodeInspections . ToList ( ) ;
54
+
55
+ configInspections = MergeImplementedInspectionsNotInConfig ( configInspections , implementedInspections ) ;
56
+ config . UserSettings . CodeInspectionSettings . CodeInspections = configInspections . ToArray ( ) ;
53
57
54
58
return config ;
55
59
}
@@ -80,6 +84,29 @@ public Configuration LoadConfiguration()
80
84
}
81
85
}
82
86
87
+ private List < CodeInspection > MergeImplementedInspectionsNotInConfig ( List < CodeInspection > configInspections , IList < IInspection > implementedInspections )
88
+ {
89
+ bool found ;
90
+ foreach ( var implementedInspection in implementedInspections )
91
+ {
92
+ found = false ;
93
+ foreach ( var configInspection in configInspections )
94
+ {
95
+ if ( implementedInspection . Name == configInspection . Name )
96
+ {
97
+ found = true ;
98
+ break ;
99
+ }
100
+ }
101
+
102
+ if ( ! found )
103
+ {
104
+ configInspections . Add ( new CodeInspection ( implementedInspection ) ) ;
105
+ }
106
+ }
107
+ return configInspections ;
108
+ }
109
+
83
110
public Configuration GetDefaultConfiguration ( )
84
111
{
85
112
var userSettings = new UserSettings (
0 commit comments