/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { ITreeNode element = Utils.GetElementAtCaret(solution, textControl); ICommentNode commentNode = element.GetContainingNode <ICommentNode>(true); ReadabilityRules.RemoveEmptyComments(commentNode); }
/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { ITreeNode element = Utils.GetElementAtCaret(solution, textControl); ICommentNode commentNode = element.GetContainingNode <ICommentNode>(true); ReadabilityRules.MoveCommentInsideNextOpenCurlyBracket(commentNode); }
/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { ITreeNode element = Utils.GetElementAtCaret(solution, textControl); IInvocationExpression invocationExpression = element.GetContainingNode <IInvocationExpression>(true); if (invocationExpression != null) { ReadabilityRules.SwapBaseToThisUnlessLocalImplementation(invocationExpression); } }
/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { ITreeNode element = Utils.GetElementAtCaret(solution, textControl); IStartRegion startRegionNode = element.GetContainingNode <IStartRegion>(true); if (startRegionNode != null) { ReadabilityRules.MoveRegionInsideNextOpenCurlyBracket(startRegionNode); } }
/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { IList <ITokenNode> tokensForLine = Utils.GetTokensForLineFromTextControl(solution, textControl); foreach (ITokenNode tokenNode in tokensForLine) { ITypeArgumentList typeArgumentListNode = tokenNode.GetContainingNode <ITypeArgumentList>(true); if (typeArgumentListNode != null) { ReadabilityRules.SwapToBuiltInTypeAlias(typeArgumentListNode); } IObjectCreationExpression objectCreationExpressionNode = tokenNode.GetContainingNode <IObjectCreationExpression>(true); if (objectCreationExpressionNode != null) { ReadabilityRules.SwapToBuiltInTypeAlias(objectCreationExpressionNode); } IArrayCreationExpression arrayCreationExpressionNode = tokenNode.GetContainingNode <IArrayCreationExpression>(true); if (arrayCreationExpressionNode != null) { ReadabilityRules.SwapToBuiltInTypeAlias(arrayCreationExpressionNode); } IMethodDeclaration methodDeclaration = tokenNode.GetContainingNode <IMethodDeclaration>(true); if (methodDeclaration != null) { ReadabilityRules.SwapToBuiltInTypeAlias(methodDeclaration); } IVariableDeclaration variableDeclaration = tokenNode.GetContainingNode <IVariableDeclaration>(true); if (variableDeclaration != null) { ReadabilityRules.SwapToBuiltInTypeAlias(variableDeclaration); } IMultipleDeclaration multipleDeclarationNode = tokenNode.GetContainingNode <IMultipleDeclaration>(true); if (multipleDeclarationNode != null) { ReadabilityRules.SwapToBuiltInTypeAlias(multipleDeclarationNode); } } }
/// <summary> /// Processes all the cleanup. /// </summary> /// <param name="projectFile"> /// The project file to clean. /// </param> /// <param name="file"> /// The PSI file to clean. /// </param> /// <param name="fixXmlDocViolations"> /// Flag to indicate if XML doc stubs should be created /// </param> private void InternalProcess(IProjectFile projectFile, ICSharpFile file, bool fixXmlDocViolations) { // Process the file for all the different Code Cleanups we have here // we do them in a very specific order. Do not change it. Lifetimes.Using( lifetime => { StyleCopApiPool apiPool = projectFile.GetSolution().GetComponent <StyleCopApiPool>(); Settings settings = apiPool.GetInstance(lifetime).Settings.GetSettings(projectFile); ReadabilityRules.ExecuteAll(file, settings); MaintainabilityRules.ExecuteAll(file, settings); if (fixXmlDocViolations) { DocumentationRules.ExecuteAll(file, settings); } LayoutRules.ExecuteAll(file, settings); SpacingRules.ExecuteAll(file, settings); OrderingRules.ExecuteAll(file, settings); }); }
/// <summary> /// The execute transaction inner. /// </summary> /// <param name="solution"> /// The solution. /// </param> /// <param name="textControl"> /// The text control. /// </param> public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl) { ICSharpFile file = Utils.GetCSharpFile(solution, textControl); ReadabilityRules.ReplaceEmptyStringsWithStringDotEmpty(file.FirstChild); }