private static DiagnosticResult GetExpectedDiagnostic(int line, int column, MissingKindArgument kind) { string message; switch (kind) { case MissingKindArgument.SymbolKind: message = CodeAnalysisDiagnosticsResources.MissingSymbolKindArgumentToRegisterActionMessage; break; case MissingKindArgument.SyntaxKind: message = CodeAnalysisDiagnosticsResources.MissingSyntaxKindArgumentToRegisterActionMessage; break; case MissingKindArgument.OperationKind: message = CodeAnalysisDiagnosticsResources.MissingOperationKindArgumentToRegisterActionMessage; break; default: throw new ArgumentException("Unsupported argument kind", nameof(kind)); } return(new DiagnosticResult(DiagnosticIds.MissingKindArgumentToRegisterActionRuleId, DiagnosticHelpers.DefaultDiagnosticSeverity) .WithLocation(line, column) .WithMessageFormat(message)); }
private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column, MissingKindArgument kind) { var rule = kind switch { MissingKindArgument.SymbolKind => BasicRegisterActionAnalyzer.MissingSymbolKindArgumentRule, MissingKindArgument.SyntaxKind => BasicRegisterActionAnalyzer.MissingSyntaxKindArgumentRule, MissingKindArgument.OperationKind => BasicRegisterActionAnalyzer.MissingOperationKindArgumentRule, _ => throw new ArgumentException("Unsupported argument kind", nameof(kind)), }; #pragma warning disable RS0030 // Do not used banned APIs return(VerifyVB.Diagnostic(rule).WithLocation(line, column)); #pragma warning restore RS0030 // Do not used banned APIs }
private static DiagnosticResult GetExpectedDiagnostic(string language, int line, int column, MissingKindArgument kind) { string message; switch (kind) { case MissingKindArgument.SymbolKind: message = CodeAnalysisDiagnosticsResources.MissingSymbolKindArgumentToRegisterActionMessage; break; case MissingKindArgument.SyntaxKind: message = CodeAnalysisDiagnosticsResources.MissingSyntaxKindArgumentToRegisterActionMessage; break; case MissingKindArgument.OperationKind: message = CodeAnalysisDiagnosticsResources.MissingOperationKindArgumentToRegisterActionMessage; break; default: throw new ArgumentException("Unsupported argument kind", nameof(kind)); } string fileName = language == LanguageNames.CSharp ? "Test0.cs" : "Test0.vb"; return(new DiagnosticResult { Id = DiagnosticIds.MissingKindArgumentToRegisterActionRuleId, Message = message, Severity = DiagnosticHelpers.DefaultDiagnosticSeverity, Locations = new[] { new DiagnosticResultLocation(fileName, line, column) } }); }
private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column, MissingKindArgument kind) { return(GetExpectedDiagnostic(LanguageNames.VisualBasic, line, column, kind)); }
private static DiagnosticResult GetCSharpExpectedDiagnostic(int line, int column, MissingKindArgument kind) { return(GetExpectedDiagnostic(LanguageNames.CSharp, line, column, kind)); }
private static DiagnosticResult GetCSharpExpectedDiagnostic(int line, int column, MissingKindArgument kind) { var rule = kind switch { MissingKindArgument.SymbolKind => CSharpRegisterActionAnalyzer.MissingSymbolKindArgumentRule, MissingKindArgument.SyntaxKind => CSharpRegisterActionAnalyzer.MissingSyntaxKindArgumentRule, MissingKindArgument.OperationKind => CSharpRegisterActionAnalyzer.MissingOperationKindArgumentRule, _ => throw new ArgumentException("Unsupported argument kind", nameof(kind)), }; return(VerifyCS.Diagnostic(rule).WithLocation(line, column)); }
private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column, MissingKindArgument kind) { return(GetExpectedDiagnostic(line, column, kind)); }
private static DiagnosticResult GetExpectedDiagnostic(string language, int line, int column, MissingKindArgument kind) { string message; switch (kind) { case MissingKindArgument.SymbolKind: message = CodeAnalysisDiagnosticsResources.MissingSymbolKindArgumentToRegisterActionMessage; break; case MissingKindArgument.SyntaxKind: message = CodeAnalysisDiagnosticsResources.MissingSyntaxKindArgumentToRegisterActionMessage; break; case MissingKindArgument.OperationKind: message = CodeAnalysisDiagnosticsResources.MissingOperationKindArgumentToRegisterActionMessage; break; default: throw new ArgumentException("kind"); } string fileName = language == LanguageNames.CSharp ? "Test0.cs" : "Test0.vb"; return new DiagnosticResult { Id = DiagnosticIds.MissingKindArgumentToRegisterActionRuleId, Message = message, Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation(fileName, line, column) } }; }
private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column, MissingKindArgument kind) { return GetExpectedDiagnostic(LanguageNames.VisualBasic, line, column, kind); }
private static DiagnosticResult GetCSharpExpectedDiagnostic(int line, int column, MissingKindArgument kind) { return GetExpectedDiagnostic(LanguageNames.CSharp, line, column, kind); }
private static DiagnosticResult GetBasicExpectedDiagnostic(int line, int column, MissingKindArgument kind) { var rule = kind switch { MissingKindArgument.SymbolKind => VisualBasic.Analyzers.MetaAnalyzers.BasicRegisterActionAnalyzer.MissingSymbolKindArgumentRule, MissingKindArgument.SyntaxKind => VisualBasic.Analyzers.MetaAnalyzers.BasicRegisterActionAnalyzer.MissingSyntaxKindArgumentRule, MissingKindArgument.OperationKind => VisualBasic.Analyzers.MetaAnalyzers.BasicRegisterActionAnalyzer.MissingOperationKindArgumentRule, _ => throw new ArgumentException("Unsupported argument kind", nameof(kind)) }; return(GetExpectedDiagnostic(rule, line, column)); }