Skip to content

Commit 3e4a0c5

Browse files
committed
Address PR comments
1 parent 9ba28b2 commit 3e4a0c5

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/ImplicitByRefModifierInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected override bool IsResultDeclaration(Declaration declaration, Declaration
6767
&& !finder.FindEventHandlers().Contains(enclosingMethod);
6868
}
6969

70-
private bool IsPropertyMutatorRHSParameter(ModuleBodyElementDeclaration enclosingMethod, ParameterDeclaration implicitByRefParameter)
70+
private static bool IsPropertyMutatorRHSParameter(ModuleBodyElementDeclaration enclosingMethod, ParameterDeclaration implicitByRefParameter)
7171
{
7272
return (enclosingMethod.DeclarationType.HasFlag(DeclarationType.PropertyLet)
7373
|| enclosingMethod.DeclarationType.HasFlag(DeclarationType.PropertySet))

Rubberduck.CodeAnalysis/Inspections/Concrete/MisleadingByRefParameterInspection.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,20 @@ public MisleadingByRefParameterInspection(IDeclarationFinderProvider declaration
4949

5050
protected override bool IsResultDeclaration(Declaration declaration, DeclarationFinder finder)
5151
{
52-
if ((declaration is ParameterDeclaration parameter)
52+
return declaration is ParameterDeclaration parameter
53+
&& !(parameter.AsTypeDeclaration?.DeclarationType.HasFlag(DeclarationType.UserDefinedType) ?? false)
5354
&& parameter.ParentDeclaration is ModuleBodyElementDeclaration enclosingMethod
5455
&& (enclosingMethod.DeclarationType.HasFlag(DeclarationType.PropertyLet)
5556
|| enclosingMethod.DeclarationType.HasFlag(DeclarationType.PropertySet))
5657
&& enclosingMethod.Parameters.Last() == parameter
57-
&& !(parameter.AsTypeDeclaration?.DeclarationType.HasFlag(DeclarationType.UserDefinedType) ?? false))
58-
{
59-
return parameter.IsByRef && !parameter.IsImplicitByRef;
60-
}
61-
62-
return false;
58+
&& parameter.IsByRef && !parameter.IsImplicitByRef;
6359
}
6460

6561
protected override string ResultDescription(Declaration declaration)
6662
{
6763
return string.Format(
6864
InspectionResults.MisleadingByRefParameterInspection,
69-
declaration.IdentifierName);
65+
declaration.IdentifierName, declaration.ParentDeclaration.QualifiedName.MemberName);
7066
}
7167
}
7268
}

Rubberduck.Resources/Inspections/InspectionInfo.Designer.cs

Lines changed: 1 addition & 1 deletion
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,6 @@ If the parameter can be null, ignore this inspection result; passing a null valu
443443
<value>An annotation has more arguments than allowed; superfluous arguments are ignored.</value>
444444
</data>
445445
<data name="MisleadingByRefParameterInspection" xml:space="preserve">
446-
<value>The last parameter (the 'Value' parameter) of property mutators are always passed by value. This is true regardless of the presence or absence of a ByVal modifier. Exception: UserDefinedType parameters must always be passed by reference in all cases.</value>
446+
<value>The last parameter (the 'Value' parameter) of property mutators are always passed ByVal. This is true regardless of the presence or absence of a ByRef or ByVal modifier. Exception: A UserDefinedType must always be passed ByRef even when it is the last parameter of a property mutator.</value>
447447
</data>
448448
</root>

Rubberduck.Resources/Inspections/InspectionNames.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/Inspections/InspectionNames.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,6 @@
443443
<value>Superfluous annotation arguments</value>
444444
</data>
445445
<data name="MisleadingByRefParameterInspection" xml:space="preserve">
446-
<value>ByRef is a misleading modifier because the parameter will be passed ByVal.</value>
446+
<value>Misleading ByRef parameter modifier</value>
447447
</data>
448448
</root>

Rubberduck.Resources/Inspections/InspectionResults.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Resources/Inspections/InspectionResults.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ In memoriam, 1972-2018</value>
514514
<comment>{0} annotation name</comment>
515515
</data>
516516
<data name="MisleadingByRefParameterInspection" xml:space="preserve">
517-
<value>Misleading ByRef modifier used for Parameter '{0}'.</value>
518-
<comment>{0} Parameter name</comment>
517+
<value>Misleading ByRef modifier used for parameter '{0}' ({1}).</value>
518+
<comment>{0} Parameter, {1} Member</comment>
519519
</data>
520520
</root>

0 commit comments

Comments
 (0)