From 3c220db4265bce677ddad0df31466271985f47c3 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 21:18:58 -0500 Subject: [PATCH 01/29] review default configs for all inspections --- .../CodeInspectionDefaults.Designer.cs | 313 +++++++++++------- .../CodeInspectionDefaults.settings | 171 ++++++---- Rubberduck.CodeAnalysis/app.config | 292 ++++++++++------ 3 files changed, 477 insertions(+), 299 deletions(-) diff --git a/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.Designer.cs b/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.Designer.cs index 8a159534e8..d3ae31f502 100644 --- a/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.Designer.cs +++ b/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Este código fue generado por una herramienta. -// Versión de runtime:4.0.30319.42000 +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // -// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -// se vuelve a generar el código. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -12,7 +12,7 @@ namespace Rubberduck.CodeAnalysis.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")] public sealed partial class CodeInspectionDefaults : global::System.Configuration.ApplicationSettingsBase { private static CodeInspectionDefaults defaultInstance = ((CodeInspectionDefaults)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new CodeInspectionDefaults()))); @@ -25,129 +25,190 @@ public static CodeInspectionDefaults Default { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n " + + " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n" + + " \r\n " + + "\r\n \r\n \r\n \r\n <" + + "CodeInspection Name=\"FunctionReturnValueDiscardedInspection\" Severity=\"Hint\" Ins" + + "pectionType=\"CodeQualityIssues\" />\r\n \r\n \r\n \r\n \r\n \r\n \r\n " + + "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n" + + " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + + "\r\n \r\n \r" + + "\n \r\n \r\n " + + " \r\n \r\n <" + + "CodeInspection Name=\"ObsoleteCallingConventionInspection\" Severity=\"Error\" Inspe" + + "ctionType=\"CodeQualityIssues\" />\r\n \r\n " + " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + - "\r\n \r\n \r\n \r\n \r\n " + - " \r\n " + - "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n <" + - "CodeInspection Name=\"SelfAssignedDeclarationInspection\" Severity=\"Suggestion\" In" + - "spectionType=\"CodeQualityIssues\" />\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n <" + - "CodeInspection Name=\"AssignmentNotUsedInspection\" Severity=\"Suggestion\" Inspecti" + - "onType=\"CodeQualityIssues\" />\r\n " + - "\r\n \r\n \r\n " + - " \r\n \r\n \r\n \r\n true\r\n")] + "nspectionType=\"LanguageOpportunities\" />\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + + "\r\n \r\n \r" + + "\n \r\n \r\n \r\n \r\n " + + "\r\n \r\n \r\n \r\n \r\n \r\n \r\n " + + " \r\n " + + "\r\n \r\n \r\n \r\n " + + "\r\n \r\n \r\n \r\n " + + "\r\n \r\n \r\n \r\n \r\n " + + "\r\n \r\n " + + " \r\n \r\n " + + " \r\n \r\n \r\n \r" + + "\n \r\n \r\n " + + " \r\n \r\n \r\n true\r\n")] public global::Rubberduck.CodeAnalysis.Settings.CodeInspectionSettings CodeInspectionSettings { get { return ((global::Rubberduck.CodeAnalysis.Settings.CodeInspectionSettings)(this["CodeInspectionSettings"])); diff --git a/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.settings b/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.settings index 2112d95f10..26693cedb2 100644 --- a/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.settings +++ b/Rubberduck.CodeAnalysis/Properties/CodeInspectionDefaults.settings @@ -4,87 +4,126 @@ <?xml version="1.0" encoding="utf-16"?> -<CodeInspectionSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +<CodeInspectionSettings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <CodeInspections> - <CodeInspection Name="BooleanAssignedInIfElseInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="ObsoleteErrorSyntaxInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="StopKeywordInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="UnhandledOnErrorResumeNextInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="EmptyStringLiteralInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ImplicitByRefModifierInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="FunctionReturnValueNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="RedundantByRefModifierInspection" Severity="DoNotShow" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="MissingAttributeInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> - <CodeInspection Name="AttributeOutOfSyncInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> - <CodeInspection Name="MissingAnnotationArgumentInspection" Severity="Error" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ModuleScopeDimKeywordInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="MultilineParameterInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="MultipleDeclarationsInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="ObsoleteCallStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ObsoleteCommentSyntaxInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ObsoleteLetStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="OptionBaseInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="RedundantOptionInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="OptionExplicitInspection" Severity="Error" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ProcedureCanBeWrittenAsFunctionInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ApplicationWorksheetFunctionInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="AnnotationInIncompatibleComponentTypeInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="ApplicationWorksheetFunctionInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ArgumentWithIncompatibleObjectTypeInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> <CodeInspection Name="AssignedByValParameterInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="EmptyModuleInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="LineLabelNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="IntegerDataTypeInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ShadowedDeclarationInspection" Severity="DoNotShow" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="AssignmentNotUsedInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="AttributeValueOutOfSyncInspection" Severity="Error" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="BooleanAssignedInIfElseInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> <CodeInspection Name="ConstantNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="DefaultMemberRequiredInspection" Severity="Error" InspectionType="CodeQualityIssues" /> <CodeInspection Name="DefaultProjectNameInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyCaseBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyDoWhileBlockInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyElseBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyForEachBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyForLoopBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyIfBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="EmptyWhileWendBlockInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="DefTypeStatementInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="DuplicatedAnnotationInspection" Severity="Error" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="EmptyCaseBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyDoWhileBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyElseBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyForEachBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyForLoopBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyIfBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyMethodInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyModuleInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="EmptyStringLiteralInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="EmptyWhileWendBlockInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> <CodeInspection Name="EncapsulatePublicFieldInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="HostSpecificExpressionInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ExcelMemberMayReturnNothingInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ExcelUdfNameIsValidCellReferenceInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="FunctionReturnValueAlwaysDiscardedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="FunctionReturnValueDiscardedInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="HostSpecificExpressionInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> <CodeInspection Name="HungarianNotationInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="ImplicitActiveSheetReferenceInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ImplicitActiveWorkbookReferenceInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ImplicitDefaultMemberAssignmentInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ImplicitPublicMemberInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ImplicitVariantReturnTypeInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="IIfSideEffectInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplementedInterfaceMemberInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitActiveSheetReferenceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitActiveWorkbookReferenceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitByRefModifierInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ImplicitContainingWorkbookReferenceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitContainingWorksheetReferenceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitDefaultMemberAccessInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitlyTypedConstInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitPublicMemberInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ImplicitRecursiveDefaultMemberAccessInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitUnboundDefaultMemberAccessInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ImplicitVariantReturnTypeInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="IndexedDefaultMemberAccessInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="IndexedRecursiveDefaultMemberAccessInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="IndexedUnboundDefaultMemberAccessInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="IntegerDataTypeInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="InvalidAnnotationInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="IsMissingOnInappropriateArgumentInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="IsMissingWithNonArgumentParameterInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="KeywordsUsedAsMemberInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="LineContinuationBetweenKeywordsInspection" Severity="Error" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="LineLabelNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> <CodeInspection Name="MemberNotOnInterfaceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="MoveFieldCloserToUsageInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="MisleadingByRefInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="MissingAnnotationArgumentInspection" Severity="Error" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="MissingAttributeInspection" Severity="Error" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="MissingMemberAnnotationInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="MissingModuleAnnotationInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="ModuleScopeDimKeywordInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ModuleWithoutFolderInspection" Severity="Suggestion" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="MoveFieldCloserToUsageInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="MultilineParameterInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="MultipleDeclarationsInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="NegativeLineNumberInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="NonBreakingSpaceIdentifierInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> <CodeInspection Name="NonReturningFunctionInspection" Severity="Error" InspectionType="CodeQualityIssues" /> <CodeInspection Name="ObjectVariableNotSetInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ObjectWhereProcedureIsRequiredInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ObsoleteCallingConventionInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ObsoleteCallStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ObsoleteCommentSyntaxInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ObsoleteErrorSyntaxInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> <CodeInspection Name="ObsoleteGlobalInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ObsoleteLetStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ObsoleteMemberUsageInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> <CodeInspection Name="ObsoleteTypeHintInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ParameterCanBeByValInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="ParameterNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ProcedureNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="SelfAssignedDeclarationInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ObsoleteWhileWendStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="OnErrorGoToMinusOneInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="OnLocalErrorInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="OptionBaseInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="OptionExplicitInspection" Severity="Error" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ParameterCanBeByValInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ParameterNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ProcedureCanBeWrittenAsFunctionInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="ProcedureNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ProcedureRequiredInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="PublicControlFieldAccessInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="PublicEnumerationDeclaredInWorksheetInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ReadOnlyPropertyAssignmentInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="RedundantByRefModifierInspection" Severity="DoNotShow" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="RedundantOptionInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="SelfAssignedDeclarationInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="SetAssignmentWithIncompatibleObjectTypeInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="ShadowedDeclarationInspection" Severity="DoNotShow" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="SheetAccessedUsingStringInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="StepIsNotSpecifiedInspection" Severity="DoNotShow" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="StepOneIsRedundantInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="StopKeywordInspection" Severity="Hint" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="SuperfluousAnnotationArgumentInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> + <CodeInspection Name="SuspiciousLetAssignmentInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="SuspiciousPredeclaredInstanceAccessInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UDTMemberNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> <CodeInspection Name="UnassignedVariableUsageInspection" Severity="Error" InspectionType="CodeQualityIssues" /> <CodeInspection Name="UndeclaredVariableInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UnderscoreInPublicClassModuleMemberInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UnhandledOnErrorResumeNextInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UnreachableCaseInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UnrecognizedAnnotationInspection" Severity="Warning" InspectionType="RubberduckOpportunities" /> <CodeInspection Name="UntypedFunctionUsageInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="UseMeaningfulNameInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="VariableNotAssignedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="VariableNotUsedInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="UseMeaningfulNameInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="UseOfBangNotationInspection" Severity="Hint" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="UseOfRecursiveBangNotationInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="UseOfUnboundBangNotationInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> + <CodeInspection Name="ValueRequiredInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="VariableNotAssignedInspection" Severity="Error" InspectionType="CodeQualityIssues" /> + <CodeInspection Name="VariableNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> <CodeInspection Name="VariableTypeNotDeclaredInspection" Severity="Warning" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="WriteOnlyPropertyInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="DefTypeStatementInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="StepIsNotSpecifiedInspection" Severity="DoNotShow" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="StepOneIsRedundantInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="SheetAccessedUsingStringInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="ObsoleteMemberUsageInspection" Severity="Warning" InspectionType="NamingAndConventionsIssues" /> - <CodeInspection Name="ObsoleteCallingConventionInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="DuplicatedAnnotationInspection" Severity="Error" InspectionType="RubberduckOpportunities" /> - <CodeInspection Name="ModuleWithoutFolderInspection" Severity="Suggestion" InspectionType="RubberduckOpportunities" /> - <CodeInspection Name="OnLocalErrorInspection" Severity="Suggestion" InspectionType="LanguageOpportunities" /> - <CodeInspection Name="IsMissingOnInappropriateArgumentInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="IsMissingWithNonArgumentParameterInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="AssignmentNotUsedInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="UnderscoreInPublicClassModuleMemberInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ExcelUdfNameIsValidCellReferenceInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="EmptyMethodInspection" Severity="Warning" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="ImplementedInterfaceMemberInspection" Severity="Suggestion" InspectionType="CodeQualityIssues" /> - <CodeInspection Name="PublicControlFieldAccessInspection" Severity="Hint" InspectionType="LanguageOpportunities" /> + <CodeInspection Name="WriteOnlyPropertyInspection" Severity="Suggestion" InspectionType="NamingAndConventionsIssues" /> </CodeInspections> <WhitelistedIdentifiers /> <RunInspectionsOnSuccessfulParse>true</RunInspectionsOnSuccessfulParse> diff --git a/Rubberduck.CodeAnalysis/app.config b/Rubberduck.CodeAnalysis/app.config index 56c52616a5..35f85c53a2 100644 --- a/Rubberduck.CodeAnalysis/app.config +++ b/Rubberduck.CodeAnalysis/app.config @@ -18,166 +18,244 @@ - + - - - - + + + - - - + - - - - - - - - - - - - - + - - - - - - - - + + + + - - - - - - - - + + + + + InspectionType="CodeQualityIssues" /> + + + Severity="Warning" InspectionType="CodeQualityIssues" /> - + Severity="Warning" InspectionType="CodeQualityIssues" /> + + + + + + + + + + + + - + + + + + + - + + + + + + + + + + + + + + + + + + - + + + + - - - + - + - - - - - - - + - - - + + - + - - - - - - + + - + + - - + - - + + + + + + + + + + true From 7c254d4277443421cf4e61ef3ac6e464e38b5d26 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 21:19:29 -0500 Subject: [PATCH 02/29] clarified wording of remarks --- .../Inspections/Concrete/EmptyStringLiteralInspection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyStringLiteralInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyStringLiteralInspection.cs index 98868b1c06..badf0ffefa 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyStringLiteralInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyStringLiteralInspection.cs @@ -10,7 +10,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete /// Flags uses of an empty string literal (""). /// /// - /// Treating an empty string literal as equal to the 'vbNullString' constant + /// In the context of a unit test, treating an empty string literal as equal to the 'vbNullString' constant /// requires using the PermissiveAssertClass. The default AssertClass is more strict about data types, and tells them apart. /// /// From 5ff04bffccec1ac00335b31f543301abbbd2ceda Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 21:19:42 -0500 Subject: [PATCH 03/29] added remarks --- .../ThunderCode/NonBreakingSpaceIdentifierInspection.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/ThunderCode/NonBreakingSpaceIdentifierInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/ThunderCode/NonBreakingSpaceIdentifierInspection.cs index 4987df727c..3c7961b235 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/ThunderCode/NonBreakingSpaceIdentifierInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/ThunderCode/NonBreakingSpaceIdentifierInspection.cs @@ -14,13 +14,16 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.ThunderCode /// code our friend Andrew Jackson would have written to confuse Rubberduck's parser and/or resolver. /// This inspection may accidentally reveal non-breaking spaces in code copied and pasted from a website. /// + /// + /// You may have discovered this inspection by pasting code directly from a web page, which often contains such non-printable characters. + /// internal sealed class NonBreakingSpaceIdentifierInspection : DeclarationInspectionBase { private const string Nbsp = "\u00A0"; public NonBreakingSpaceIdentifierInspection(IDeclarationFinderProvider declarationFinderProvider) : base(declarationFinderProvider) - {} + { } protected override bool IsResultDeclaration(Declaration declaration, DeclarationFinder finder) { From e935803fc08b008a3f1d3926deffbd29aef9a337 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 21:20:04 -0500 Subject: [PATCH 04/29] extracted classes to their own separate file --- .../InvalidAnnotationInspectionBase.cs | 63 +++++++ ...onInIncompatibleComponentTypeInspection.cs | 78 ++++++++ .../Concrete/InvalidAnnotationInspection.cs | 173 +----------------- .../UnrecognizedAnnotationInspection.cs | 52 ++++++ 4 files changed, 196 insertions(+), 170 deletions(-) create mode 100644 Rubberduck.CodeAnalysis/Inspections/Abstract/InvalidAnnotationInspectionBase.cs create mode 100644 Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs create mode 100644 Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs diff --git a/Rubberduck.CodeAnalysis/Inspections/Abstract/InvalidAnnotationInspectionBase.cs b/Rubberduck.CodeAnalysis/Inspections/Abstract/InvalidAnnotationInspectionBase.cs new file mode 100644 index 0000000000..d04eec59f0 --- /dev/null +++ b/Rubberduck.CodeAnalysis/Inspections/Abstract/InvalidAnnotationInspectionBase.cs @@ -0,0 +1,63 @@ +using Rubberduck.CodeAnalysis.Inspections.Results; +using Rubberduck.Parsing; +using Rubberduck.Parsing.Annotations; +using Rubberduck.Parsing.Symbols; +using Rubberduck.Parsing.VBA; +using Rubberduck.Parsing.VBA.DeclarationCaching; +using Rubberduck.VBEditor; +using System.Collections.Generic; +using System.Linq; + +namespace Rubberduck.CodeAnalysis.Inspections.Abstract +{ + /// + /// An inspection that flags invalid annotation comments. + /// + internal abstract class InvalidAnnotationInspectionBase : InspectionBase + { + protected InvalidAnnotationInspectionBase(IDeclarationFinderProvider declarationFinderProvider) + : base(declarationFinderProvider) { } + + protected QualifiedContext Context(IParseTreeAnnotation pta) => + new QualifiedContext(pta.QualifiedSelection.QualifiedName, pta.Context); + + protected sealed override IEnumerable DoGetInspectionResults(DeclarationFinder finder) + { + return finder.UserDeclarations(DeclarationType.Module) +.Where(module => module != null) +.SelectMany(module => DoGetInspectionResults(module.QualifiedModuleName, finder)); + } + + protected IInspectionResult InspectionResult(IParseTreeAnnotation pta) => + new QualifiedContextInspectionResult(this, ResultDescription(pta), Context(pta)); + + /// + /// Gets all invalid annotations covered by this inspection. + /// + /// All user code annotations. + /// All user declarations. + /// All identifier references in user code. + /// + protected abstract IEnumerable GetInvalidAnnotations( + IEnumerable annotations, + IEnumerable userDeclarations, + IEnumerable identifierReferences); + + /// + /// Gets an annotation-specific description for an inspection result. + /// + /// The invalid annotation. + /// + protected abstract string ResultDescription(IParseTreeAnnotation pta); + + protected sealed override IEnumerable DoGetInspectionResults(QualifiedModuleName module, DeclarationFinder finder) + { + var annotations = finder.FindAnnotations(module); + var userDeclarations = finder.Members(module).ToList(); + var identifierReferences = finder.IdentifierReferences(module).ToList(); + + var invalidAnnotations = GetInvalidAnnotations(annotations, userDeclarations, identifierReferences); + return invalidAnnotations.Select(InspectionResult).ToList(); + } + } +} \ No newline at end of file diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs new file mode 100644 index 0000000000..ce8852a624 --- /dev/null +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Linq; +using Rubberduck.Parsing; +using Rubberduck.Parsing.Annotations; +using Rubberduck.Parsing.Symbols; +using Rubberduck.Parsing.VBA; +using Rubberduck.Resources.Inspections; + +namespace Rubberduck.CodeAnalysis.Inspections.Concrete +{ + /// + /// Flags Rubberduck annotations used in a component type that is incompatible with that annotation. + /// + /// + /// Some annotations can only be used in a specific type of module; others cannot be used in certain types of modules. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal sealed class AnnotationInIncompatibleComponentTypeInspection : InvalidAnnotationInspectionBase + { + public AnnotationInIncompatibleComponentTypeInspection(IDeclarationFinderProvider declarationFinderProvider) + : base(declarationFinderProvider) { } + + protected override IEnumerable GetInvalidAnnotations( + IEnumerable annotations, + IEnumerable userDeclarations, + IEnumerable identifierReferences) + { + foreach (var pta in annotations) + { + var annotation = pta.Annotation; + var componentType = pta.QualifiedSelection.QualifiedName.ComponentType; + if (annotation.RequiredComponentType.HasValue && annotation.RequiredComponentType != componentType + || annotation.IncompatibleComponentTypes.Contains(componentType)) + { + yield return pta; + } + } + + yield break; + } + + protected override string ResultDescription(IParseTreeAnnotation pta) + { + if (pta.Annotation.RequiredComponentType.HasValue) + { + return string.Format(InspectionResults.InvalidAnnotationInspection_NotInRequiredComponentType, + pta.Annotation.Name, // annotation... + pta.QualifiedSelection.QualifiedName.ComponentType, // is used in a... + pta.Annotation.RequiredComponentType); // but is only valid in a... + } + else + { + return string.Format(InspectionResults.InvalidAnnotationInspection_IncompatibleComponentType, + pta.Annotation.Name, // annotation... + pta.QualifiedSelection.QualifiedName.ComponentType); // cannot be used in a... + } + } + } +} \ No newline at end of file diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs index 9b53d9ab4c..56bd901224 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs @@ -1,180 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Rubberduck.CodeAnalysis.Inspections.Abstract; -using Rubberduck.CodeAnalysis.Inspections.Results; using Rubberduck.InternalApi.Extensions; -using Rubberduck.Parsing; using Rubberduck.Parsing.Annotations; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.Parsing.VBA.DeclarationCaching; using Rubberduck.Resources.Inspections; -using Rubberduck.VBEditor; +using System.Collections.Generic; +using System.Linq; namespace Rubberduck.CodeAnalysis.Inspections.Concrete { - /// - /// An inspection that flags invalid annotation comments. - /// - internal abstract class InvalidAnnotationInspectionBase : InspectionBase - { - protected InvalidAnnotationInspectionBase(IDeclarationFinderProvider declarationFinderProvider) - : base(declarationFinderProvider) { } - - protected QualifiedContext Context(IParseTreeAnnotation pta) => - new QualifiedContext(pta.QualifiedSelection.QualifiedName, pta.Context); - - protected sealed override IEnumerable DoGetInspectionResults(DeclarationFinder finder) - { - return finder.UserDeclarations(DeclarationType.Module) -.Where(module => module != null) -.SelectMany(module => DoGetInspectionResults(module.QualifiedModuleName, finder)); - } - - protected IInspectionResult InspectionResult(IParseTreeAnnotation pta) => - new QualifiedContextInspectionResult(this, ResultDescription(pta), Context(pta)); - - /// - /// Gets all invalid annotations covered by this inspection. - /// - /// All user code annotations. - /// All user declarations. - /// All identifier references in user code. - /// - protected abstract IEnumerable GetInvalidAnnotations( - IEnumerable annotations, - IEnumerable userDeclarations, - IEnumerable identifierReferences); - - /// - /// Gets an annotation-specific description for an inspection result. - /// - /// The invalid annotation. - /// - protected abstract string ResultDescription(IParseTreeAnnotation pta); - - protected sealed override IEnumerable DoGetInspectionResults(QualifiedModuleName module, DeclarationFinder finder) - { - var annotations = finder.FindAnnotations(module); - var userDeclarations = finder.Members(module).ToList(); - var identifierReferences = finder.IdentifierReferences(module).ToList(); - - var invalidAnnotations = GetInvalidAnnotations(annotations, userDeclarations, identifierReferences); - return invalidAnnotations.Select(InspectionResult).ToList(); - } - } - - /// - /// Flags comments that parsed like Rubberduck annotations, but were not recognized as such. - /// - /// - /// Other add-ins may support similar-looking annotations that Rubberduck does not recognize; this inspection can be used to spot a typo in Rubberduck annotations. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - internal sealed class UnrecognizedAnnotationInspection : InvalidAnnotationInspectionBase - { - public UnrecognizedAnnotationInspection(IDeclarationFinderProvider declarationFinderProvider) - : base(declarationFinderProvider) { } - - protected override IEnumerable GetInvalidAnnotations( - IEnumerable annotations, - IEnumerable userDeclarations, - IEnumerable identifierReferences) - { - return annotations.Where(pta => pta.Annotation is NotRecognizedAnnotation).ToList(); - } - - protected override string ResultDescription(IParseTreeAnnotation pta) => - string.Format(InspectionResults.UnrecognizedAnnotationInspection, pta.Context.GetText()); - } - - /// - /// Flags Rubberduck annotations used in a component type that is incompatible with that annotation. - /// - /// - /// Some annotations can only be used in a specific type of module; others cannot be used in certain types of modules. - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - internal sealed class AnnotationInIncompatibleComponentTypeInspection : InvalidAnnotationInspectionBase - { - public AnnotationInIncompatibleComponentTypeInspection(IDeclarationFinderProvider declarationFinderProvider) - : base(declarationFinderProvider) { } - - protected override IEnumerable GetInvalidAnnotations( - IEnumerable annotations, - IEnumerable userDeclarations, - IEnumerable identifierReferences) - { - foreach (var pta in annotations) - { - var annotation = pta.Annotation; - var componentType = pta.QualifiedSelection.QualifiedName.ComponentType; - if (annotation.RequiredComponentType.HasValue && annotation.RequiredComponentType != componentType - || annotation.IncompatibleComponentTypes.Contains(componentType)) - { - yield return pta; - } - } - - yield break; - } - - protected override string ResultDescription(IParseTreeAnnotation pta) - { - if (pta.Annotation.RequiredComponentType.HasValue) - { - return string.Format(InspectionResults.InvalidAnnotationInspection_NotInRequiredComponentType, - pta.Annotation.Name, // annotation... - pta.QualifiedSelection.QualifiedName.ComponentType, // is used in a... - pta.Annotation.RequiredComponentType); // but is only valid in a... - } - else - { - return string.Format(InspectionResults.InvalidAnnotationInspection_IncompatibleComponentType, - pta.Annotation.Name, // annotation... - pta.QualifiedSelection.QualifiedName.ComponentType); // cannot be used in a... - } - } - } /// /// Flags invalid or misplaced Rubberduck annotation comments. @@ -210,7 +43,7 @@ internal sealed class InvalidAnnotationInspection : InvalidAnnotationInspectionB { public InvalidAnnotationInspection(IDeclarationFinderProvider declarationFinderProvider) : base(declarationFinderProvider) - {} + { } protected override string ResultDescription(IParseTreeAnnotation pta) => string.Format(InspectionResults.InvalidAnnotationInspection, pta.Annotation.Name); diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs new file mode 100644 index 0000000000..6f4bcf8745 --- /dev/null +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs @@ -0,0 +1,52 @@ +using Rubberduck.Parsing.Annotations; +using Rubberduck.Parsing.Symbols; +using Rubberduck.Parsing.VBA; +using Rubberduck.Resources.Inspections; +using System.Collections.Generic; +using System.Linq; + +namespace Rubberduck.CodeAnalysis.Inspections.Concrete +{ + /// + /// Flags comments that parsed like Rubberduck annotations, but were not recognized as such. + /// + /// + /// Other add-ins may support similar-looking annotations that Rubberduck does not recognize; this inspection can be used to spot a typo in Rubberduck annotations. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal sealed class UnrecognizedAnnotationInspection : InvalidAnnotationInspectionBase + { + public UnrecognizedAnnotationInspection(IDeclarationFinderProvider declarationFinderProvider) + : base(declarationFinderProvider) { } + + protected override IEnumerable GetInvalidAnnotations( + IEnumerable annotations, + IEnumerable userDeclarations, + IEnumerable identifierReferences) + { + return annotations.Where(pta => pta.Annotation is NotRecognizedAnnotation).ToList(); + } + + protected override string ResultDescription(IParseTreeAnnotation pta) => + string.Format(InspectionResults.UnrecognizedAnnotationInspection, pta.Context.GetText()); + } +} \ No newline at end of file From 597457cf153d43a427e2b1e217b8a5e324ac770e Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 23:00:46 -0500 Subject: [PATCH 05/29] fix usings --- .../AnnotationInIncompatibleComponentTypeInspection.cs | 5 +++-- .../Inspections/Concrete/InvalidAnnotationInspection.cs | 1 + .../Inspections/Concrete/UnrecognizedAnnotationInspection.cs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs index ce8852a624..8c3366650f 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/AnnotationInIncompatibleComponentTypeInspection.cs @@ -1,10 +1,11 @@ -using System.Collections.Generic; -using System.Linq; +using Rubberduck.CodeAnalysis.Inspections.Abstract; using Rubberduck.Parsing; using Rubberduck.Parsing.Annotations; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; using Rubberduck.Resources.Inspections; +using System.Collections.Generic; +using System.Linq; namespace Rubberduck.CodeAnalysis.Inspections.Concrete { diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs index 56bd901224..630688ed01 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/InvalidAnnotationInspection.cs @@ -1,3 +1,4 @@ +using Rubberduck.CodeAnalysis.Inspections.Abstract; using Rubberduck.InternalApi.Extensions; using Rubberduck.Parsing.Annotations; using Rubberduck.Parsing.Symbols; diff --git a/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs b/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs index 6f4bcf8745..e45679266c 100644 --- a/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs +++ b/Rubberduck.CodeAnalysis/Inspections/Concrete/UnrecognizedAnnotationInspection.cs @@ -1,4 +1,5 @@ -using Rubberduck.Parsing.Annotations; +using Rubberduck.CodeAnalysis.Inspections.Abstract; +using Rubberduck.Parsing.Annotations; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; using Rubberduck.Resources.Inspections; From 8a4395a4f755cb0fc127a9a30d5a179e061f2c02 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 23:14:36 -0500 Subject: [PATCH 06/29] closes #6237 --- .../ReplaceReferences/ReplaceReferencesRefactoringAction.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs b/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs index 74b3f4cb18..6284c579b3 100644 --- a/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs +++ b/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs @@ -1,8 +1,8 @@ -using System.Linq; -using Antlr4.Runtime; +using Antlr4.Runtime; using Rubberduck.Parsing.Grammar; using Rubberduck.Parsing.Rewriter; using Rubberduck.Parsing.Symbols; +using System.Linq; namespace Rubberduck.Refactorings.ReplaceReferences { @@ -39,7 +39,7 @@ public override void Refactor(ReplaceReferencesModel model, IRewriteSession rewr private (ParserRuleContext context, string replacementName) BuildReferenceReplacementString(IdentifierReference identifierReference, string NewName, bool moduleQualify) { var replacementExpression = moduleQualify && CanBeModuleQualified(identifierReference) - ? $"{identifierReference.Declaration.QualifiedModuleName.ComponentName}.{NewName}" + ? $"{identifierReference.Declaration.ParentDeclaration.IdentifierName}.{NewName}" : NewName; return (identifierReference.Context, replacementExpression); From dfa4d326735460dd9442a624cbf31455f3e243bc Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sat, 18 Jan 2025 23:39:59 -0500 Subject: [PATCH 07/29] handle enum member explicitly and separately --- .../ReplaceReferencesRefactoringAction.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs b/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs index 6284c579b3..dcbd5fa481 100644 --- a/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs +++ b/Rubberduck.Refactorings/ReplaceReferences/ReplaceReferencesRefactoringAction.cs @@ -38,8 +38,13 @@ public override void Refactor(ReplaceReferencesModel model, IRewriteSession rewr private (ParserRuleContext context, string replacementName) BuildReferenceReplacementString(IdentifierReference identifierReference, string NewName, bool moduleQualify) { + var qualifier = !moduleQualify ? null : + identifierReference.Declaration.DeclarationType == DeclarationType.EnumerationMember + ? identifierReference.Declaration.ParentDeclaration.IdentifierName + : identifierReference.Declaration.QualifiedModuleName.ComponentName; + var replacementExpression = moduleQualify && CanBeModuleQualified(identifierReference) - ? $"{identifierReference.Declaration.ParentDeclaration.IdentifierName}.{NewName}" + ? $"{qualifier}.{NewName}" : NewName; return (identifierReference.Context, replacementExpression); From 6c270e7d7bdf0038ac92c45673a9aee4a53f833f Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sun, 19 Jan 2025 01:15:47 -0500 Subject: [PATCH 08/29] somewhat fixes #6232 --- .../UI/About/AboutControlViewModel.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Rubberduck.Core/UI/About/AboutControlViewModel.cs b/Rubberduck.Core/UI/About/AboutControlViewModel.cs index 93272b9980..75720e042a 100644 --- a/Rubberduck.Core/UI/About/AboutControlViewModel.cs +++ b/Rubberduck.Core/UI/About/AboutControlViewModel.cs @@ -1,12 +1,12 @@ -using System; -using System.Diagnostics; -using Path = System.IO.Path; -using NLog; +using NLog; using NLog.Targets; using Rubberduck.Resources.About; using Rubberduck.UI.Command; using Rubberduck.VersionCheck; +using System; +using System.Diagnostics; using Application = System.Windows.Forms.Application; +using Path = System.IO.Path; namespace Rubberduck.UI.About { @@ -26,8 +26,11 @@ public AboutControlViewModel(IVersionCheckService version, IWebNavigator web) public string Version => string.Format(Resources.RubberduckUI.Rubberduck_AboutBuild, _version.VersionString); - public string OperatingSystem => - string.Format(AboutUI.AboutWindow_OperatingSystem, Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"); + private static readonly string _versionString = Environment.OSVersion.Version.Build > 22000 + ? $"{Environment.OSVersion.VersionString} (Win11)" + : Environment.OSVersion.VersionString; + + public string OperatingSystem => string.Format(AboutUI.AboutWindow_OperatingSystem, _versionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"); public string HostProduct => string.Format(AboutUI.AboutWindow_HostProduct, Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"); @@ -36,7 +39,7 @@ public AboutControlViewModel(IVersionCheckService version, IWebNavigator web) public string HostExecutable => string.Format(AboutUI.AboutWindow_HostExecutable, Path.GetFileName(Application.ExecutablePath).ToUpper()); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE - + public string AboutCopyright => string.Format(AboutUI.AboutWindow_Copyright, DateTime.Now.Year); @@ -48,11 +51,11 @@ public AboutControlViewModel(IVersionCheckService version, IWebNavigator web) private void ExecuteViewLog(object parameter) { - var fileTarget = (FileTarget) LogManager.Configuration.FindTargetByName("file"); - - var logEventInfo = new LogEventInfo { TimeStamp = DateTime.Now }; + var fileTarget = (FileTarget)LogManager.Configuration.FindTargetByName("file"); + + var logEventInfo = new LogEventInfo { TimeStamp = DateTime.Now }; var fileName = fileTarget.FileName.Render(logEventInfo); - + // The /select argument will only work if the path has backslashes fileName = fileName.Replace("/", "\\"); Process.Start(new ProcessStartInfo("explorer.exe", $"/select, \"{fileName}\"")); From 34562ff1735f3f7d7fcfa23c02cdd2d3dbd47a56 Mon Sep 17 00:00:00 2001 From: Mathieu Guindon Date: Sun, 19 Jan 2025 01:38:23 -0500 Subject: [PATCH 09/29] addresses #6225 --- .../Inspections/InspectionResultsControl.xaml | 6 ++ .../Inspections/InspectionResultsViewModel.cs | 68 +++++++++---------- 2 files changed, 40 insertions(+), 34 deletions(-) diff --git a/Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml b/Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml index ab7e4d7bbf..5e4058d626 100644 --- a/Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml +++ b/Rubberduck.Core/UI/Inspections/InspectionResultsControl.xaml @@ -97,6 +97,8 @@ + + +