17 |
18 | ## Description
19 |
20 | This refactoring assists users in converting Markdown syntax within documentation comments to XML syntax recognized by
21 | the compiler and other tools.
22 |
--------------------------------------------------------------------------------
/docs/DOC901.md:
--------------------------------------------------------------------------------
1 | # DOC901
2 |
3 |
4 |
5 |
TypeName
6 |
DOC901ConvertToDocumentationComment
7 |
8 |
9 |
CheckId
10 |
DOC901
11 |
12 |
13 |
Category
14 |
Refactorings
15 |
16 |
17 |
18 | ## Description
19 |
20 | This refactoring assists users in converting line and block comments preceding a type or member to a documentation
21 | comment for the member.
22 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC100CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC100CSharp7UnitTests : DOC100UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC101CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC101CSharp7UnitTests : DOC101UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC102CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC102CSharp7UnitTests : DOC102UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC103CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC103CSharp7UnitTests : DOC103UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC104CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC104CSharp7UnitTests : DOC104UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC105CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC105CSharp7UnitTests : DOC105UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC106CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC106CSharp7UnitTests : DOC106UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/StyleRules/DOC107CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.StyleRules
5 | {
6 | using DocumentationAnalyzers.Test.StyleRules;
7 |
8 | public class DOC107CSharp7UnitTests : DOC107UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC200CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC200CSharp7UnitTests : DOC200UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC201CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC201CSharp7UnitTests : DOC201UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC202CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC202CSharp7UnitTests : DOC202UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC203CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC203CSharp7UnitTests : DOC203UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC204CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC204CSharp7UnitTests : DOC204UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC207CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC207CSharp7UnitTests : DOC207UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/PortabilityRules/DOC209CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.PortabilityRules
5 | {
6 | using DocumentationAnalyzers.Test.PortabilityRules;
7 |
8 | public class DOC209CSharp7UnitTests : DOC209UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/RefactoringRules/DOC900CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.RefactoringRules
5 | {
6 | using DocumentationAnalyzers.Test.RefactoringRules;
7 |
8 | public class DOC900CSharp7UnitTests : DOC900UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/RefactoringRules/DOC901CSharp7UnitTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test.CSharp7.RefactoringRules
5 | {
6 | using DocumentationAnalyzers.Test.RefactoringRules;
7 |
8 | public class DOC901CSharp7UnitTests : DOC901UnitTests
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/version.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3 | "version": "1.0.0-beta.{height}",
4 | "assemblyVersion": {
5 | "precision": "revision"
6 | },
7 | "publicReleaseRefSpec": [
8 | "^refs/heads/master$"
9 | ],
10 | "nugetPackageVersion": {
11 | "semVer": 2
12 | },
13 | "cloudBuild": {
14 | "buildNumber": {
15 | "enabled": true
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/ExcludeFromCodeCoverageAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | #if NETSTANDARD1_1
5 |
6 | namespace System.Diagnostics.CodeAnalysis
7 | {
8 | [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
9 | internal sealed class ExcludeFromCodeCoverageAttribute : Attribute
10 | {
11 | }
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/docs/DOC204.md:
--------------------------------------------------------------------------------
1 | # DOC204
2 |
3 |
4 |
5 |
TypeName
6 |
DOC204UseInlineElementsCorrectly
7 |
8 |
9 |
CheckId
10 |
DOC204
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains an inline element where a section or block element was expected.
21 |
22 | ## Rule description
23 |
24 | *TODO*
25 |
26 | ## How to fix violations
27 |
28 | *TODO*
29 |
30 | ## How to suppress violations
31 |
32 | *TODO*
33 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/Helpers/SpecializedTasks.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Helpers
5 | {
6 | using System.Threading.Tasks;
7 |
8 | internal static class SpecializedTasks
9 | {
10 | internal static Task CompletedTask { get; } = Task.FromResult(default(VoidResult));
11 |
12 | private struct VoidResult
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/docs/DOC209.md:
--------------------------------------------------------------------------------
1 | # DOC209
2 |
3 |
4 |
5 |
TypeName
6 |
DOC209UseSeeHrefCorrectly
7 |
8 |
9 |
CheckId
10 |
DOC209
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a `` or `` element with an unrecognized URI.
21 |
22 | ## Rule description
23 |
24 | *TODO*
25 |
26 | ## How to fix violations
27 |
28 | *TODO*
29 |
30 | ## How to suppress violations
31 |
32 | *TODO*
33 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | # https://docs.codecov.io/docs/codecov-yaml
2 | # https://github.com/codecov/support/wiki/Codecov-Yaml
3 |
4 | coverage:
5 | status:
6 | project:
7 | default: false
8 | patch:
9 | default: false
10 | fixes:
11 | - "build/DocumentationAnalyzers/::DocumentationAnalyzers/"
12 |
13 | comment:
14 | layout: "diff"
15 |
16 | flags:
17 | production:
18 | paths:
19 | - DocumentationAnalyzers/DocumentationAnalyzers/
20 | - DocumentationAnalyzers/DocumentationAnalyzers.CodeFixes/
21 | test:
22 | paths:
23 | - DocumentationAnalyzers/DocumentationAnalyzers.Test/
24 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/SequentialTestCollection.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using Xunit;
7 |
8 | ///
9 | /// Defines a collection for tests which cannot run in parallel with other tests.
10 | ///
11 | [CollectionDefinition(nameof(SequentialTestCollection), DisableParallelization = true)]
12 | internal sealed class SequentialTestCollection
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | using System;
5 | using System.Runtime.CompilerServices;
6 | using System.Runtime.InteropServices;
7 |
8 | [assembly: CLSCompliant(false)]
9 |
10 | // Setting ComVisible to false makes the types in this assembly not visible
11 | // to COM components. If you need to access a type in this assembly from
12 | // COM, set the ComVisible attribute to true on that type.
13 | [assembly: ComVisible(false)]
14 |
--------------------------------------------------------------------------------
/DOCUMENTATION.md:
--------------------------------------------------------------------------------
1 | DocumentationAnalyzers provides warnings that indicate documentation rule violations in C# code. The warnings are organized into rule areas. This section provides an explanation of each of the default DocumentationAnalyzers rules.
2 |
3 | ### Rule areas
4 |
5 | **[Style Rules (DOC100-)](docs/StyleRules.md)**
6 |
7 | Rules related to the style of documentation comments.
8 |
9 | **[Portability Rules (DOC200-)](docs/PortabilityRules.md)**
10 |
11 | Rules related to the portability of documentation comments.
12 |
13 | **[Refactorings (DOC900-)](docs/Refactorings.md)**
14 |
15 | Additional refactorings provided when the analyzer is installed.
16 |
17 | ### Additional documentation
18 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/stylecop.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
3 | "settings": {
4 | "documentationRules": {
5 | "companyName": "Tunnel Vision Laboratories, LLC",
6 | "copyrightText": "Copyright (c) {companyName}. All Rights Reserved.\r\nLicensed under the MIT license. See LICENSE in the project root for license information.",
7 | "xmlHeader": false,
8 | "fileNamingConvention": "metadata"
9 | },
10 | "layoutRules": {
11 | "newlineAtEndOfFile": "require"
12 | },
13 | "namingRules": {
14 | "tupleElementNameCasing": "camelCase"
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/docs/DOC203.md:
--------------------------------------------------------------------------------
1 | # DOC203
2 |
3 |
4 |
5 |
TypeName
6 |
DOC203UseBlockElementsCorrectly
7 |
8 |
9 |
CheckId
10 |
DOC203
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a block element where a section or inline element was expected.
21 |
22 | ## Rule description
23 |
24 | *TODO*
25 |
26 | ## How to fix violations
27 |
28 | To fix a violation of this rule, move the block element inside a section or outside a containing inline element, or
29 | replace the block element with an appropriate section or inline element.
30 |
31 | ## How to suppress violations
32 |
33 | *TODO*
34 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Internal.ruleset:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/VisualBasicAnalyzerVerifier`1+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.Diagnostics;
8 | using Microsoft.CodeAnalysis.Testing.Verifiers;
9 | using Microsoft.CodeAnalysis.VisualBasic.Testing;
10 |
11 | public static partial class VisualBasicAnalyzerVerifier
12 | where TAnalyzer : DiagnosticAnalyzer, new()
13 | {
14 | public class Test : VisualBasicAnalyzerTest
15 | {
16 | public Test()
17 | {
18 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/VisualBasicCodeRefactoringVerifier`1+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.CodeRefactorings;
8 | using Microsoft.CodeAnalysis.Testing.Verifiers;
9 | using Microsoft.CodeAnalysis.VisualBasic.Testing;
10 |
11 | public static partial class VisualBasicCodeRefactoringVerifier
12 | where TCodeRefactoring : CodeRefactoringProvider, new()
13 | {
14 | public class Test : VisualBasicCodeRefactoringTest
15 | {
16 | public Test()
17 | {
18 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/AttributeTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using Xunit;
7 |
8 | public class AttributeTests
9 | {
10 | [Fact]
11 | public void TestNoCodeFixAttributeReason()
12 | {
13 | string reason = "Reason";
14 | var attribute = new NoCodeFixAttribute(reason);
15 | Assert.Same(reason, attribute.Reason);
16 | }
17 |
18 | [Fact]
19 | public void TestWorkItemAttribute()
20 | {
21 | int id = 1;
22 | string issueUri = "https://github.com/DotNetAnalyzers/DocumentationAnalyzers/issues/1";
23 | var attribute = new WorkItemAttribute(id, issueUri);
24 | Assert.Equal(id, attribute.Id);
25 | Assert.Same(issueUri, attribute.Location);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/VisualBasicCodeFixVerifier`2+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.CodeFixes;
8 | using Microsoft.CodeAnalysis.Diagnostics;
9 | using Microsoft.CodeAnalysis.Testing.Verifiers;
10 | using Microsoft.CodeAnalysis.VisualBasic.Testing;
11 |
12 | public static partial class VisualBasicCodeFixVerifier
13 | where TAnalyzer : DiagnosticAnalyzer, new()
14 | where TCodeFix : CodeFixProvider, new()
15 | {
16 | public class Test : VisualBasicCodeFixTest
17 | {
18 | public Test()
19 | {
20 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/AnalyzerCategory.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers
5 | {
6 | ///
7 | /// Class defining the analyzer category constants.
8 | ///
9 | internal static class AnalyzerCategory
10 | {
11 | ///
12 | /// Category definition for style rules.
13 | ///
14 | public const string StyleRules = nameof(DocumentationAnalyzers) + "." + nameof(StyleRules);
15 |
16 | ///
17 | /// Category definition for portability rules.
18 | ///
19 | public const string PortabilityRules = nameof(DocumentationAnalyzers) + "." + nameof(PortabilityRules);
20 |
21 | ///
22 | /// Category definition for refactorings.
23 | ///
24 | public const string Refactorings = nameof(DocumentationAnalyzers) + "." + nameof(Refactorings);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/FixAllStatus.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Status.Generator
5 | {
6 | ///
7 | /// This enum captures the status of the implementation of a fix all provider.
8 | ///
9 | public enum FixAllStatus
10 | {
11 | ///
12 | /// No fix all provider is implemented for the given code fix.
13 | ///
14 | None,
15 |
16 | ///
17 | /// The fix all provider for this code fix uses a custom optimized implementation.
18 | ///
19 | CustomImplementation,
20 |
21 | ///
22 | /// The fix all capability is provided by the default batch fixer.
23 | /// This implementation might have various problems e.g. bad performance or it might not fix all problems at once.
24 | ///
25 | BatchFixer,
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Tunnel Vision Laboratories, LLC
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docs/PortabilityRules.md:
--------------------------------------------------------------------------------
1 | ### Portability Rules (DOC200-)
2 |
3 | Rules related to the portability of documentation comments.
4 |
5 | Identifier | Name | Description
6 | -----------|------|-------------
7 | [DOC200](DOC200.md) | UseXmlDocumentationSyntax | The documentation for the element an HTML element equivalent to a known XML documentation element.
8 | [DOC201](DOC201.md) | ItemShouldHaveDescription | The documentation for an `` within a `` did not include the required `` and/or `` elements.
9 | [DOC202](DOC202.md) | UseSectionElementsCorrectly | The documentation contains a section element where a block or inline element was expected.
10 | [DOC203](DOC203.md) | UseBlockElementsCorrectly | The documentation contains a block element where a section or inline element was expected.
11 | [DOC204](DOC204.md) | UseInlineElementsCorrectly | The documentation contains an inline element where a section or block element was expected.
12 | [DOC207](DOC207.md) | UseSeeLangwordCorrectly | The documentation contains a `` element with an unrecognized keyword.
13 | [DOC209](DOC209.md) | UseSeeHrefCorrectly | The documentation contains a `` element with an unrecognized URI.
14 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/CodeFixStatus.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Status.Generator
5 | {
6 | ///
7 | /// This enum is used to indicate whether or not a code fix is implemented.
8 | ///
9 | public enum CodeFixStatus
10 | {
11 | ///
12 | /// This value indicates, that a code fix is implemented.
13 | ///
14 | Implemented,
15 |
16 | ///
17 | /// This value indicates, that a code fix is not implemented and
18 | /// will not be implemented because it either can't be implemented
19 | /// or a code fix would not be able to fix it rationally.
20 | ///
21 | NotImplemented,
22 |
23 | ///
24 | /// This value indicates, that a code fix is not implemented because
25 | /// no one implemented it yet, or it is not yet decided if a code fix
26 | /// is going to be implemented in the future.
27 | ///
28 | NotYetImplemented,
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.CodeFixes/DocumentationAnalyzers.Metadata.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | 0.0.0
6 | $id$
7 | Sam Harwell et. al.
8 | Sam Harwell
9 | MIT
10 | https://github.com/DotNetAnalyzers/DocumentationAnalyzers
11 | false
12 | An implementation of .NET documentation rules using Roslyn analyzers and code fixes
13 | https://github.com/DotNetAnalyzers/DocumentationAnalyzers/releases/$tag$
14 | Copyright 2018 Tunnel Vision Laboratories, LLC
15 | Documentation DotNetAnalyzers Roslyn Diagnostic Analyzer
16 | true
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/docs/DOC200.md:
--------------------------------------------------------------------------------
1 | # DOC200
2 |
3 |
4 |
5 |
TypeName
6 |
DOC200UseXmlDocumentationSyntax
7 |
8 |
9 |
CheckId
10 |
DOC200
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation for the element contains an HTML element equivalent to a known XML documentation element.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when an XML documentation comment contains an HTML element instead of the corresponding
25 | XML documentation comment syntax.
26 |
27 | ## How to fix violations
28 |
29 | To fix a violation of this rule, use the expected XML documentation element instead of the HTML element.
30 |
31 | | HTML Element | XML Element |
32 | | --- | --- |
33 | | `
` | `` |
34 | | `` | `` |
35 | | `
` | `` |
36 | | `` | `` |
37 | | `
` | `` |
38 |
39 | ## How to suppress violations
40 |
41 | ```csharp
42 | #pragma warning disable DOC200 // Use XML documentation syntax
43 | ///
44 | /// Summary text with inline code.
45 | ///
46 | public void SomeOperation()
47 | #pragma warning restore DOC200 // Use XML documentation syntax
48 | {
49 | }
50 | ```
51 |
--------------------------------------------------------------------------------
/docs/DOC207.md:
--------------------------------------------------------------------------------
1 | # DOC207
2 |
3 |
4 |
5 |
TypeName
6 |
DOC207UseSeeLangwordCorrectly
7 |
8 |
9 |
CheckId
10 |
DOC207
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a `` element with an unrecognized keyword.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when documentation contains a `see langword` element but the reference is not recognized
25 | as a language keyword.
26 |
27 | ```csharp
28 | ///
29 | /// This variable is .
30 | ///
31 | public int correct;
32 | ```
33 |
34 | ## How to fix violations
35 |
36 | To fix a violation of this rule, replace the `see langword` syntax with the equivalent inline code.
37 |
38 | ```csharp
39 | ///
40 | /// This variable is correct.
41 | ///
42 | public int correct;
43 | ```
44 |
45 | ## How to suppress violations
46 |
47 | ```csharp
48 | #pragma warning disable DOC207 // Use 'see langword' correctly
49 | ///
50 | /// This variable is .
51 | ///
52 | public int correct;
53 | #pragma warning restore DOC207 // Use 'see langword' correctly
54 | ```
55 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Status.Generator/DocumentationAnalyzers.Status.Generator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net472
6 | Exe
7 |
8 |
9 | true
10 |
11 |
12 |
13 | ..\DocumentationAnalyzers.Internal.ruleset
14 |
15 |
16 |
17 | true
18 | ..\..\build\keys\TestingKey.snk
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/DocumentationAnalyzers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | netstandard1.1;net452
6 |
7 |
8 |
9 |
10 |
11 | portable-net45+win8
12 |
13 |
14 |
15 |
16 |
17 | ..\DocumentationAnalyzers.ruleset
18 |
19 |
20 |
21 | true
22 | ..\..\build\keys\DocumentationAnalyzers.snk
23 | ..\..\build\keys\DocumentationAnalyzers.dev.snk
24 |
25 |
26 |
27 | $(DefineConstants);DEVELOPMENT_KEY
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/docs/DOC105.md:
--------------------------------------------------------------------------------
1 | # DOC105
2 |
3 |
4 |
5 |
TypeName
6 |
DOC105UseParamref
7 |
8 |
9 |
CheckId
10 |
DOC105
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a parameter reference using `name` that can be converted to the preferred form
21 | ``.
22 |
23 | ## Rule description
24 |
25 | A violation of this rule occurs when documentation contains a parameter reference written in inline code that can be
26 | written in a preferred form using `paramref`.
27 |
28 | ```csharp
29 | ///
30 | /// Pass in a value.
31 | ///
32 | public void Method(int value)
33 | {
34 | }
35 | ```
36 |
37 | ## How to fix violations
38 |
39 | To fix a violation of this rule, replace the inline code with the equivalent `paramref` syntax.
40 |
41 | ```csharp
42 | ///
43 | /// Pass in a .
44 | ///
45 | public void Method(int value)
46 | {
47 | }
48 | ```
49 |
50 | ## How to suppress violations
51 |
52 | ```csharp
53 | #pragma warning disable DOC105 // Use 'paramref'
54 | ///
55 | /// Pass in a value.
56 | ///
57 | public void Method(int value)
58 | #pragma warning restore DOC104 // Use 'paramref'
59 | {
60 | }
61 | ```
62 |
--------------------------------------------------------------------------------
/docs/DOC106.md:
--------------------------------------------------------------------------------
1 | # DOC106
2 |
3 |
4 |
5 |
TypeName
6 |
DOC106UseTypeparamref
7 |
8 |
9 |
CheckId
10 |
DOC106
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a type parameter reference using `T` that can be converted to the preferred form
21 | ``.
22 |
23 | ## Rule description
24 |
25 | A violation of this rule occurs when documentation contains a type parameter reference written in inline code that can
26 | be written in a preferred form using `typeparamref`.
27 |
28 | ```csharp
29 | ///
30 | /// Pass in a T.
31 | ///
32 | public void Method()
33 | {
34 | }
35 | ```
36 |
37 | ## How to fix violations
38 |
39 | To fix a violation of this rule, replace the inline code with the equivalent `typeparamref` syntax.
40 |
41 | ```csharp
42 | ///
43 | /// Pass in a .
44 | ///
45 | public void Method()
46 | {
47 | }
48 | ```
49 |
50 | ## How to suppress violations
51 |
52 | ```csharp
53 | #pragma warning disable DOC106 // Use 'typeparamref'
54 | ///
55 | /// Pass in a T.
56 | ///
57 | public void Method()
58 | #pragma warning restore DOC106 // Use 'typeparamref'
59 | {
60 | }
61 | ```
62 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test.CSharp7/DocumentationAnalyzers.Test.CSharp7.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net46
6 | true
7 | true
8 |
9 |
10 |
11 | ..\DocumentationAnalyzers.Internal.ruleset
12 |
13 |
14 |
15 | true
16 | ..\..\build\keys\TestingKey.snk
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/docs/DOC104.md:
--------------------------------------------------------------------------------
1 | # DOC104
2 |
3 |
4 |
5 |
TypeName
6 |
DOC104UseSeeLangword
7 |
8 |
9 |
CheckId
10 |
DOC104
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a language keyword reference using `keyword` that can be converted to the preferred
21 | form ``.
22 |
23 | ## Rule description
24 |
25 | A violation of this rule occurs when documentation contains a language keyword reference written in inline code that can
26 | be written in a preferred form using `see langword`.
27 |
28 | ```csharp
29 | ///
30 | /// This type is sealed.
31 | ///
32 | public sealed class SomeType
33 | {
34 | }
35 | ```
36 |
37 | ## How to fix violations
38 |
39 | To fix a violation of this rule, replace the inline code with the equivalent `see langword` syntax.
40 |
41 | ```csharp
42 | ///
43 | /// This type is .
44 | ///
45 | public sealed class SomeType
46 | {
47 | }
48 | ```
49 |
50 | ## How to suppress violations
51 |
52 | ```csharp
53 | #pragma warning disable DOC104 // Use 'see langword'
54 | ///
55 | /// This type is sealed.
56 | ///
57 | public sealed class SomeType
58 | #pragma warning restore DOC104 // Use 'see langword'
59 | {
60 | }
61 | ```
62 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.CodeFixes/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | using System;
5 | using System.Runtime.CompilerServices;
6 | using System.Runtime.InteropServices;
7 |
8 | [assembly: CLSCompliant(false)]
9 |
10 | // Setting ComVisible to false makes the types in this assembly not visible
11 | // to COM components. If you need to access a type in this assembly from
12 | // COM, set the ComVisible attribute to true on that type.
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: InternalsVisibleTo("DocumentationAnalyzers.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d394e527140f84e656e715fc026e74b57657f47ff20636a0d90719bd0fd86b49ccfe3feb0a486b08b994bf8d68ead40ce4a993019c701b4d52c4c86ed88491edae914154b238c8378736b87529fd91502426263242fc5b800ee7a25a8a34f838f2dd1d20a483ccdfa0f6e1f08afb0d650d90b024ab129c1b840189d27b845c8")]
16 | [assembly: InternalsVisibleTo("DocumentationAnalyzers.Test.CSharp7, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d394e527140f84e656e715fc026e74b57657f47ff20636a0d90719bd0fd86b49ccfe3feb0a486b08b994bf8d68ead40ce4a993019c701b4d52c4c86ed88491edae914154b238c8378736b87529fd91502426263242fc5b800ee7a25a8a34f838f2dd1d20a483ccdfa0f6e1f08afb0d650d90b024ab129c1b840189d27b845c8")]
17 |
--------------------------------------------------------------------------------
/docs/DOC107.md:
--------------------------------------------------------------------------------
1 | # DOC107
2 |
3 |
4 |
5 |
TypeName
6 |
DOC107UseSeeCref
7 |
8 |
9 |
CheckId
10 |
DOC107
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a code element reference using `name` that can be converted to the preferred form
21 | ``.
22 |
23 | ## Rule description
24 |
25 | A violation of this rule occurs when documentation contains a code element reference written in inline code that can
26 | be written in a preferred form using `see cref`.
27 |
28 | ```csharp
29 | int SomeValue { get; }
30 |
31 | ///
32 | /// Depends on SomeValue.
33 | ///
34 | public void Method()
35 | {
36 | }
37 | ```
38 |
39 | ## How to fix violations
40 |
41 | To fix a violation of this rule, replace the inline code with the equivalent `see cref` syntax.
42 |
43 | ```csharp
44 | int SomeValue { get; }
45 |
46 | ///
47 | /// Depends on .
48 | ///
49 | public void Method()
50 | {
51 | }
52 | ```
53 |
54 | ## How to suppress violations
55 |
56 | ```csharp
57 | int SomeValue { get; }
58 |
59 | #pragma warning disable DOC107 // Use 'see cref'
60 | ///
61 | /// Depends on SomeValue.
62 | ///
63 | public void Method()
64 | #pragma warning restore DOC107 // Use 'see cref'
65 | {
66 | }
67 | ```
68 |
--------------------------------------------------------------------------------
/docs/DOC100.md:
--------------------------------------------------------------------------------
1 | # DOC100
2 |
3 |
4 |
5 |
TypeName
6 |
DOC100PlaceTextInParagraphs
7 |
8 |
9 |
CheckId
10 |
DOC100
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | A `` or `` documentation element contains content which is not wrapped in a block-level element.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when a `` or `` documentation element contains content which is not
25 | wrapped in a block-level element.
26 |
27 | ```csharp
28 | /// Summary text.
29 | ///
30 | /// Remarks text.
31 | ///
32 | public void SomeOperation()
33 | {
34 | }
35 | ```
36 |
37 | ## How to fix violations
38 |
39 | To fix a violation of this rule, place the content in a block-level element, such as a `` element.
40 |
41 | ```csharp
42 | /// Summary text.
43 | ///
44 | /// Remarks text.
45 | ///
46 | public void SomeOperation()
47 | {
48 | }
49 | ```
50 |
51 | ## How to suppress violations
52 |
53 | ```csharp
54 | #pragma warning disable DOC100 // Place text in paragraphs
55 | ///
56 | /// Summary text.
57 | ///
58 | ///
59 | /// Inline remarks.
60 | ///
61 | public void SomeOperation()
62 | #pragma warning restore DOC100 // Place text in paragraphs
63 | {
64 | }
65 | ```
66 |
--------------------------------------------------------------------------------
/docs/DOC103.md:
--------------------------------------------------------------------------------
1 | # DOC103
2 |
3 |
4 |
5 |
TypeName
6 |
DOC103UseUnicodeCharacters
7 |
8 |
9 |
CheckId
10 |
DOC103
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains an unnecessary or unrecognized HTML character entity.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when documentation an unnecessarily-escaped character, making the documentation more
25 | difficult to read than necessary. The code fix for this diagnostic also helps correct HTML character entity references
26 | (e.g. `&rarr`), which are not supported by the XML documentation compiler.
27 |
28 | ```csharp
29 | ///
30 | /// A city's graph from A→B.
31 | ///
32 | public class SomeType
33 | {
34 | }
35 | ```
36 |
37 | ## How to fix violations
38 |
39 | To fix a violation of this rule, replace the XML- or HTML-escape sequence with the intended character.
40 |
41 | ```csharp
42 | ///
43 | /// A city's graph from A→B.
44 | ///
45 | public class SomeType
46 | {
47 | }
48 | ```
49 |
50 | ## How to suppress violations
51 |
52 | ```csharp
53 | #pragma warning disable DOC103 // Use Unicode characters
54 | ///
55 | /// A city's graph from A→B.
56 | ///
57 | public class SomeType
58 | #pragma warning restore DOC103 // Use Unicode characters
59 | {
60 | }
61 | ```
62 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/WorkItemAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System;
7 |
8 | ///
9 | /// Used to tag test methods or types which are created for a given work item.
10 | ///
11 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
12 | public sealed class WorkItemAttribute : Attribute
13 | {
14 | ///
15 | /// Initializes a new instance of the class.
16 | ///
17 | /// The ID of the issue in the original tracker where the work item was first reported. This
18 | /// could be a GitHub issue or pull request number, or the number of a Microsoft-internal bug.
19 | /// The URI where the work item can be viewed. This is a link to work item
20 | /// in the original source.
21 | public WorkItemAttribute(int id, string issueUri)
22 | {
23 | Id = id;
24 | Location = issueUri;
25 | }
26 |
27 | public int Id
28 | {
29 | get;
30 | }
31 |
32 | public string Location
33 | {
34 | get;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/CSharpAnalyzerVerifier`1+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.CSharp.Testing;
8 | using Microsoft.CodeAnalysis.Diagnostics;
9 | using Microsoft.CodeAnalysis.Testing.Verifiers;
10 |
11 | public static partial class CSharpAnalyzerVerifier
12 | where TAnalyzer : DiagnosticAnalyzer, new()
13 | {
14 | public class Test : CSharpAnalyzerTest
15 | {
16 | public Test()
17 | {
18 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
19 |
20 | SolutionTransforms.Add((solution, projectId) =>
21 | {
22 | var compilationOptions = solution.GetProject(projectId).CompilationOptions;
23 | compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(
24 | compilationOptions.SpecificDiagnosticOptions.SetItems(CSharpVerifierHelper.NullableWarnings));
25 | solution = solution.WithProjectCompilationOptions(projectId, compilationOptions);
26 |
27 | return solution;
28 | });
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/CSharpCodeRefactoringVerifier`1+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.CodeRefactorings;
8 | using Microsoft.CodeAnalysis.CSharp.Testing;
9 | using Microsoft.CodeAnalysis.Testing.Verifiers;
10 |
11 | public static partial class CSharpCodeRefactoringVerifier
12 | where TCodeRefactoring : CodeRefactoringProvider, new()
13 | {
14 | public class Test : CSharpCodeRefactoringTest
15 | {
16 | public Test()
17 | {
18 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
19 |
20 | SolutionTransforms.Add((solution, projectId) =>
21 | {
22 | var compilationOptions = solution.GetProject(projectId).CompilationOptions;
23 | compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(
24 | compilationOptions.SpecificDiagnosticOptions.SetItems(CSharpVerifierHelper.NullableWarnings));
25 | solution = solution.WithProjectCompilationOptions(projectId, compilationOptions);
26 |
27 | return solution;
28 | });
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/docs/DOC108.md:
--------------------------------------------------------------------------------
1 | # DOC108
2 |
3 |
4 |
5 |
TypeName
6 |
DOC108AvoidEmptyParagraphs
7 |
8 |
9 |
CheckId
10 |
DOC108
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains an empty paragraph element (`` or ``) used as a paragraph separator.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when a `` or `` is used as a paragraph separator. Rather than place an empty
25 | paragraph element between paragraphs, the text content of paragraphs should be contained in the `` element.
26 |
27 | ```csharp
28 | /// Summary text.
29 | ///
30 | /// Remarks text.
31 | ///
32 | /// Second paragraph of remarks, which is not placed inside the <para> element.
33 | ///
34 | public void SomeOperation()
35 | {
36 | }
37 | ```
38 |
39 | ## How to fix violations
40 |
41 | To fix a violation of this rule, update the comment so the `` element wraps the documentation text which follows
42 | it:
43 |
44 | ```csharp
45 | /// Summary text.
46 | ///
47 | /// Remarks text.
48 | /// Second paragraph of remarks, which is now placed inside the <para> element.
49 | ///
50 | public void SomeOperation()
51 | {
52 | }
53 | ```
54 |
55 | ## How to suppress violations
56 |
57 | Do not suppress violations of this rule. If the preferred documentation style does not align with the rule decription,
58 | it is best to disable the rule.
59 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/Helpers/SyntaxNodeExtensionsEx.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Helpers
5 | {
6 | using Microsoft.CodeAnalysis;
7 | using Microsoft.CodeAnalysis.CSharp;
8 |
9 | internal static class SyntaxNodeExtensionsEx
10 | {
11 | public static bool IsSymbolDeclaration(this SyntaxNode node)
12 | {
13 | switch (node.Kind())
14 | {
15 | case SyntaxKind.ClassDeclaration:
16 | case SyntaxKind.ConstructorDeclaration:
17 | case SyntaxKind.ConversionOperatorDeclaration:
18 | case SyntaxKind.DelegateDeclaration:
19 | case SyntaxKind.DestructorDeclaration:
20 | case SyntaxKind.EnumDeclaration:
21 | case SyntaxKind.EnumMemberDeclaration:
22 | case SyntaxKind.EventDeclaration:
23 | case SyntaxKind.EventFieldDeclaration:
24 | case SyntaxKind.FieldDeclaration:
25 | case SyntaxKind.IndexerDeclaration:
26 | case SyntaxKind.InterfaceDeclaration:
27 | case SyntaxKind.MethodDeclaration:
28 | case SyntaxKind.NamespaceDeclaration:
29 | case SyntaxKind.OperatorDeclaration:
30 | case SyntaxKind.PropertyDeclaration:
31 | case SyntaxKind.StructDeclaration:
32 | return true;
33 |
34 | default:
35 | return false;
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/CSharpCodeFixVerifier`2+Test.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Runtime.CompilerServices;
7 | using Microsoft.CodeAnalysis.CodeFixes;
8 | using Microsoft.CodeAnalysis.CSharp.Testing;
9 | using Microsoft.CodeAnalysis.Diagnostics;
10 | using Microsoft.CodeAnalysis.Testing.Verifiers;
11 |
12 | public static partial class CSharpCodeFixVerifier
13 | where TAnalyzer : DiagnosticAnalyzer, new()
14 | where TCodeFix : CodeFixProvider, new()
15 | {
16 | public class Test : CSharpCodeFixTest
17 | {
18 | public Test()
19 | {
20 | RuntimeHelpers.RunClassConstructor(typeof(CSharpVerifierHelper).TypeHandle);
21 |
22 | SolutionTransforms.Add((solution, projectId) =>
23 | {
24 | var compilationOptions = solution.GetProject(projectId).CompilationOptions;
25 | compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(
26 | compilationOptions.SpecificDiagnosticOptions.SetItems(CSharpVerifierHelper.NullableWarnings));
27 | solution = solution.WithProjectCompilationOptions(projectId, compilationOptions);
28 |
29 | return solution;
30 | });
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/docs/DOC202.md:
--------------------------------------------------------------------------------
1 | # DOC202
2 |
3 |
4 |
5 |
TypeName
6 |
DOC202UseSectionElementsCorrectly
7 |
8 |
9 |
CheckId
10 |
DOC202
11 |
12 |
13 |
Category
14 |
Portability Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | The documentation contains a section element where a block or inline element was expected.
21 |
22 | ## Rule description
23 |
24 | *TODO*
25 |
26 | ```csharp
27 | ///
28 | /// Summary text.
29 | ///
30 | /// Here is an example:
31 | ///
32 | /// Console.WriteLine();
33 | ///
34 | ///
35 | ///
36 | public void SomeOperation()
37 | {
38 | }
39 | ```
40 |
41 | ## How to fix violations
42 |
43 | To fix a violation of this rule, move the section element outside the block or inline element context, or replace the
44 | section element with an appropriate block or inline element.
45 |
46 | ### Option: Move the section element outside the block element
47 |
48 | ```csharp
49 | ///
50 | /// Summary text.
51 | ///
52 | ///
53 | /// Here is an example:
54 | ///
55 | /// Console.WriteLine();
56 | ///
57 | ///
58 | public void SomeOperation()
59 | {
60 | }
61 | ```
62 |
63 | ### Option: Use an appropriate block element instead of the section element
64 |
65 | ```csharp
66 | ///
67 | /// Summary text.
68 | /// Here is an example:
69 | ///
70 | /// Console.WriteLine();
71 | ///
72 | ///
73 | public void SomeOperation()
74 | {
75 | }
76 | ```
77 |
78 | ## How to suppress violations
79 |
80 | *TODO*
81 |
--------------------------------------------------------------------------------
/docs/DOC101.md:
--------------------------------------------------------------------------------
1 | # DOC101
2 |
3 |
4 |
5 |
TypeName
6 |
DOC101UseChildBlocksConsistently
7 |
8 |
9 |
CheckId
10 |
DOC101
11 |
12 |
13 |
Category
14 |
Style Rules
15 |
16 |
17 |
18 | ## Cause
19 |
20 | A documentation element contains some children which are block-level elements, but other children which are not.
21 |
22 | ## Rule description
23 |
24 | A violation of this rule occurs when a documentation element contains some children which are block-level elements, but
25 | other children which are not.
26 |
27 | ```csharp
28 | /// Summary text.
29 | ///
30 | /// Parameter documentation.
31 | /// Parameter documentation continued.
32 | ///
33 | public void SomeOperation(int x)
34 | {
35 | }
36 | ```
37 |
38 | ## How to fix violations
39 |
40 | To fix a violation of this rule, place the content in a block-level element, such as a `` element.
41 |
42 | ```csharp
43 | /// Summary text.
44 | ///
45 | /// Parameter documentation.
46 | /// Parameter documentation continued.
47 | ///
48 | public void SomeOperation(int x)
49 | {
50 | }
51 | ```
52 |
53 | ## How to suppress violations
54 |
55 | ```csharp
56 | #pragma warning disable DOC101 // Use child blocks consistently
57 | /// Summary text.
58 | ///
59 | /// Inline content.
60 | /// Block content.
61 | ///
62 | public void SomeOperation(int x)
63 | #pragma warning restore DOC101 // Use child blocks consistently
64 | {
65 | }
66 | ```
67 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.CodeFixes/Helpers/CustomFixAllProviders.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Helpers
5 | {
6 | using Microsoft.CodeAnalysis.CodeActions;
7 | using Microsoft.CodeAnalysis.CodeFixes;
8 |
9 | ///
10 | /// Contains custom implementations of .
11 | ///
12 | internal static class CustomFixAllProviders
13 | {
14 | ///
15 | /// Gets the default batch fix all provider.
16 | /// This provider batches all the individual diagnostic fixes across the scope of fix all action,
17 | /// computes fixes in parallel and then merges all the non-conflicting fixes into a single fix all code action.
18 | /// This fixer supports fixes for the following fix all scopes:
19 | /// , and .
20 | ///
21 | ///
22 | /// The batch fix all provider only batches operations (i.e. ) of type
23 | /// present within the individual diagnostic fixes. Other types of
24 | /// operations present within these fixes are ignored.
25 | ///
26 | ///
27 | /// The default batch fix all provider.
28 | ///
29 | public static FixAllProvider BatchFixer => CustomBatchFixAllProvider.Instance;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: '{build}'
2 | image: Visual Studio 2019
3 | init:
4 | - git config --global core.autocrlf true
5 | configuration:
6 | - Debug
7 | - Release
8 | before_build:
9 | - nuget restore
10 | skip_tags: true
11 | build:
12 | project: DocumentationAnalyzers.sln
13 | verbosity: minimal
14 | test_script:
15 | - cd build
16 | - ps: |
17 | if ($env:Configuration -eq 'Debug') {
18 | .\opencover-report.ps1 -Debug -NoBuild -NoReport -AppVeyor
19 | if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
20 | $packageConfig = [xml](Get-Content ..\.nuget\packages.config)
21 | $codecov_version = $packageConfig.SelectSingleNode('/packages/package[@id="Codecov"]').version
22 | $codecov = "..\packages\Codecov.$codecov_version\tools\codecov.exe"
23 | &$codecov -f '..\build\OpenCover.Reports\OpenCover.DocumentationAnalyzers.xml'
24 | } else {
25 | .\opencover-report.ps1 -NoBuild -NoReport -AppVeyor
26 | if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
27 | }
28 | - cd ..
29 | - .\DocumentationAnalyzers\DocumentationAnalyzers.Status.Generator\bin\%Configuration%\net472\DocumentationAnalyzers.Status.Generator.exe .\DocumentationAnalyzers.sln > DocumentationAnalyzers.Status.json
30 | cache:
31 | - packages -> **\packages.config
32 | - C:\Users\appveyor\.nuget\packages -> appveyor.yml
33 |
34 | # 'Release' is hard-coded to ensure VSIX and NuGet artifacts are only published for release configuration builds
35 | artifacts:
36 | - path: 'DocumentationAnalyzers\DocumentationAnalyzers.Vsix\bin\Release\net452\*.vsix'
37 | - path: 'DocumentationAnalyzers\DocumentationAnalyzers.CodeFixes\bin\Release\*.nupkg'
38 | - path: 'DocumentationAnalyzers.Status.json'
39 |
--------------------------------------------------------------------------------
/docs/StyleRules.md:
--------------------------------------------------------------------------------
1 | ### Style Rules (DOC100-)
2 |
3 | Rules related to the style of documentation comments.
4 |
5 | Identifier | Name | Description
6 | -----------|------|-------------
7 | [DOC100](DOC100.md) | PlaceTextInParagraphs | A `` or `` documentation element contains content which is not wrapped in a block-level element.
8 | [DOC101](DOC101.md) | UseChildBlocksConsistently | The documentation for the element contains some text which is wrapped in block-level elements, and other text which is written inline.
9 | [DOC102](DOC102.md) | UseChildBlocksConsistentlyAcrossElementsOfTheSameKind | The documentation for the element contains inline text, but the documentation for a sibling element of the same kind uses block-level elements.
10 | [DOC103](DOC103.md) | UseUnicodeCharacters | The documentation contains an unnecessary or unrecognized HTML character entity.
11 | [DOC104](DOC104.md) | UseSeeLangword | The documentation contains a language keyword reference using `keyword` that can be converted to the preferred form ``.
12 | [DOC105](DOC105.md) | UseParamref | The documentation contains a parameter reference using `name` that can be converted to the preferred form ``.
13 | [DOC106](DOC106.md) | UseTypeparamref | The documentation contains a type parameter reference using `T` that can be converted to the preferred form ``.
14 | [DOC107](DOC107.md) | UseSeeCref | The documentation contains a code element reference using `name` that can be converted to the preferred form ``.
15 | [DOC108](DOC108.md) | AvoidEmptyParagraphs | The documentation contains an empty paragraph element (`` or ``) used as a paragraph separator.
16 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Vsix/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Documentation Analyzers
6 | An implementation of .NET documentation rules using Roslyn analyzers and code fixes
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/StyleRules/InlineCodeAnalyzerBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.StyleRules
5 | {
6 | using DocumentationAnalyzers.Helpers;
7 | using Microsoft.CodeAnalysis.CSharp;
8 | using Microsoft.CodeAnalysis.CSharp.Syntax;
9 | using Microsoft.CodeAnalysis.Diagnostics;
10 |
11 | ///
12 | /// This is the base class for diagnostic analyzers which report diagnostics for use of <c> which a
13 | /// more appropriate inline element is available.
14 | ///
15 | internal abstract class InlineCodeAnalyzerBase : DiagnosticAnalyzer
16 | {
17 | ///
18 | public override void Initialize(AnalysisContext context)
19 | {
20 | context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
21 | context.EnableConcurrentExecution();
22 |
23 | context.RegisterSyntaxNodeAction(HandleXmlElementSyntax, SyntaxKind.XmlElement);
24 | }
25 |
26 | protected abstract void HandleInlineCodeElement(ref SyntaxNodeAnalysisContext context, XmlElementSyntax xmlElement);
27 |
28 | private void HandleXmlElementSyntax(SyntaxNodeAnalysisContext context)
29 | {
30 | var xmlElement = (XmlElementSyntax)context.Node;
31 | var name = xmlElement.StartTag.Name;
32 | if (name.Prefix != null)
33 | {
34 | return;
35 | }
36 |
37 | if (name.LocalName.ValueText != XmlCommentHelper.CXmlTag)
38 | {
39 | return;
40 | }
41 |
42 | HandleInlineCodeElement(ref context, xmlElement);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers/NoCodeFixAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers
5 | {
6 | using System;
7 | using Microsoft.CodeAnalysis.Diagnostics;
8 |
9 | ///
10 | /// This attribute is applied to s for which no code fix is currently planned.
11 | ///
12 | ///
13 | /// There are several reasons an analyzer does not have a code fix, including but not limited to the
14 | /// following:
15 | ///
16 | /// Visual Studio provides a built-in code fix.
17 | /// A code fix could not provide a useful solution.
18 | ///
19 | /// The should be provided.
20 | ///
21 | [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
22 | internal sealed class NoCodeFixAttribute : System.Attribute
23 | {
24 | ///
25 | /// Initializes a new instance of the class.
26 | ///
27 | /// The reason why the does not have a code fix.
28 | public NoCodeFixAttribute(string reason)
29 | {
30 | Reason = reason;
31 | }
32 |
33 | ///
34 | /// Gets the reason why the does not have a code fix.
35 | ///
36 | ///
37 | /// The reason why the does not have a code fix.
38 | ///
39 | public string Reason
40 | {
41 | get;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/CSharpCodeRefactoringVerifier`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using Microsoft.CodeAnalysis.CodeRefactorings;
9 | using Microsoft.CodeAnalysis.Testing;
10 |
11 | public static partial class CSharpCodeRefactoringVerifier
12 | where TCodeRefactoring : CodeRefactoringProvider, new()
13 | {
14 | ///
15 | public static async Task VerifyRefactoringAsync(string source, string fixedSource)
16 | {
17 | await VerifyRefactoringAsync(source, DiagnosticResult.EmptyDiagnosticResults, fixedSource);
18 | }
19 |
20 | ///
21 | public static async Task VerifyRefactoringAsync(string source, DiagnosticResult expected, string fixedSource)
22 | {
23 | await VerifyRefactoringAsync(source, new[] { expected }, fixedSource);
24 | }
25 |
26 | ///
27 | public static async Task VerifyRefactoringAsync(string source, DiagnosticResult[] expected, string fixedSource)
28 | {
29 | var test = new Test
30 | {
31 | TestCode = source,
32 | FixedCode = fixedSource,
33 | };
34 |
35 | test.ExpectedDiagnostics.AddRange(expected);
36 | await test.RunAsync(CancellationToken.None);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/Verifiers/VisualBasicCodeRefactoringVerifier`1.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using Microsoft.CodeAnalysis.CodeRefactorings;
9 | using Microsoft.CodeAnalysis.Testing;
10 |
11 | public static partial class VisualBasicCodeRefactoringVerifier
12 | where TCodeRefactoring : CodeRefactoringProvider, new()
13 | {
14 | ///
15 | public static async Task VerifyRefactoringAsync(string source, string fixedSource)
16 | {
17 | await VerifyRefactoringAsync(source, DiagnosticResult.EmptyDiagnosticResults, fixedSource);
18 | }
19 |
20 | ///
21 | public static async Task VerifyRefactoringAsync(string source, DiagnosticResult expected, string fixedSource)
22 | {
23 | await VerifyRefactoringAsync(source, new[] { expected }, fixedSource);
24 | }
25 |
26 | ///
27 | public static async Task VerifyRefactoringAsync(string source, DiagnosticResult[] expected, string fixedSource)
28 | {
29 | var test = new Test
30 | {
31 | TestCode = source,
32 | FixedCode = fixedSource,
33 | };
34 |
35 | test.ExpectedDiagnostics.AddRange(expected);
36 | await test.RunAsync(CancellationToken.None);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/DocumentationAnalyzers/DocumentationAnalyzers.Test/PublicApiTests.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2 | // Licensed under the MIT license. See LICENSE in the project root for license information.
3 |
4 | namespace DocumentationAnalyzers.Test
5 | {
6 | using System;
7 | using System.Text;
8 | using DocumentationAnalyzers.Helpers;
9 | using Xunit;
10 |
11 | ///
12 | /// Unit tests related to the public API surface of DocumentationAnalyzers.dll.
13 | ///
14 | public class PublicApiTests
15 | {
16 | ///
17 | /// This test ensures all types in DocumentationAnalyzers.dll are marked internal.
18 | ///
19 | [Fact]
20 | public void TestAllAnalyzerTypesAreInternal()
21 | {
22 | var publicTypes = new StringBuilder();
23 | foreach (Type type in typeof(AnalyzerCategory).Assembly.ExportedTypes)
24 | {
25 | if (publicTypes.Length > 0)
26 | {
27 | publicTypes.Append(", ");
28 | }
29 |
30 | publicTypes.Append(type.Name);
31 | }
32 |
33 | Assert.Equal(string.Empty, publicTypes.ToString());
34 | }
35 |
36 | ///
37 | /// This test ensures all types in DocumentationAnalyzers.CodeFixes.dll are marked internal.
38 | ///
39 | [Fact]
40 | public void TestAllCodeFixTypesAreInternal()
41 | {
42 | var publicTypes = new StringBuilder();
43 | foreach (Type type in typeof(CustomBatchFixAllProvider).Assembly.ExportedTypes)
44 | {
45 | if (publicTypes.Length > 0)
46 | {
47 | publicTypes.Append(", ");
48 | }
49 |
50 | publicTypes.Append(type.Name);
51 | }
52 |
53 | Assert.Equal(string.Empty, publicTypes.ToString());
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/docs/DOC102.md:
--------------------------------------------------------------------------------
1 | # DOC102
2 |
3 |