Skip to content

Commit 7123ca8

Browse files
committed
Fix inspections reset
1 parent b4c7371 commit 7123ca8

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

RetailCoder.VBE/Inspections/IInspectionModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public interface IInspectionModel
2222
/// </summary>
2323
CodeInspectionType InspectionType { get; }
2424

25+
/// <summary>
26+
/// Gets a value indicating the default severity level of the code inspection.
27+
/// </summary>
28+
CodeInspectionSeverity DefaultSeverity { get; }
29+
2530
/// <summary>
2631
/// Gets a value indicating the severity level of the code inspection.
2732
/// </summary>

RetailCoder.VBE/Settings/CodeInspectionSettings.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public class CodeInspectionSetting : IInspectionModel
3434
[XmlIgnore]
3535
public string AnnotationName { get; set; }
3636

37+
[XmlIgnore]
38+
public CodeInspectionSeverity DefaultSeverity { get; private set; }
39+
3740
[XmlAttribute]
3841
public CodeInspectionSeverity Severity { get; set; }
3942

@@ -76,16 +79,17 @@ public CodeInspectionSetting()
7679
//default constructor required for serialization
7780
}
7881

79-
public CodeInspectionSetting(string name, string description, CodeInspectionType type, CodeInspectionSeverity severity)
82+
public CodeInspectionSetting(string name, string description, CodeInspectionType type, CodeInspectionSeverity defaultSeverity, CodeInspectionSeverity severity)
8083
{
8184
Name = name;
8285
Description = description;
8386
InspectionType = type;
8487
Severity = severity;
88+
DefaultSeverity = defaultSeverity;
8589
}
8690

8791
public CodeInspectionSetting(IInspectionModel inspection)
88-
: this(inspection.Name, inspection.Description, inspection.InspectionType, inspection.Severity)
92+
: this(inspection.Name, inspection.Description, inspection.InspectionType, inspection.DefaultSeverity, inspection.Severity)
8993
{ }
9094
}
9195
}

RetailCoder.VBE/Settings/ConfigurationLoader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using System.Text;
66
using System.Windows.Forms;
77
using Rubberduck.Inspections;
8-
using Rubberduck.SmartIndenter;
9-
using Rubberduck.ToDoItems;
108
using Rubberduck.UI;
119
using MessageBox = System.Windows.Forms.MessageBox;
1210

@@ -157,7 +155,9 @@ public ToDoMarker[] GetDefaultTodoMarkers()
157155
/// <returns> An array of Config.CodeInspection. </returns>
158156
public CodeInspectionSetting[] GetDefaultCodeInspections()
159157
{
160-
return _inspections.Select(x => new CodeInspectionSetting(x)).ToArray();
158+
return _inspections.Select(x =>
159+
new CodeInspectionSetting(x.Name, x.Description, x.InspectionType, x.DefaultSeverity,
160+
x.DefaultSeverity)).ToArray();
161161
}
162162

163163
public IndenterSettings GetDefaultIndenterSettings()

RetailCoder.VBE/UI/Settings/InspectionSettings.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
HeadersVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
5151
ColumnHeaderHeight="22" BorderThickness="0">
5252
<controls:GroupingGrid.Columns>
53-
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=NameLabelText}" Width="2.75*" IsReadOnly="True">
53+
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=NameLabelText}" Width="2.75*" IsReadOnly="True" SortMemberPath="{Binding Description}">
5454
<DataGridTemplateColumn.CellTemplate>
5555
<DataTemplate>
5656
<TextBlock Text="{Binding Description}">

RubberduckTests/ConfigurationTests.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Moq;
33
using Rubberduck.Inspections;
44
using Rubberduck.Settings;
5-
using Rubberduck.ToDoItems;
65

76
namespace RubberduckTests
87
{
@@ -24,9 +23,9 @@ public void GetDefaultTodoMarkersTest()
2423
public void DefaultCodeInspectionsIsAsSpecified()
2524
{
2625
var inspection = new Mock<IInspection>();
27-
//inspection.SetupGet(m => m.Description).Returns("TestInspection");
28-
//inspection.SetupGet(m => m.Name).Returns("TestInspection");
29-
//inspection.SetupGet(m => m.Severity).Returns(CodeInspectionSeverity.DoNotShow);
26+
inspection.SetupGet(m => m.Description).Returns("TestInspection");
27+
inspection.SetupGet(m => m.Name).Returns("TestInspection");
28+
inspection.SetupGet(m => m.Severity).Returns(CodeInspectionSeverity.DoNotShow);
3029

3130
var expected = new[] { inspection.Object };
3231
var configService = new ConfigurationLoader(expected);

0 commit comments

Comments
 (0)