Skip to content

Commit

Permalink
Merge pull request #5153 from BZngr/4882_UCI_MsgRewording
Browse files Browse the repository at this point in the history
Improve Unreachable Case Inspection Messages
  • Loading branch information
retailcoder committed Sep 19, 2019
2 parents 629deec + 3e0520b commit 802548d
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 98 deletions.
Expand Up @@ -17,15 +17,15 @@
namespace Rubberduck.Inspections.Concrete.UnreachableCaseInspection
{
/// <summary>
/// Flags 'Case' blocks that are semantically unreachable.
/// Flags 'Case' blocks that will never execute.
/// </summary>
/// <why>
/// Unreachable code is certainly unintended, and is probably either redundant, or a bug.
/// </why>
/// <remarks>
/// Not all unreachable 'Case' blocks may be flagged, depending on expression complexity.
/// </remarks>
/// <example hasResults="true">
/// <example hasResult="true">
/// <![CDATA[
/// Private Sub Example(ByVal value As Long)
/// Select Case value
Expand All @@ -41,6 +41,76 @@ namespace Rubberduck.Inspections.Concrete.UnreachableCaseInspection
/// End Sub
/// ]]>
/// </example>
/// <example hasResult="true">
/// <![CDATA[
///
/// 'If the cumulative result of multiple 'Case' statements
/// 'cover the entire range of possible values for a data type,
/// 'then all remaining 'Case' statements are unreachable
///
/// Private Sub ExampleAllValuesCoveredIntegral(ByVal value As Long, ByVal result As Long)
/// Select Case result
/// Case Is < 100
/// ' ...
/// Case Is > -100
/// ' ...
/// 'all possible values are covered by preceding 'Case' statements
/// Case value * value ' unreachable
/// ' ...
/// Case value + value ' unreachable
/// ' ...
/// Case Else ' unreachable
/// ' ...
/// End Select
/// End Sub
/// ]]>
/// </example>
/// <example hasResult="false">
/// <![CDATA[
/// Public Enum ProductID
/// Widget = 1
/// Gadget = 2
/// Gizmo = 3
/// End Enum
///
/// Public Sub ExampleEnumCaseElse(ByVal product As ProductID)
///
/// 'Enums are evaluated as the 'Long' data type. So, in this example,
/// 'even though all the ProductID enum values have a 'Case' statement,
/// 'the 'Case Else' will still execute for any value of the 'product'
/// 'parameter that is not a ProductID.
///
/// Select Case product
/// Case Widget
/// ' ...
/// Case Gadget
/// ' ...
/// Case Gizmo
/// ' ...
/// Case Else 'is reachable
/// ' Raise an error for unrecognized/unhandled ProductID
/// End Select
/// End Sub
/// ]]>
/// </example>
/// <example hasResult="true">
/// <![CDATA[
///
/// 'The inspecion flags Range Clauses that are not of the required form:
/// '[x] To [y] where [x] less than or equal to [y]
///
/// Private Sub ExampleInvalidRangeExpression(ByVal value As String)
/// Select Case value
/// Case "Beginning" To "End"
/// ' ...
/// Case "Start" To "Finish" ' unreachable: incorrect form.
/// ' ...
/// CaseElse
/// ' ...
/// End Select
/// End Sub
/// ]]>
/// </example>
public sealed class UnreachableCaseInspection : ParseTreeInspectionBase
{
private readonly IUnreachableCaseInspectorFactory _unreachableCaseInspectorFactory;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Rubberduck.Resources/Inspections/InspectionInfo.cs.resx
Expand Up @@ -229,9 +229,6 @@ Jestliže může být parametr prázdný, ignorujte výsledek této inspekce; p
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Manipulace s chybami by měla být obnovena po použití 'On Error Resume Next'.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Detekuje klauzule případů, které se nikdy nevykonají.</value>
</data>
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Prázdné moduly a třídy buďto odkazují na dosud neimplementovanou funkcionalitu, nebo představují zbytečnou zátěž, která může poškodit udržovatelnost projektu.</value>
</data>
Expand Down
3 changes: 0 additions & 3 deletions Rubberduck.Resources/Inspections/InspectionInfo.de.resx
Expand Up @@ -304,9 +304,6 @@ Falls der Parameter 'null' sein kann, bitte dieses Auftreten ignorieren. 'null'
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Leere Module und Klassen weisen entweder auf noch nicht implementierte Funktionalitäten hin oder stellen unnötigen Ballast dar, der die Wartbarkeit eines Projekts behindern kann.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Erkennt "Case"-Klauseln, die nie ausgeführt werden können.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Fehlerbehandlung sollte nach Verwendung von 'On Error Resume Next' wiederhergestellt werden.</value>
</data>
Expand Down
3 changes: 0 additions & 3 deletions Rubberduck.Resources/Inspections/InspectionInfo.es.resx
Expand Up @@ -304,9 +304,6 @@ Si el parámetro puede ser nulo, ignore el resultado de esta inspección; pasar
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Los módulos y clases vacíos apuntan a una funcionalidad aún no implementada o representan un equipaje innecesario que puede perjudicar la mantenibilidad de un proyecto.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Detecta cláusulas de casos que nunca se ejecutarán.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>El manejo de errores se debe restaurar después de usar 'On Error Resume Next'.</value>
</data>
Expand Down
3 changes: 0 additions & 3 deletions Rubberduck.Resources/Inspections/InspectionInfo.fr.resx
Expand Up @@ -304,9 +304,6 @@ Si le paramètre peut être nul, ignorer ce résultat; passer une valeur nulle
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Les modules et classes vides démontrent des fonctionnalités pas encore implémentées ou représentent un fardeau non nécessaire pouvant nuire à la maintenance du projet.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Détecte les clauses 'Case' qui ne peuvent être exécutées.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>La gestion d'erreurs devrait être restaurée après l'utilisation de 'On Error Resume Next'</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion Rubberduck.Resources/Inspections/InspectionInfo.resx
Expand Up @@ -305,7 +305,7 @@ If the parameter can be null, ignore this inspection result; passing a null valu
<value>Empty modules and classes either point to not yet implemented functionality or represent unnecessary baggage that can hurt the maintainability of a project.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Detects Case Clauses that will never execute. </value>
<value>A 'Case' condition either always evaluates to False, causes a run-time error, or the cumulative effect of prior 'Case' statements represents all possible values or a superset of the 'Case' statement's values. As a result, the 'Case' block will never execute and is "dead code", or the 'Case' statement is a run-time error waiting to happen. Consider removing, reordering, or modifying the 'Case' statement.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Error handling should be restored after using 'On Error Resume Next'.</value>
Expand Down
10 changes: 5 additions & 5 deletions Rubberduck.Resources/Inspections/InspectionResults.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions Rubberduck.Resources/Inspections/InspectionResults.cs.resx
Expand Up @@ -303,18 +303,6 @@
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Modul/třída {0} je prázdná.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Není schopno dosáhnout na 'Case' klauzuli '{0}'</value>
</data>
<data name="UnreachableCaseInspection_CaseElse" xml:space="preserve">
<value>Nedosažitelný 'Case Else': Všechny potřebné hodnoty jsou vyřešeny předchozím 'Case' příkazem/příkazy</value>
</data>
<data name="UnreachableCaseInspection_TypeMismatch" xml:space="preserve">
<value>Neplatný Typ: 'Case' Příkaz nemůže být vyhodnocen jako typ příkazu 'Select'</value>
</data>
<data name="UnreachableCaseInspection_Unreachable" xml:space="preserve">
<value>Nedosažitelné: 'Case' příkaz je vyřešen předchozím 'Case' příkazem/příkazy</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Errory jsou ignorovány, avšak už nikdy neřešeny</value>
</data>
Expand All @@ -336,12 +324,6 @@
<data name="ObsoleteCallingConventionInspection" xml:space="preserve">
<value>'{0}' je deklarováno zastaralou 'CDecl' volací konvencí.</value>
</data>
<data name="UnreachableCaseInspection_InherentlyUnreachable" xml:space="preserve">
<value>Nedostupné: Case Statement obsahuje klauzuli(e) o neplatném rozsahu.</value>
</data>
<data name="UnreachableCaseInspection_Overflow" xml:space="preserve">
<value>Nedostupné: Case Statement způsobí Run-time chybu č. 6 (Přetečení)</value>
</data>
<data name="DuplicatedAnnotationInspection" xml:space="preserve">
<value>Anotace '{0}' je duplikována.</value>
</data>
Expand Down
18 changes: 0 additions & 18 deletions Rubberduck.Resources/Inspections/InspectionResults.de.resx
Expand Up @@ -305,18 +305,6 @@
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Modul/Klasse {0} ist leer.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Die Case-Klausel '{0}' kann nicht erreicht werden</value>
</data>
<data name="UnreachableCaseInspection_CaseElse" xml:space="preserve">
<value>Nicht erreichbares Case Else: Alle möglichen Werte sind durch vorangehende Klausel(n) abgedeckt.</value>
</data>
<data name="UnreachableCaseInspection_TypeMismatch" xml:space="preserve">
<value>Inakzeptabler Typ: Die Case-Anweisung kann nicht als derselbe Typ wie die Select-Anweisung ausgewertet werden.</value>
</data>
<data name="UnreachableCaseInspection_Unreachable" xml:space="preserve">
<value>Unerreichbar: Case-Klausel ist bereits von anderen Klausel(n) abgehandelt.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Fehler werden ignoriert aber nie wieder behandelt.</value>
</data>
Expand All @@ -338,12 +326,6 @@
<data name="ObsoleteCallingConventionInspection" xml:space="preserve">
<value>'{0}' wurde mit der unter Windows nicht erlaubten 'CDecl'-Aufrufkonvention deklariert.</value>
</data>
<data name="UnreachableCaseInspection_InherentlyUnreachable" xml:space="preserve">
<value>Unerreichbar: Case-Klausel enthält unzulässige Bereichsdefinition(en).</value>
</data>
<data name="UnreachableCaseInspection_Overflow" xml:space="preserve">
<value>Unerreichbar: Case-Klausel wird einen Laufzeitfehler 6 - 'Überlauf' erzeugen.</value>
</data>
<data name="DuplicatedAnnotationInspection" xml:space="preserve">
<value>Annotation '{0}' wurde mehrfach spezifiziert.</value>
</data>
Expand Down
18 changes: 0 additions & 18 deletions Rubberduck.Resources/Inspections/InspectionResults.es.resx
Expand Up @@ -303,18 +303,6 @@
<data name="EmptyModuleInspection" xml:space="preserve">
<value>El módulo/clase '{0}' está vacío.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>No se puede llegar a la cláusula de caso '{0}'.</value>
</data>
<data name="UnreachableCaseInspection_CaseElse" xml:space="preserve">
<value>Caso inalcanzable: Todas las coincidencias existen en las declaraciones de casos anteriores.</value>
</data>
<data name="UnreachableCaseInspection_TypeMismatch" xml:space="preserve">
<value>Inaccesible: La declaración del caso causará el error 13 en tiempo de ejecución (No coincidencia).</value>
</data>
<data name="UnreachableCaseInspection_Unreachable" xml:space="preserve">
<value>Inaccesible: Nunca coincide o es equivalente a una declaración previa del Caso.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Los errores se ignoran pero nunca se manejan de nuevo.</value>
</data>
Expand All @@ -336,12 +324,6 @@
<data name="ObsoleteCallingConventionInspection" xml:space="preserve">
<value>'{0}' se declara usando la convención de llamada obsoleta 'CDecl'.</value>
</data>
<data name="UnreachableCaseInspection_InherentlyUnreachable" xml:space="preserve">
<value>Inaccesible: La declaración del caso contiene cláusulas de rango no válidas.</value>
</data>
<data name="UnreachableCaseInspection_Overflow" xml:space="preserve">
<value>Inaccesible: La declaración del caso causará el error 6 en tiempo de ejecución (desbordamiento).</value>
</data>
<data name="DuplicatedAnnotationInspection" xml:space="preserve">
<value>La anotación '{0}' está duplicada.</value>
</data>
Expand Down
18 changes: 0 additions & 18 deletions Rubberduck.Resources/Inspections/InspectionResults.fr.resx
Expand Up @@ -306,18 +306,6 @@
<data name="EmptyModuleInspection" xml:space="preserve">
<value>Le module/classe {0} est vide.</value>
</data>
<data name="UnreachableCaseInspection" xml:space="preserve">
<value>Le bloc '{0}' est inatteignable</value>
</data>
<data name="UnreachableCaseInspection_CaseElse" xml:space="preserve">
<value>Le bloc 'Case Else' est inatteignable : toutes les valeurs possibles sont prises en charge par les blocs 'Case' précédents.</value>
</data>
<data name="UnreachableCaseInspection_TypeMismatch" xml:space="preserve">
<value>Type invalide : l'expression 'Case' ne peut être évaluée selon le type de l'expression 'Select'.</value>
</data>
<data name="UnreachableCaseInspection_Unreachable" xml:space="preserve">
<value>Bloc inatteignable : l'expression 'Case' est prise en charge par un bloc 'Case' précédent.</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>La gestion d'erreurs est désactivée sans être réactivée.</value>
</data>
Expand Down Expand Up @@ -366,12 +354,6 @@
<data name="UnderscoreInPublicClassModuleMemberInspection" xml:space="preserve">
<value>Le nom du membre public '{0}' contient un caractère de soulignement.</value>
</data>
<data name="UnreachableCaseInspection_InherentlyUnreachable" xml:space="preserve">
<value>Bloc inatteignable: l'expression 'Case' contient une clause invalide.</value>
</data>
<data name="UnreachableCaseInspection_Overflow" xml:space="preserve">
<value>Bloc inatteignable: l'expression 'Case' causera une erreur d'exécution 6 : Overflow.</value>
</data>
<data name="AttributeValueOutOfSyncInspection" xml:space="preserve">
<value>La valeur de l'attribut {0} ({1}) est désynchronisée avec l'annotation {2}.</value>
</data>
Expand Down
10 changes: 5 additions & 5 deletions Rubberduck.Resources/Inspections/InspectionResults.resx
Expand Up @@ -321,13 +321,13 @@
<value>Case clause '{0}' cannot be reached.</value>
</data>
<data name="UnreachableCaseInspection_CaseElse" xml:space="preserve">
<value>Unreachable Case Else: all matches exist within prior Case statement(s).</value>
<value>'Case Else' statement is unreachable</value>
</data>
<data name="UnreachableCaseInspection_TypeMismatch" xml:space="preserve">
<value>Unreachable: Case Statement will cause a Run-time error 13 (Mismatch).</value>
<value>'Case' statement will cause run-time error 13 (type mismatch).</value>
</data>
<data name="UnreachableCaseInspection_Unreachable" xml:space="preserve">
<value>Unreachable: Never matches or is equivalent to a prior Case statement.</value>
<value>'Case' statement is unreachable</value>
</data>
<data name="UnhandledOnErrorResumeNextInspection" xml:space="preserve">
<value>Errors are ignored but never handled again.</value>
Expand All @@ -353,10 +353,10 @@
<comment>{0} Procedure name</comment>
</data>
<data name="UnreachableCaseInspection_InherentlyUnreachable" xml:space="preserve">
<value>Unreachable: Case Statement contains invalid range clause(s).</value>
<value>'Case' statement Range Clauses must be expressed '[x] To [y]' where [x] is less than or equal to [y]'</value>
</data>
<data name="UnreachableCaseInspection_Overflow" xml:space="preserve">
<value>Unreachable: Case Statement will cause a Run-time error 6 (Overflow).</value>
<value>'Case' statement will cause run-time error 6 (Overflow)</value>
</data>
<data name="DuplicatedAnnotationInspection" xml:space="preserve">
<value>Annotation '{0}' is duplicated.</value>
Expand Down

0 comments on commit 802548d

Please sign in to comment.