/// <summary> /// Swap return type to built in type. /// </summary> /// <param name="methodDeclaration"> /// The method declaration. /// </param> private static void SwapReturnTypeToBuiltInType(IMethodDeclaration methodDeclaration) { using (WriteLockCookie.Create(true)) { methodDeclaration.SetType(methodDeclaration.GetReturnType()); } }
/// <summary> /// Checks method comment blocks. /// </summary> /// <param name="methodDeclaration"> /// The method <see cref="IDeclaration"/> to check. /// </param> /// <param name="options"> /// <see cref="OrderingOptions"/>Current options that we can reference. /// </param> private void CheckMethodDeclarationDocumentation(IMethodDeclaration methodDeclaration, DocumentationOptions options) { Param.RequireNotNull(options, "options"); if (methodDeclaration == null) { return; } bool insertMissingParamTagOption = options.SA1611ElementParametersMustBeDocumented; bool insertMissingReturnTagOption = options.SA1615ElementReturnValueMustBeDocumented; bool removeReturnTagOnVoidElementsOption = options.SA1617VoidReturnValueMustNotBeDocumented; if (insertMissingParamTagOption && !Utils.IsRuleSuppressed(methodDeclaration, StyleCopRules.SA1611)) { if (methodDeclaration.ParameterDeclarations.Count > 0) { this.InsertMissingParamElement(methodDeclaration); } } DeclaredTypeFromCLRName declaredTypeFromCLRName = methodDeclaration.GetReturnType() as DeclaredTypeFromCLRName; if (removeReturnTagOnVoidElementsOption && !Utils.IsRuleSuppressed(methodDeclaration, StyleCopRules.SA1617)) { // Remove the <returns> if the return type is void if (declaredTypeFromCLRName != null && declaredTypeFromCLRName.GetClrName().FullName == "System.Void") { this.RemoveReturnsElement(methodDeclaration); } } if (insertMissingReturnTagOption && !Utils.IsRuleSuppressed(methodDeclaration, StyleCopRules.SA1615)) { // Insert the <returns> if the return type is not void and it was missing if (declaredTypeFromCLRName != null && declaredTypeFromCLRName.GetClrName().FullName != "System.Void") { this.InsertReturnsElement(methodDeclaration); } } }