-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4752 from rubberduck-vba/next
Release 2.4.0
- Loading branch information
Showing
362 changed files
with
27,806 additions
and
7,327 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
name: Bug report | ||
about: Rubberduck does not work as expected | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
**Rubberduck version information** | ||
The info below can be copy-paste-completed from the first lines of Rubberduck's Log or the About box: | ||
|
||
Rubberduck version [...] | ||
Operating System: [...] | ||
Host Product: [...] | ||
Host Version: [...] | ||
Host Executable: [...] | ||
|
||
|
||
**Description** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Logfile** | ||
Rubberduck generates extensive logging in TRACE-Level. If no log was created at `%APP_DATA%\Rubberduck\Logs`, check your settings. Include this Log for bugreports about the behavior of Rubbberduck | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
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 |
---|---|---|
|
@@ -17,6 +17,8 @@ If you like this project and would like to thank its contributors, you are welco | |
[masterBuildStatus]:https://ci.appveyor.com/api/projects/status/we3pdnkeebo4nlck/branch/master?svg=true | ||
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/Rubberduck-vba/rubberduck.svg)](http://isitmaintained.com/project/Rubberduck-vba/rubberduck "Average time to resolve an issue") | ||
[![Percentage of issues still open](http://isitmaintained.com/badge/open/Rubberduck-vba/rubberduck.svg)](http://isitmaintained.com/project/Rubberduck-vba/rubberduck "Percentage of issues still open") | ||
[![Chat on stackexchange](https://img.shields.io/badge/chat-on%20stackexchange-blue.svg)](https://chat.stackexchange.com/rooms/14929/vba-rubberducking) | ||
[![License](https://img.shields.io/github/license/rubberduck-vba/Rubberduck.svg)](https://github.com/rubberduck-vba/Rubberduck/blob/next/LICENSE) | ||
|
||
> **[rubberduckvba.com](http://rubberduckvba.com)** [Wiki](https://github.com/rubberduck-vba/Rubberduck/wiki) [Rubberduck News](https://rubberduckvba.wordpress.com/) | ||
> [email protected] | ||
|
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
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
73 changes: 73 additions & 0 deletions
73
Rubberduck.CodeAnalysis/Inspections/Concrete/AttributeValueOutOfSyncInspection.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,73 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Rubberduck.Inspections.Abstract; | ||
using Rubberduck.Inspections.Results; | ||
using Rubberduck.Parsing; | ||
using Rubberduck.Parsing.Annotations; | ||
using Rubberduck.Parsing.Inspections; | ||
using Rubberduck.Parsing.Inspections.Abstract; | ||
using Rubberduck.Parsing.Symbols; | ||
using Rubberduck.Parsing.VBA; | ||
using Rubberduck.Resources.Inspections; | ||
using Rubberduck.VBEditor.SafeComWrappers; | ||
|
||
namespace Rubberduck.Inspections.Concrete | ||
{ | ||
[CannotAnnotate] | ||
public sealed class AttributeValueOutOfSyncInspection : InspectionBase | ||
{ | ||
public AttributeValueOutOfSyncInspection(RubberduckParserState state) | ||
:base(state) | ||
{ | ||
} | ||
|
||
protected override IEnumerable<IInspectionResult> DoGetInspectionResults() | ||
{ | ||
var declarationsWithAttributeAnnotations = State.DeclarationFinder.AllUserDeclarations | ||
.Where(declaration => declaration.Annotations.Any(annotation => annotation.AnnotationType.HasFlag(AnnotationType.Attribute))); | ||
var results = new List<DeclarationInspectionResult>(); | ||
foreach (var declaration in declarationsWithAttributeAnnotations.Where(decl => decl.QualifiedModuleName.ComponentType != ComponentType.Document)) | ||
{ | ||
foreach (var annotation in declaration.Annotations.OfType<IAttributeAnnotation>()) | ||
{ | ||
if (HasDifferingAttributeValues(declaration, annotation, out var attributeValues)) | ||
{ | ||
var description = string.Format(InspectionResults.AttributeValueOutOfSyncInspection, | ||
annotation.Attribute, | ||
string.Join(", ", attributeValues), | ||
annotation.AnnotationType); | ||
|
||
var result = new DeclarationInspectionResult(this, description, declaration, | ||
new QualifiedContext(declaration.QualifiedModuleName, annotation.Context)); | ||
result.Properties.Annotation = annotation; | ||
result.Properties.AttributeName = annotation.Attribute; | ||
result.Properties.AttributeValues = attributeValues; | ||
|
||
results.Add(result); | ||
} | ||
} | ||
} | ||
|
||
return results; | ||
} | ||
|
||
private static bool HasDifferingAttributeValues(Declaration declaration, IAttributeAnnotation annotation, out IReadOnlyList<string> attributeValues) | ||
{ | ||
var attributeNodes = declaration.DeclarationType.HasFlag(DeclarationType.Module) | ||
? declaration.Attributes.AttributeNodesFor(annotation) | ||
: declaration.Attributes.AttributeNodesFor(annotation, declaration.IdentifierName); | ||
|
||
foreach (var attributeNode in attributeNodes) | ||
{ | ||
var values = attributeNode.Values; | ||
if (!annotation.AttributeValues.SequenceEqual(values)) | ||
{ | ||
attributeValues = values; | ||
return true; | ||
} | ||
} | ||
attributeValues = new List<string>(); | ||
return false; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.