Ejemplo n.º 1
0
        /// <inheritdoc />
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            IDeclaration declaration = Utils.GetTypeClosestToTextControl <IDeclaration>(solution, textControl);

            // Fixes SA1604, 1605
            DocumentationRules.InsertMissingSummaryElement(declaration);
        }
Ejemplo n.º 2
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)
        {
            ICSharpFile file = Utils.GetCSharpFile(solution, textControl);

            // Fixes SA1639
            DocumentationRules.InsertFileHeaderSummary(file);
        }
        /// <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);

            IDeclaration declaration = element.GetContainingNode <IDeclaration>(true);

            DocumentationRules.EnsureDocumentationHasNoBlankLines(declaration);
        }
Ejemplo n.º 4
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)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            IMethodDeclaration memberDeclaration = element.GetContainingNode <IMethodDeclaration>(true);

            DocumentationRules.RemoveReturnsElement(memberDeclaration);
        }
        /// <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);

            IDeclaration declaration = element.GetContainingNode <IDeclaration>(true);

            DocumentationRules.InsertMissingTypeParamElement(declaration);
        }
Ejemplo n.º 6
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)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            IPropertyDeclaration propertyDeclaration = element.GetContainingNode <IPropertyDeclaration>(true);

            DocumentationRules.InsertValueElement(propertyDeclaration);
        }
Ejemplo n.º 7
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)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            IMethodDeclaration memberDeclaration = element.GetContainingNode <IMethodDeclaration>(true);

            if (memberDeclaration != null)
            {
                DocumentationRules.InsertReturnsElement(memberDeclaration, Utils.GetXmlPresentableName(memberDeclaration.DeclaredElement.ReturnType));
            }
        }
        /// <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);

            IDeclaration declaration = element.GetContainingNode <IMethodDeclaration>(true) ?? (IDeclaration)element.GetContainingNode <IConstructorDeclaration>(true);

            if (declaration != null)
            {
                DocumentationRules.InsertMissingParamElement(declaration);
            }
        }
        /// <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);

            if (element != null)
            {
                IConstructorDeclaration constructorDeclaration = element.GetContainingNode <IConstructorDeclaration>(true);
                if (constructorDeclaration != null)
                {
                    DocumentationRules.EnsureConstructorSummaryDocBeginsWithStandardText(constructorDeclaration);
                }
            }
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            ICSharpFile file = Utils.GetCSharpFile(solution, textControl);

            Lifetime.Using(
                lifetime =>
            {
                StyleCopApi api = solution.GetComponent <StyleCopApiPool>().GetInstance(lifetime);

                var settings = api.Settings.GetSettings(file.GetSourceFile().ToProjectFile());

                // this covers the issue that constants (and maybe others) return the class if called as GetContainingElement<IDeclaration>)
                IDeclaration declaration = Utils.GetTypeClosestToTextControl <IDeclaration>(solution, textControl);

                if (declaration != null)
                {
                    DocumentationRules.CheckDeclarationDocumentation(file, declaration, settings);
                }
            });
        }
Ejemplo n.º 11
0
        /// <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);
            });
        }
Ejemplo n.º 12
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)
        {
            IDeclaration declaration = Utils.GetTypeClosestToTextControl <IDeclaration>(solution, textControl);

            DocumentationRules.EnsureDocumentationTextIsUppercase(declaration);
        }
Ejemplo n.º 13
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)
        {
            ICSharpFile file = Utils.GetCSharpFile(solution, textControl);

            DocumentationRules.InsertFileName(file);
        }
        /// <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);

            DocumentationRules.SwapDocCommentNodeToCommentNode(element);
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the CompanyInformation class.
 /// </summary>
 /// <param name="analyzer">
 /// The analyzer that this settings page is attached to.
 /// </param>
 public CompanyInformation(DocumentationRules analyzer)
     : this()
 {
     Param.RequireNotNull(analyzer, "analyzer");
     this.analyzer = analyzer;
 }