/// <summary> /// Figuring out if the code uses underscore prefix in field names. /// </summary> /// <param name="semanticModel">The <see cref="SemanticModel"/>.</param> /// <returns>True if the code is found to prefix field names with underscore.</returns> public static CodeStyleResult UnderscoreFields(this SemanticModel semanticModel) { if (semanticModel is null) { throw new ArgumentNullException(nameof(semanticModel)); } return(UnderscoreFieldWalker.Check(semanticModel.SyntaxTree, semanticModel.Compilation)); }
/// <summary> /// Figuring out if field names should be prefixed with _. /// 1. Walk current <paramref name="document"/>. /// 2. Walk current project. /// </summary> /// <param name="document">The <see cref="Document"/>.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that cancels the operation.</param> /// <returns>True if the code is found to prefix field names with underscore.</returns> public static async Task <CodeStyleResult> UnderscoreFieldsAsync(this Document document, CancellationToken cancellationToken) { if (document is null) { throw new ArgumentNullException(nameof(document)); } return(await UnderscoreFieldWalker.CheckAsync(document, cancellationToken) .ConfigureAwait(false)); }