Skip to content

Commit b61d51e

Browse files
authored
Merge pull request #2727 from sharwell/update-beta008
Update to StyleCop Analyzers 1.1.0-beta008
2 parents 6b8f8f3 + fb1bde1 commit b61d51e

93 files changed

Lines changed: 229 additions & 292 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

StyleCop.Analyzers/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
<ItemGroup>
4444
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
45-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta007" PrivateAssets="all" />
45+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta008" PrivateAssets="all" />
4646
</ItemGroup>
4747

4848
<ItemGroup>

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/OrderingRules/SA1206CodeFixProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static SyntaxTokenList FullySortModifiers(SyntaxTokenList modifiers)
107107
/// </summary>
108108
/// <param name="modifiers">All modifiers from the declaration.</param>
109109
/// <param name="modifierToFix">The modifier with diagnostics.</param>
110-
/// <returns>A partially sorted modifier list (sorted up to <paramref name="modifierToFix"/>)</returns>
110+
/// <returns>A partially sorted modifier list (sorted up to <paramref name="modifierToFix"/>).</returns>
111111
private static SyntaxTokenList PartiallySortModifiers(SyntaxTokenList modifiers, SyntaxToken modifierToFix)
112112
{
113113
var accessModifiers = modifiers.Where(modifier => GetModifierType(modifier) == ModifierType.Access);

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/OrderingRules/UsingCodeFixProvider.SourceMap.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ internal sealed partial class UsingCodeFixProvider
1818
{
1919
/// <summary>
2020
/// Contains a map of the different regions of a source file.
21-
/// Used source file regions are:
22-
/// - conditional directives (#if, #else, #elif, #endif)
23-
/// - pragma warning directives
24-
/// - region directives
2521
/// </summary>
22+
/// <remarks>
23+
/// <para>Used source file regions are:</para>
24+
///
25+
/// <list type="bullet">
26+
/// <item>conditional directives (#if, #else, #elif, #endif)</item>
27+
/// <item>pragma warning directives</item>
28+
/// <item>region directives</item>
29+
/// </list>
30+
/// </remarks>
2631
private class SourceMap
2732
{
2833
private readonly TreeTextSpan regionRoot;
@@ -42,7 +47,7 @@ private SourceMap(TreeTextSpan conditionalRoot, TreeTextSpan regionRoot, TreeTex
4247
internal TreeTextSpan ConditionalRoot { get; }
4348

4449
/// <summary>
45-
/// Constructs the directive map for the given <paramref name="compilationUnit"/>
50+
/// Constructs the directive map for the given <paramref name="compilationUnit"/>.
4651
/// </summary>
4752
/// <param name="compilationUnit">The compilation unit to scan for directive trivia.</param>
4853
/// <returns>A new <see cref="SourceMap"/> object containing the directive trivia information from the passed <paramref name="compilationUnit"/>.</returns>

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/CodeFixStatus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace StyleCop.Analyzers.Status.Generator
55
{
66
/// <summary>
7-
/// This enum is used to indicate whether or not a code fix is implemented
7+
/// This enum is used to indicate whether or not a code fix is implemented.
88
/// </summary>
99
public enum CodeFixStatus
1010
{

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/SolutionReader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ private SolutionReader()
6262
/// <summary>
6363
/// Creates a new instance of the <see cref="SolutionReader"/> class.
6464
/// </summary>
65-
/// <param name="pathToSln">The path to the StyleCop.Analayzers sln</param>
66-
/// <param name="analyzerProjectName">The project name of the analyzer project</param>
67-
/// <param name="codeFixProjectName">The project name of the code fix project</param>
68-
/// <returns>A <see cref="Task{SolutionReader}"/> representing the asynchronous operation</returns>
65+
/// <param name="pathToSln">The path to the StyleCop.Analayzers solution.</param>
66+
/// <param name="analyzerProjectName">The project name of the analyzer project.</param>
67+
/// <param name="codeFixProjectName">The project name of the code fix project.</param>
68+
/// <returns>A <see cref="Task{TResult}"/> representing the asynchronous operation.</returns>
6969
public static async Task<SolutionReader> CreateAsync(string pathToSln, string analyzerProjectName = "StyleCop.Analyzers", string codeFixProjectName = "StyleCop.Analyzers.CodeFixes")
7070
{
7171
SolutionReader reader = new SolutionReader();

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/StyleCopDiagnostic.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace StyleCop.Analyzers.Status.Generator
77
using Newtonsoft.Json.Converters;
88

99
/// <summary>
10-
/// Represents a diagnostic in the StyleCop.Analyzers project
10+
/// Represents a diagnostic in the StyleCop.Analyzers project.
1111
/// </summary>
1212
public class StyleCopDiagnostic
1313
{
@@ -97,15 +97,15 @@ public class StyleCopDiagnostic
9797
/// Creates an instance of the <see cref="StyleCopDiagnostic"/> class
9898
/// that is populated with the data stored in <paramref name="value"/>.
9999
/// </summary>
100-
/// <param name="value">A json representing a <see cref="StyleCopDiagnostic"/></param>
100+
/// <param name="value">A JSON string representing a <see cref="StyleCopDiagnostic"/>.</param>
101101
/// <returns>A <see cref="StyleCopDiagnostic"/> that is populated with the data stored in <paramref name="value"/>.</returns>
102102
public static StyleCopDiagnostic FromJson(string value)
103103
{
104104
return JsonConvert.DeserializeObject<StyleCopDiagnostic>(value);
105105
}
106106

107107
/// <summary>
108-
/// Returns a string representing this diagnostic
108+
/// Returns a string representing this diagnostic.
109109
/// </summary>
110110
/// <returns>
111111
/// The string contains the diagnostic id and the short name.
@@ -116,9 +116,9 @@ public override string ToString()
116116
}
117117

118118
/// <summary>
119-
/// Returns a json representation of this diagnostic
119+
/// Returns a JSON representation of this diagnostic.
120120
/// </summary>
121-
/// <returns>A json string representing this diagnostic</returns>
121+
/// <returns>A JSON string representing this diagnostic.</returns>
122122
public string ToJson()
123123
{
124124
return JsonConvert.SerializeObject(this);

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/ReadabilityRules/SA1125CSharp7UnitTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class SA1125CSharp7UnitTests : SA1125UnitTests
1515
/// <summary>
1616
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#386.
1717
/// <see href="https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/386">SA1125
18-
/// UseShorthandForNullableTypes incorrectly reported in typeof()</see>
18+
/// UseShorthandForNullableTypes incorrectly reported in typeof()</see>.
1919
/// </summary>
2020
/// <param name="longForm">The source code for the long form of a <c>cref</c> attribute referencing
2121
/// an instantiation of <see cref="Nullable{T}"/> in a <c>typeof</c> expression.</param>
@@ -117,7 +117,7 @@ void MethodName()
117117
/// <summary>
118118
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#637.
119119
/// <see href="https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/637">SA1125
120-
/// UseShorthandForNullableTypes incorrectly reported in <c>nameof</c> expression</see>
120+
/// UseShorthandForNullableTypes incorrectly reported in <c>nameof</c> expression</see>.
121121
/// </summary>
122122
/// <param name="form">The source code for the content of a <c>nameof</c> expression referencing
123123
/// <see cref="Nullable{T}"/>.</param>
@@ -145,7 +145,7 @@ class ClassName<T>
145145
/// <summary>
146146
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#636.
147147
/// <see href="https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/636">SA1125
148-
/// UseShorthandForNullableTypes incorrectly reported for static access through Nullable&lt;int&gt;</see>
148+
/// UseShorthandForNullableTypes incorrectly reported for static access through Nullable&lt;int&gt;</see>.
149149
/// </summary>
150150
/// <remarks>
151151
/// <para>This special case of instance access through <c>Nullable&lt;int&gt;</c> was mentioned in a
@@ -177,7 +177,7 @@ class ClassName<T>
177177
/// <summary>
178178
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#636.
179179
/// <see href="https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/636">SA1125
180-
/// UseShorthandForNullableTypes incorrectly reported for static access through Nullable&lt;int&gt;</see>
180+
/// UseShorthandForNullableTypes incorrectly reported for static access through Nullable&lt;int&gt;</see>.
181181
/// </summary>
182182
/// <param name="form">The source code for an instantiation of <see cref="Nullable{T}"/> which does not use the
183183
/// shorthand syntax.</param>

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/ReadabilityRules/SA1127CSharp7UnitTests.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ void LocalFunction<T>()
3838
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
3939
}
4040

41-
/// <summary>
42-
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#1476:
43-
/// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1476
44-
/// </summary>
45-
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
4641
[Fact]
42+
[WorkItem(1476, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1476")]
4743
public async Task TestViolationWithLocalFunctionDeclarationMultiLineParametersAsync()
4844
{
4945
var testCode = @"
@@ -74,12 +70,8 @@ void LocalFunction<T>(
7470
await this.VerifyCSharpFixAsync(testCode, fixedCode, cancellationToken: CancellationToken.None).ConfigureAwait(false);
7571
}
7672

77-
/// <summary>
78-
/// This is a regression test for DotNetAnalyzers/StyleCopAnalyzers#1652:
79-
/// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1652
80-
/// </summary>
81-
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
8273
[Fact]
74+
[WorkItem(1652, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1652")]
8375
public async Task TestViolationWithLocalFunctionDeclarationRegionDirectiveAsync()
8476
{
8577
var testCode = $@"

StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/ReadabilityRules/SA1139CSharp7UnitTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public object Method()
123123
/// <summary>
124124
/// Verifies that redundant cast on literal with digit separators does not trigger diagnostic.
125125
/// </summary>
126-
/// <param name="literal">A literal that is casted</param>
127-
/// <param name="type">A type that literal is casted on</param>
126+
/// <param name="literal">A literal that is casted.</param>
127+
/// <param name="type">A type that literal is casted on.</param>
128128
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
129129
[Theory]
130130
[InlineData("0_1", "int")]
@@ -163,7 +163,7 @@ public void Method()
163163
/// <summary>
164164
/// Verifies that other types of casts should not produces diagnostics.
165165
/// </summary>
166-
/// <param name="correctCastExpression">A legal cast that should not trigger diagnostic</param>
166+
/// <param name="correctCastExpression">A legal cast that should not trigger diagnostic.</param>
167167
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
168168
[Theory]
169169
[InlineData("(long)~0_1")]
@@ -185,9 +185,9 @@ public void Method()
185185
/// <summary>
186186
/// Verifies that diagnostics is not produced when error CS0221 is reported.
187187
/// </summary>
188-
/// <param name="type">A type that a literal is casted on</param>
189-
/// <param name="castedLiteral">A literal that is casted</param>
190-
/// <param name="literalValue">The value of the literal reported in the compiler error</param>
188+
/// <param name="type">A type that a literal is casted on.</param>
189+
/// <param name="castedLiteral">A literal that is casted.</param>
190+
/// <param name="literalValue">The value of the literal reported in the compiler error.</param>
191191
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
192192
[Theory]
193193
[InlineData("ulong", "-0_1", "-1")]
@@ -215,7 +215,7 @@ public void Method()
215215
/// <summary>
216216
/// Verifies that casts in unchecked environment do not get replaced with incorrect values.
217217
/// </summary>
218-
/// <param name="castExpression">A cast which can be performed in unchecked environment</param>
218+
/// <param name="castExpression">A cast which can be performed in unchecked environment.</param>
219219
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
220220
[Theory]
221221
[InlineData("(ulong)-0_1L")]

StyleCop.Analyzers/StyleCop.Analyzers.Test/DocumentationRules/SA1623UnitTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ private class PrivateTestClass
154154

155155
/// <summary>
156156
/// Verifies that empty summary tag does not throw an exception.
157-
/// Regression test for #1943
158157
/// </summary>
159158
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
160159
[Fact]
160+
[WorkItem(1943, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1943")]
161161
public async Task EmptySummaryTagShouldNotThrowAnExceptionAsync()
162162
{
163163
var testCode = @"public class ClassName
@@ -233,11 +233,11 @@ public class TestClass
233233
}
234234

235235
/// <summary>
236-
/// Verifies that an empty tag summary is ignored (should be handled by SA1606)
237-
/// This is a regression test for #2230
236+
/// Verifies that an empty tag summary is ignored (should be handled by SA1606).
238237
/// </summary>
239238
/// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
240239
[Fact]
240+
[WorkItem(2230, "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2230")]
241241
public async Task VerifyEmptySummaryTagIsIgnoredAsync()
242242
{
243243
var testCode = @"

0 commit comments

Comments
 (0)