Created
November 7, 2014 21:39
-
-
Save EIrwin/8b23583da3a7c6fb4449 to your computer and use it in GitHub Desktop.
AnalyzeSymbol Method Implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void AnalyzeSymbol(ISymbol symbol, Compilation compilation, Action<Diagnostic> addDiagnostic, CancellationToken cancellationToken) | |
{ | |
var methodSymbol = (IMethodSymbol)symbol; | |
//Check if any method parameters are of type IInternalUser | |
if (methodSymbol.Parameters.Any(p => p.Type.Name.Contains("IInternalUser"))) | |
{ | |
var paramter = methodSymbol.Parameters.First(); | |
//Check if IInerternalUser type is first parameter and there is more than one expected parameters | |
if (!paramter.Type.Name.Contains("IInternalUser") && methodSymbol.Parameters.Count() > 1) | |
{ | |
var diagnostic = Diagnostic.Create(Rule, methodSymbol.Locations[0], methodSymbol.Name); | |
addDiagnostic(diagnostic); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment