Skip to content

Commit

Permalink
Address PR feedback from Larry
Browse files Browse the repository at this point in the history
  • Loading branch information
mavasani committed Apr 1, 2016
1 parent 0760f9d commit 42458ea
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,25 @@
<value>Apply DiagnosticAnalyzer attribute for both '{0}' and '{1}'.</value>
</data>
<data name="MissingSymbolKindArgumentToRegisterActionMessage" xml:space="preserve">
<value>Specify at least one SymbolKind of interest while registering a symbol analyzer action.</value>
<value>Specify at least one SymbolKind of interest when registering a symbol analyzer action.</value>
</data>
<data name="MissingSyntaxKindArgumentToRegisterActionMessage" xml:space="preserve">
<value>Specify at least one SyntaxKind of interest while registering a syntax node analyzer action.</value>
<value>Specify at least one SyntaxKind of interest when registering a syntax node analyzer action.</value>
</data>
<data name="MissingOperationKindArgumentToRegisterActionMessage" xml:space="preserve">
<value>Specify at least one OperationKind of interest while registering an operation analyzer action.</value>
<value>Specify at least one OperationKind of interest when registering an operation analyzer action.</value>
</data>
<data name="MissingKindArgumentToRegisterActionTitle" xml:space="preserve">
<value>Missing kind argument while registering an analyzer action.</value>
<value>Missing kind argument when registering an analyzer action.</value>
</data>
<data name="MissingKindArgumentToRegisterActionDescription" xml:space="preserve">
<value>You must specify at least one syntax/symbol/operation kinds of interest while registering a syntax/symbol/operation analyzer action. Otherwise, the registered action will be dead code and will never be invoked during analysis.</value>
<value>You must specify at least one syntax, symbol or operation kind when registering a syntax, symbol, or operation analyzer action respectively. Otherwise, the registered action will never be invoked during analysis.</value>
</data>
<data name="UnsupportedSymbolKindArgumentToRegisterActionMessage" xml:space="preserve">
<value>SymbolKind '{0}' is not supported for symbol analyzer actions.</value>
</data>
<data name="UnsupportedSymbolKindArgumentToRegisterActionTitle" xml:space="preserve">
<value>Unsupported SymbolKind argument while registering a symbol analyzer action.</value>
<value>Unsupported SymbolKind argument when registering a symbol analyzer action.</value>
</data>
<data name="InvalidReportDiagnosticMessage" xml:space="preserve">
<value>ReportDiagnostic invoked with an unsupported DiagnosticDescriptor '{0}'.</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
return ImmutableArray.Create(
MissingSymbolKindArgumentRule,
MissingSyntaxKindArgumentRule,
MissingOperationKindArgumentRule,
UnsupportedSymbolKindArgumentRule,
InvalidSyntaxKindTypeArgumentRule,
StartActionWithNoRegisteredActionsRule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected override DiagnosticAnalyzerSymbolAnalyzer GetDiagnosticAnalyzerSymbolA
return null;
}

