Skip to content

Commit 8a38df7

Browse files
committed
Merge branch 'rubberduck-vba/next' into 4349_RenameClash
2 parents 85811af + b99aa13 commit 8a38df7

File tree

15 files changed

+152
-18
lines changed

15 files changed

+152
-18
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using Rubberduck.Inspections.Abstract;
4+
using Rubberduck.Inspections.Results;
5+
using Rubberduck.Parsing.Inspections.Abstract;
6+
using Rubberduck.Resources.Inspections;
7+
using Rubberduck.Parsing.VBA;
8+
using Rubberduck.Parsing.Annotations;
9+
10+
namespace Rubberduck.Inspections.Concrete
11+
{
12+
public sealed class ModuleWithoutFolderInspection : InspectionBase
13+
{
14+
public ModuleWithoutFolderInspection(RubberduckParserState state)
15+
: base(state)
16+
{
17+
}
18+
19+
protected override IEnumerable<IInspectionResult> DoGetInspectionResults()
20+
{
21+
var modulesWithoutFolderAnnotation = State.DeclarationFinder.UserDeclarations(Parsing.Symbols.DeclarationType.Module)
22+
.Where(w => w.Annotations.All(a => a.AnnotationType != AnnotationType.Folder))
23+
.ToList();
24+
25+
return modulesWithoutFolderAnnotation.Select(declaration =>
26+
new DeclarationInspectionResult(this, string.Format(InspectionResults.ModuleWithoutFolderInspection, declaration.IdentifierName), declaration));
27+
}
28+
}
29+
}

Rubberduck.CodeAnalysis/Inspections/Concrete/UnreachableCaseInspection/UnreachableCaseInspection.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ public sealed class UnreachableCaseInspection : ParseTreeInspectionBase
2020
private readonly IUnreachableCaseInspectorFactory _unreachableCaseInspectorFactory;
2121
private readonly IParseTreeValueFactory _valueFactory;
2222

23-
private enum CaseInpectionResult { Unreachable, InherentlyUnreachable, MismatchType, Overflow, CaseElse };
23+
private enum CaseInspectionResult { Unreachable, InherentlyUnreachable, MismatchType, Overflow, CaseElse };
2424

25-
private static readonly Dictionary<CaseInpectionResult, string> ResultMessages = new Dictionary<CaseInpectionResult, string>()
25+
private static readonly Dictionary<CaseInspectionResult, string> ResultMessages = new Dictionary<CaseInspectionResult, string>()
2626
{
27-
[CaseInpectionResult.Unreachable] = InspectionResults.UnreachableCaseInspection_Unreachable,
28-
[CaseInpectionResult.InherentlyUnreachable] = InspectionResults.UnreachableCaseInspection_InherentlyUnreachable,
29-
[CaseInpectionResult.MismatchType] = InspectionResults.UnreachableCaseInspection_TypeMismatch,
30-
[CaseInpectionResult.Overflow] = InspectionResults.UnreachableCaseInspection_Overflow,
31-
[CaseInpectionResult.CaseElse] = InspectionResults.UnreachableCaseInspection_CaseElse
27+
[CaseInspectionResult.Unreachable] = InspectionResults.UnreachableCaseInspection_Unreachable,
28+
[CaseInspectionResult.InherentlyUnreachable] = InspectionResults.UnreachableCaseInspection_InherentlyUnreachable,
29+
[CaseInspectionResult.MismatchType] = InspectionResults.UnreachableCaseInspection_TypeMismatch,
30+
[CaseInspectionResult.Overflow] = InspectionResults.UnreachableCaseInspection_Overflow,
31+
[CaseInspectionResult.CaseElse] = InspectionResults.UnreachableCaseInspection_CaseElse
3232
};
3333

3434
public UnreachableCaseInspection(RubberduckParserState state) : base(state)
@@ -62,11 +62,11 @@ protected override IEnumerable<IInspectionResult> DoGetInspectionResults()
6262

6363
selectCaseInspector.InspectForUnreachableCases();
6464

