Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck i…
…nto ExtractMethod Amended the RubberduckTests.csproj to exclude broken tests to allow building and aid in testing the test modules being worked upon. The section in the csproj should be removed once all tests are updated. # Conflicts: # Rubberduck.Core/Rubberduck.Core.csproj # Rubberduck.Main/Rubberduck.Main.csproj # Rubberduck.Refactorings/Rubberduck.Refactorings.csproj # RubberduckTests/Properties/AssemblyInfo.cs # RubberduckTests/RubberduckTests.csproj
- Loading branch information
Showing
164 changed files
with
3,705 additions
and
47,528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<Product>Rubberduck.API</Product> | ||
<Description>Rubberduck Reflection API</Description> | ||
<Copyright>Copyright © 2018</Copyright> | ||
<ProjectGuid>{AC1B4A57-364A-4F90-A0CD-6EE818349CE5}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>Rubberduck.API</RootNamespace> | ||
<AssemblyName>Rubberduck.API</AssemblyName> | ||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
<!-- | ||
TODO: affix AssemblyVersion and/or FileVersion for COM-Registration?! | ||
--> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="VBA\ApiProvider.cs" /> | ||
<Compile Include="VBA\Accessibility.cs" /> | ||
<Compile Include="VBA\Declaration.cs" /> | ||
<Compile Include="VBA\Declarations.cs" /> | ||
<Compile Include="VBA\DeclarationType.cs" /> | ||
<Compile Include="VBA\IdentifierReference.cs" /> | ||
<Compile Include="VBA\IdentifierReferences.cs" /> | ||
<Compile Include="VBA\Parser.cs" /> | ||
<Compile Include="VBA\ParserState.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Rubberduck.Core\Rubberduck.Core.csproj"> | ||
<Project>{a1587eac-7b54-407e-853f-4c7493d0323e}</Project> | ||
<Name>Rubberduck.Core</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rubberduck.Main\Rubberduck.Main.csproj"> | ||
<Project>{E8AB5D93-2D0F-423D-BC15-5EE118673E48}</Project> | ||
<Name>Rubberduck.Main</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rubberduck.Parsing\Rubberduck.Parsing.csproj"> | ||
<Project>{a4a618e1-cbca-435f-9c6c-5181e030adfc}</Project> | ||
<Name>Rubberduck.Parsing</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rubberduck.Resources\Rubberduck.Resources.csproj"> | ||
<Project>{1b84b387-f7c4-4876-9bdf-c644c365359a}</Project> | ||
<Name>Rubberduck.Resources</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\Rubberduck.VBEEditor\Rubberduck.VBEditor.csproj"> | ||
<Project>{8ce35eb3-8852-4ba1-84dd-df3f5d2967b0}</Project> | ||
<Name>Rubberduck.VBEditor</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="..\RubberduckBaseProject.csproj" /> | ||
|
||
<ItemGroup> | ||
<Folder Include="Plugin\" /> | ||
<ProjectReference Include="..\Rubberduck.Core\Rubberduck.Core.csproj" /> | ||
<ProjectReference Include="..\Rubberduck.Main\Rubberduck.Main.csproj" /> | ||
<ProjectReference Include="..\Rubberduck.Parsing\Rubberduck.Parsing.csproj" /> | ||
<ProjectReference Include="..\Rubberduck.Resources\Rubberduck.Resources.csproj" /> | ||
<ProjectReference Include="..\Rubberduck.VBEEditor\Rubberduck.VBEditor.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="app.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Analyzer Include="..\RubberduckCodeAnalysis\bin\Release\RubberduckCodeAnalysis.dll" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
61 changes: 61 additions & 0 deletions
61
Rubberduck.CodeAnalysis/Inspections/Abstract/IsMissingInspectionBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Antlr4.Runtime; | ||
using NLog; | ||
using Rubberduck.Inspections.Abstract; | ||
using Rubberduck.Parsing; | ||
using Rubberduck.Parsing.Grammar; | ||
using Rubberduck.Parsing.Symbols; | ||
using Rubberduck.Parsing.VBA; | ||
|
||
namespace Rubberduck.Inspections.Inspections.Abstract | ||
{ | ||
public abstract class IsMissingInspectionBase : InspectionBase | ||
{ | ||
private readonly ILogger _logger = LogManager.GetCurrentClassLogger(); | ||
|
||
protected IsMissingInspectionBase(RubberduckParserState state) | ||
: base(state) { } | ||
|
||
private static readonly List<string> IsMissingQualifiedNames = new List<string> | ||
{ | ||
"VBE7.DLL;VBA.Information.IsMissing", | ||
"VBA6.DLL;VBA.Information.IsMissing" | ||
}; | ||
|
||
protected IReadOnlyList<Declaration> IsMissingDeclarations | ||
{ | ||
get | ||
{ | ||
var isMissing = BuiltInDeclarations.Where(decl => IsMissingQualifiedNames.Contains(decl.QualifiedName.ToString())).ToList(); | ||
|
||
if (isMissing.Count == 0) | ||
{ | ||
_logger.Trace("No 'IsMissing' Declarations were not found in IsMissingInspectionBase."); | ||
} | ||
|
||
return isMissing; | ||
} | ||
} | ||
|
||
protected ParameterDeclaration GetParameterForReference(IdentifierReference reference) | ||
{ | ||
// First case is for unqualified use: IsMissing(foo) | ||
// Second case if for use as a member access: VBA.IsMissing(foo) | ||
var argument = ((ParserRuleContext)reference.Context.Parent).GetDescendent<VBAParser.ArgumentExpressionContext>() ?? | ||
((ParserRuleContext)reference.Context.Parent.Parent).GetDescendent<VBAParser.ArgumentExpressionContext>(); | ||
|
||
var name = argument?.GetDescendent<VBAParser.SimpleNameExprContext>(); | ||
if (name == null || name.Parent.Parent != argument) | ||
{ | ||
return null; | ||
} | ||
|
||
var procedure = reference.Context.GetAncestor<VBAParser.ModuleBodyElementContext>(); | ||
return UserDeclarations.Where(decl => decl is ModuleBodyElementDeclaration) | ||
.Cast<ModuleBodyElementDeclaration>() | ||
.FirstOrDefault(decl => decl.Context.Parent == procedure)? | ||
.Parameters.FirstOrDefault(param => param.IdentifierName.Equals(name.GetText())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyConditionBlockInspection.cs
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
Rubberduck.CodeAnalysis/Inspections/Concrete/IsMissingOnInappropriateArgumentInspection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Rubberduck.Inspections.Inspections.Abstract; | ||
using Rubberduck.Inspections.Results; | ||
using Rubberduck.Parsing.Grammar; | ||
using Rubberduck.Parsing.Inspections.Abstract; | ||
using Rubberduck.Parsing.VBA; | ||
using Rubberduck.Resources.Inspections; | ||
|
||
namespace Rubberduck.Inspections.Concrete | ||
{ | ||
public class IsMissingOnInappropriateArgumentInspection : IsMissingInspectionBase | ||
{ | ||
public IsMissingOnInappropriateArgumentInspection(RubberduckParserState state) | ||
: base(state) { } | ||
|
||
protected override IEnumerable<IInspectionResult> DoGetInspectionResults() | ||
{ | ||
var results = new List<IInspectionResult>(); | ||
|
||
foreach (var reference in IsMissingDeclarations.SelectMany(decl => decl.References.Where(candidate => !IsIgnoringInspectionResultFor(candidate, AnnotationName)))) | ||
{ | ||
var parameter = GetParameterForReference(reference); | ||
|
||
if (parameter == null || | ||
parameter.IsOptional | ||
&& parameter.AsTypeName.Equals(Tokens.Variant) | ||
&& string.IsNullOrEmpty(parameter.DefaultValue) | ||
&& !parameter.IsArray) | ||
{ | ||
continue; | ||
} | ||
|
||
results.Add(new IdentifierReferenceInspectionResult(this, InspectionResults.IsMissingOnInappropriateArgumentInspection, State, reference, parameter)); | ||
} | ||
|
||
return results; | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Rubberduck.CodeAnalysis/Inspections/Concrete/IsMissingWithNonArgumentParameterInspection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Rubberduck.Inspections.Inspections.Abstract; | ||
using Rubberduck.Inspections.Results; | ||
using Rubberduck.Parsing.Inspections.Abstract; | ||
using Rubberduck.Parsing.VBA; | ||
using Rubberduck.Resources.Inspections; | ||
|
||
namespace Rubberduck.Inspections.Inspections.Concrete | ||
{ | ||
public class IsMissingWithNonArgumentParameterInspection : IsMissingInspectionBase | ||
{ | ||
public IsMissingWithNonArgumentParameterInspection(RubberduckParserState state) | ||
: base(state) { } | ||
|
||
protected override IEnumerable<IInspectionResult> DoGetInspectionResults() | ||
{ | ||
var results = new List<IInspectionResult>(); | ||
|
||
foreach (var reference in IsMissingDeclarations.SelectMany(decl => decl.References.Where(candidate => !IsIgnoringInspectionResultFor(candidate, AnnotationName)))) | ||
{ | ||
var parameter = GetParameterForReference(reference); | ||
|
||
if (parameter != null) | ||
{ | ||
continue; | ||
} | ||
|
||
results.Add(new IdentifierReferenceInspectionResult(this, InspectionResults.IsMissingWithNonArgumentParameterInspection, State, reference)); | ||
} | ||
|
||
return results; | ||
} | ||
} | ||
} |
Oops, something went wrong.