var contextTypes = ImmutableHashSet.Create(compilationEndAnalysisContext, codeBlockAnalysisContext,
ImmutableHashSet<INamedTypeSymbol> contextTypes = ImmutableHashSet.Create(compilationEndAnalysisContext, codeBlockAnalysisContext,
operationBlockAnalysisContext, operationAnalysisContext, semanticModelAnalysisContext, symbolAnalysisContext, syntaxNodeAnalysisContext, syntaxTreeAnalysisContext);

return GetAnalyzer(contextTypes, diagnosticType, diagnosticDescriptorType, diagnosticAnalyzer, diagnosticAnalyzerAttribute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private static DiagnosticResult GetExpectedDiagnostic(string language, int line,
break;

default:
throw new NotSupportedException();
throw new ArgumentException("kind");
}

string fileName = language == LanguageNames.CSharp ? "Test0.cs" : "Test0.vb";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private static void AnalyzeCodeBlockStart(CodeBlockStartAnalysisContext<SyntaxKi
}

[Fact]
public void CSharp_NoDiagnosticCases_3()
public void CSharp_NoDiagnosticCases_OperationAnalyzerRegistration()
{
var source = @"
using System;
Expand All @@ -215,7 +215,7 @@ public void CSharp_NoDiagnosticCases_3()
using Microsoft.CodeAnalysis.Diagnostics;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
abstract class MyAnalyzer : DiagnosticAnalyzer
class MyAnalyzer : DiagnosticAnalyzer
{
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand All @@ -236,7 +236,7 @@ private static void AnalyzeOperation(OperationAnalysisContext context)
}
[DiagnosticAnalyzer(LanguageNames.CSharp)]
abstract class MyAnalyzer2 : DiagnosticAnalyzer
class MyAnalyzer2 : DiagnosticAnalyzer
{
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand All @@ -259,7 +259,7 @@ private static void AnalyzeOperationBlock(OperationBlockAnalysisContext context)
}

[Fact]
public void CSharp_NoDiagnosticCases_4()
public void CSharp_NoDiagnosticCases_NestedOperationAnalyzerRegistration()
{
var source = @"
using System;
Expand All @@ -268,7 +268,7 @@ public void CSharp_NoDiagnosticCases_4()
using Microsoft.CodeAnalysis.Diagnostics;
[DiagnosticAnalyzer(LanguageNames.CSharp)]
abstract class MyAnalyzer : DiagnosticAnalyzer
class MyAnalyzer : DiagnosticAnalyzer
{
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
Expand Down Expand Up @@ -315,7 +315,7 @@ private static void AnalyzeOperationBlockStart(OperationBlockStartAnalysisContex

VerifyCSharp(source, addLanguageSpecificCodeAnalysisReference: false);
}

[Fact]
public void VisualBasic_NoDiagnosticCases()
{
Expand Down Expand Up @@ -401,7 +401,7 @@ End Class
}

[Fact]
public void VisualBasic_NoDiagnosticCases_3()
public void VisualBasic_NoDiagnosticCases_OperationAnalyzerRegistration()
{
var source = @"
Imports System
Expand All @@ -410,7 +410,7 @@ Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Diagnostics
<DiagnosticAnalyzer(LanguageNames.VisualBasic)> _
MustInherit Class MyAnalyzer
Class MyAnalyzer
Inherits DiagnosticAnalyzer
Public Overrides ReadOnly Property SupportedDiagnostics() As ImmutableArray(Of DiagnosticDescriptor)
Get
Expand All @@ -427,7 +427,7 @@ End Sub
End Class
<DiagnosticAnalyzer(LanguageNames.VisualBasic)> _
MustInherit Class MyAnalyzer2
Class MyAnalyzer2
Inherits DiagnosticAnalyzer
Public Overrides ReadOnly Property SupportedDiagnostics() As ImmutableArray(Of DiagnosticDescriptor)
Get
Expand All @@ -447,7 +447,7 @@ End Class
}

[Fact]
public void VisualBasic_NoDiagnosticCases_4()
public void VisualBasic_NoDiagnosticCases_NestedOperationAnalyzerRegistration()
{
var source = @"
Imports System
Expand Down Expand Up @@ -540,7 +540,7 @@ private static DiagnosticResult GetExpectedDiagnostic(string language, int line,
break;

default:
throw new NotSupportedException();
throw new ArgumentException("kind");
}

string message = string.Format(CodeAnalysisDiagnosticsResources.StartActionWithNoRegisteredActionsMessage, parameterName, arg2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private static DiagnosticResult GetExpectedDiagnostic(string language, int line,
break;

default:
throw new NotSupportedException();
throw new ArgumentException("kind");
}

string message = string.Format(CodeAnalysisDiagnosticsResources.StartActionWithOnlyEndActionMessage, parameterName, endActionName, statelessActionName, arg4);
Expand Down

0 comments on commit 42458ea

Please sign in to comment.