/// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            SpacingRules.SingleLineCommentsMustBeginWithSingleSpace(element);
        }
        /// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            if (element.Parent != null)
            {
                SpacingRules.CodeMustNotContainMultipleWhitespaceInARow(element.Parent);
            }
        }
Example #3
0
        /// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            ITreeNode           element         = Utils.GetElementAtCaret(solution, textControl);
            IOperatorExpression containingBlock = element.GetContainingNode <IOperatorExpression>(true);

            if (containingBlock != null)
            {
                SpacingRules.NegativeAndPositiveSignsMustBeSpacedCorrectly(containingBlock, CSharpTokenType.MINUS);
            }
        }
        /// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);
            IPreprocessorDirective containingBlock = element.GetContainingNode <IPreprocessorDirective>(true);

            if (containingBlock != null)
            {
                SpacingRules.PreprocessorKeywordsMustNotBePrecededBySpace(containingBlock);
            }
        }
Example #5
0
        /// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            ITreeNode element         = Utils.GetElementAtCaret(solution, textControl);
            IBlock    containingBlock = element.GetContainingNode <IBlock>(true);

            if (containingBlock != null)
            {
                SpacingRules.CommasMustBeSpacedCorrectly(containingBlock);
            }

            IFieldDeclaration fieldDeclarationNode = element.GetContainingNode <IFieldDeclaration>(true);

            if (fieldDeclarationNode != null)
            {
                SpacingRules.CommasMustBeSpacedCorrectly(fieldDeclarationNode);
            }
        }
        /// <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);
            });
        }