This file contains hidden or 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
| private async Task<Document> FixIInternalUserOrdinal(Document document,MethodDeclarationSyntax methodDeclaration,CancellationToken cancellationToken) | |
| { | |
| //Document to return; | |
| Document newDocument = null; | |
| //Retrieve original paramater list syntax node from method declaration | |
| ParameterListSyntax originalParameterListSyntax = methodDeclaration.ParameterList; | |
| //Retrieve original paramater list from paramater list syntax nodes | |
| IEnumerable <SyntaxNode> parameters = originalParameterListSyntax.ChildNodes(); |
This file contains hidden or 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 async Task<IEnumerable<CodeAction>> GetFixesAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) | |
| { | |
| SyntaxNode root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); | |
| SyntaxToken token = root.FindToken(span.Start); | |
| TextSpan diagnosticSpan = diagnostics.First().Location.SourceSpan; | |
| // Find the method declaration identified by the diagnostic. | |
| MethodDeclarationSyntax declaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<MethodDeclarationSyntax>().First(); |
This file contains hidden or 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
| internal const string Description = "IInternalUser parameter needs to be first in method signature"; | |
| internal const string MessageFormat = "IInternalUser parameter needs to be first in method signature"; |
This file contains hidden or 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 ImmutableArray<SymbolKind> SymbolKindsOfInterest { get { return ImmutableArray.Create(SymbolKind.Method); } } |
This file contains hidden or 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 |
This file contains hidden or 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 bool CheckUserCredentials(IInternalUser internalUser){...} | |
| public bool CheckUserCredentials(IInternalUser internalUser,string username,string password){...} |
This file contains hidden or 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 bool CheckUserCredentials(){...} | |
| public bool CheckUserCredentials(string username,string password){...} | |
| public bool CheckUserCredentials(string username,string password,IInternalUser internalUser){...} |
NewerOlder