65-
selectCaseInspector.UnreachableCases.ForEach(uc => CreateInspectionResult(qualifiedSelectCaseStmt, uc, ResultMessages[CaseInpectionResult.Unreachable]));
66-
selectCaseInspector.MismatchTypeCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInpectionResult.MismatchType]));
67-
selectCaseInspector.OverflowCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInpectionResult.Overflow]));
68-
selectCaseInspector.InherentlyUnreachableCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInpectionResult.InherentlyUnreachable]));
69-
selectCaseInspector.UnreachableCaseElseCases.ForEach(ce => CreateInspectionResult(qualifiedSelectCaseStmt, ce, ResultMessages[CaseInpectionResult.CaseElse]));
65+
selectCaseInspector.UnreachableCases.ForEach(uc => CreateInspectionResult(qualifiedSelectCaseStmt, uc, ResultMessages[CaseInspectionResult.Unreachable]));
66+
selectCaseInspector.MismatchTypeCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInspectionResult.MismatchType]));
67+
selectCaseInspector.OverflowCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInspectionResult.Overflow]));
68+
selectCaseInspector.InherentlyUnreachableCases.ForEach(mm => CreateInspectionResult(qualifiedSelectCaseStmt, mm, ResultMessages[CaseInspectionResult.InherentlyUnreachable]));
69+
selectCaseInspector.UnreachableCaseElseCases.ForEach(ce => CreateInspectionResult(qualifiedSelectCaseStmt, ce, ResultMessages[CaseInspectionResult.CaseElse]));
7070
}
7171
return _inspectionResults;
7272
}

Rubberduck.CodeAnalysis/Rubberduck.CodeAnalysis.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
<Compile Include="Inspections\Concrete\EmptyForEachBlockInspection.cs" />
8282
<Compile Include="Inspections\Concrete\EmptyForLoopBlockInspection.cs" />
8383
<Compile Include="Inspections\Concrete\BooleanAssignedInIfElseInspection.cs" />
84+
<Compile Include="Inspections\Concrete\ModuleWithoutFolderInspection.cs" />
8485
<Compile Include="Inspections\Concrete\EmptyWhileWendBlockInspection.cs" />
8586
<Compile Include="Inspections\Concrete\ObsoleteCallingConventionInspection.cs" />
8687
<Compile Include="Inspections\Concrete\ObsoleteErrorSyntaxInspection.cs" />

Rubberduck.Core/Properties/Settings.Designer.cs

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Core/Properties/Settings.settings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@
279279
&lt;CodeInspection Name="ObsoleteMemberUsageInspection" Severity="Warning" InspectionType="MaintainabilityAndReadabilityIssues" /&gt;
280280
&lt;CodeInspection Name="ObsoleteCallingConventionInspection" Severity="Warning" InspectionType="CodeQualityIssues" /&gt;
281281
&lt;CodeInspection Name="DuplicatedAnnotationInspection" Severity="Error" InspectionType="RubberduckOpportunities" /&gt;
282+
&lt;CodeInspection Name="ModuleWithoutFolderInspection" Severity="Suggestion" InspectionType="RubberduckOpportunities" /&gt;
282283
&lt;/CodeInspections&gt;
283284
&lt;WhitelistedIdentifiers /&gt;
284285
&lt;RunInspectionsOnSuccessfulParse&gt;true&lt;/RunInspectionsOnSuccessfulParse&gt;

Rubberduck.Core/Settings/CodeInspectionConfigProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public CodeInspectionConfigProvider(IPersistanceService<CodeInspectionSettings>
1818
_persister = persister;
1919
_foundInspectionNames = inspectionProvider.Inspections.Select(inspection => inspection.Name).ToHashSet();
2020
_defaultSettings = new DefaultSettings<CodeInspectionSettings>().Default;
21-
// Ignore settings for unknown inpections, for example when using the Experimental attribute
21+
// Ignore settings for unknown inspections, for example when using the Experimental attribute
2222
_defaultSettings.CodeInspections = _defaultSettings.CodeInspections.Where(setting => _foundInspectionNames.Contains(setting.Name)).ToHashSet();
2323

2424
var defaultNames = _defaultSettings.CodeInspections.Select(x => x.Name);

Rubberduck.Core/app.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@
402402
InspectionType="CodeQualityIssues" />
403403
<CodeInspection Name="DuplicatedAnnotationInspection" Severity="Error"
404404
InspectionType="RubberduckOpportunities" />
405+
<CodeInspection Name="ModuleWithoutFolderInspection" Severity="Suggestion"
406+
InspectionType="RubberduckOpportunities" />
405407
</CodeInspections>
406408
<WhitelistedIdentifiers />
407409
<RunInspectionsOnSuccessfulParse>true</RunInspectionsOnSuccessfulParse>

Rubberduck.Resources/Inspections/InspectionInfo.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/Inspections/InspectionInfo.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,7 @@ If the parameter can be null, ignore this inspection result; passing a null valu
334334
<data name="DuplicatedAnnotationInspection" xml:space="preserve">
335335
<value>An annotation is specified multiple times, but is intended to be specified only once.</value>
336336
</data>
337+
<data name="ModuleWithoutFolderInspection" xml:space="preserve">
338+
<value>Modules without the '@Folder' annotation cannot receive custom groupings in the Code Explorer. </value>
339+
</data>
337340
</root>

Rubberduck.Resources/Inspections/InspectionNames.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)