Skip to content

Commit 064b43a

Browse files
committed
Remove Inspection Result Aggregation
The original rationale for inspection result aggregation was the excessive memory use when displaying them. Since the rework of the Inspections view, this is no longer an issue. As such aggregation, which has multiple issues is removed in this commit. This change makes the following issues completely obsolete and fixes them that way: fixes #4561, fixes #3597, fixes #3172, fixes #2900, fixes #4870
1 parent c04951a commit 064b43a

File tree

3 files changed

+5
-98
lines changed

3 files changed

+5
-98
lines changed

Rubberduck.CodeAnalysis/Inspections/Inspector.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public class Inspector : IInspector
3030

3131
private readonly IGeneralConfigService _configService;
3232
private readonly List<IInspection> _inspections;
33-
private const int AGGREGATION_THRESHOLD = 128;
3433

3534
public Inspector(IGeneralConfigService configService, IInspectionProvider inspectionProvider)
3635
{
@@ -42,8 +41,8 @@ public Inspector(IGeneralConfigService configService, IInspectionProvider inspec
4241

4342
private void ConfigServiceSettingsChanged(object sender, EventArgs e)
4443
{
45-
//var config = _configService.LoadConfiguration();
46-
//UpdateInspectionSeverity(config);
44+
var config = _configService.LoadConfiguration();
45+
UpdateInspectionSeverity(config);
4746
}
4847

4948
private void UpdateInspectionSeverity(Configuration config)
@@ -133,16 +132,9 @@ public async Task<IEnumerable<IInspectionResult>> FindIssuesAsync(RubberduckPars
133132
LogManager.GetCurrentClassLogger().Error(e);
134133
}
135134

136-
var issuesByType = allIssues.GroupBy(issue => issue.Inspection.Name)
137-
.ToDictionary(grouping => grouping.Key, grouping => grouping.ToList());
138-
var results = issuesByType.Where(kv => kv.Value.Count <= AGGREGATION_THRESHOLD)
139-
.SelectMany(kv => kv.Value)
140-
.Union(issuesByType.Where(kv => kv.Value.Count > AGGREGATION_THRESHOLD)
141-
.Select(kv => new AggregateInspectionResult(kv.Value.OrderBy(i => i.QualifiedSelection).First(), kv.Value.Count)))
142-
.ToList();
143-
144-
state.OnStatusMessageUpdate(RubberduckUI.ResourceManager.GetString("ParserState_" + state.Status, CultureInfo.CurrentUICulture)); // should be "Ready"
145-
return results;
135+
// should be "Ready"
136+
state.OnStatusMessageUpdate(RubberduckUI.ResourceManager.GetString("ParserState_" + state.Status, CultureInfo.CurrentUICulture));
137+
return allIssues;
146138
}
147139

148140
private static bool RequiredLibrariesArePresent(IInspection inspection, RubberduckParserState state)

Rubberduck.Core/UI/Inspections/AggregateInspectionResult.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

RubberduckTests/Inspections/InspectionResultTests.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,5 @@ public void IdentifierReferenceInspectionResultsAreNotDeemedInvalidatedIfNeither
176176

177177
Assert.IsFalse(inspectionResult.ChangesInvalidateResult(modifiedModules));
178178
}
179-
180-
[Test]
181-
public void AggregateInspectionResultsAreAlwaysDeemedInvalidated()
182-
{
183-
var inspectionMock = new Mock<IInspection>();
184-
inspectionMock
185-
.Setup(m =>
186-
m.ChangesInvalidateResult(It.IsAny<IInspectionResult>(),
187-
It.IsAny<ICollection<QualifiedModuleName>>()))
188-
.Returns(false);
189-
190-
var module = new QualifiedModuleName("project", string.Empty, "module");
191-
var otherModule = new QualifiedModuleName("project", string.Empty, "otherModule");
192-
var context = new QualifiedContext(module, null);
193-
var modifiedModules = new HashSet<QualifiedModuleName> { otherModule };
194-
195-
var baseInspectionResult = new QualifiedContextInspectionResult(inspectionMock.Object, string.Empty, context);
196-
var inspectionResult = new AggregateInspectionResult(baseInspectionResult, 42);
197-
198-
Assert.IsTrue(inspectionResult.ChangesInvalidateResult(modifiedModules));
199-
}
200179
}
201180
}

0 commit comments

Comments
 (0)