Skip to content

Commit 596c242

Browse files
authored
Merge pull request #5730 from Youssef1313/patch-2
Fix markdown issues
2 parents eec5562 + cdd289b commit 596c242

File tree

91 files changed

+485
-492
lines changed

Some content is hidden

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

91 files changed

+485
-492
lines changed

docs/code-quality/ca1031.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ dotnet_code_quality.CA1031.disallowed_symbol_names = NullReferenceException
5757
```
5858

5959
Allowed type name formats in the option value (separated by '|'):
60-
- Type name only (includes all symbols with the name, regardless of the containing type or namespace)
61-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format) with a `T:` prefix.
60+
- Type name only (includes all symbols with the name, regardless of the containing type or namespace)
61+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format) with a `T:` prefix.
6262

6363
Examples:
6464

docs/code-quality/ca1062.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ dotnet_code_quality.CA1062.null_check_validation_methods = Validate
7070
```
7171

7272
Allowed method name formats in the option value (separated by '|'):
73-
- Method name only (includes all methods with the name, regardless of the containing type or namespace)
74-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format), with an optional `M:` prefix.
73+
- Method name only (includes all methods with the name, regardless of the containing type or namespace)
74+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format), with an optional `M:` prefix.
7575

7676
Examples:
7777

@@ -91,9 +91,9 @@ dotnet_code_quality.CA1062.excluded_symbol_names = MyType
9191
```
9292

9393
Allowed symbol name formats in the option value (separated by '|'):
94-
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
95-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
96-
- `.ctor` for constructors and `.cctor` for static constructors
94+
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
95+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
96+
- `.ctor` for constructors and `.cctor` for static constructors
9797

9898
Examples:
9999

docs/code-quality/ca1507.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ Rule CA1507 flags the use of a `string` literal as an argument to a method or co
3939

4040
- The declared name of the parameter is `propertyName` and the constant value of the `string` literal matches the name of a property of the type within which the method or constructor is being invoked.
4141

42-
43-
4442
Rule CA1507 improves code maintainability in cases where the parameter may be renamed in the future, but the `string` literal is mistakenly not renamed. By using `nameof`, the symbol will be renamed when the parameter is renamed through a refactoring operation. In addition, any spelling mistakes in the name of the parameter are caught by the compiler.
4543

4644
> [!NOTE]

docs/code-quality/ca1509.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ An invalid entry in this configuration file is flagged with the `CA1509` diagnos
6262
> [!NOTE]
6363
> Rule CA1509 is not available in legacy analysis. It was first introduced in [FxCop analyzers](https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers) version 2.9.6.
6464
65-
6665
## How to fix violations
6766

6867
To fix a violation of this rule, make sure the invalid entry in `CodeMetricsConfig.txt` gets the required format.

docs/code-quality/ca1826.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class C
6767
}
6868
```
6969

70-
7170
```csharp
7271
using System;
7372
using System.Collections.Generic;

docs/code-quality/ca1827.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class C
5151
}
5252
```
5353

54-
5554
```csharp
5655
using System.Collections.Generic;
5756
using System.Linq;

docs/code-quality/ca1828.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class C
5252
}
5353
```
5454

55-
5655
```csharp
5756
using System.Linq;
5857
using System.Threading.Tasks;

docs/code-quality/ca1829.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class C
6464
}
6565
```
6666

67-
6867
```csharp
6968
using System.Collections.Generic;
7069

docs/code-quality/ca1833.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class C
5353
{
5454
// The violation occurs for both statements below
5555
Span<byte> tmp2 = arr[0..5];
56-
Memory<byte> tmp4 = arr[5..10];
56+
Memory<byte> tmp4 = arr[5..10];
5757
...
5858
}
5959
}
@@ -66,7 +66,7 @@ class C
6666
{
6767
// The violations fixed with AsSpan or AsMemory accordingly
6868
Span<byte> tmp2 = arr.AsSpan()[0..5];
69-
Memory<byte> tmp4 = arr.AsMemory()[5..10];
69+
Memory<byte> tmp4 = arr.AsMemory()[5..10];
7070
...
7171
}
7272
}
@@ -88,8 +88,8 @@ class C
8888
{
8989
// The violation occurs
9090
Span<byte> tmp1 = arr[0..5];
91-
Memory<byte> tmp2 = arr[5..10];
92-
...
91+
Memory<byte> tmp2 = arr[5..10];
92+
...
9393
}
9494
}
9595
```

docs/code-quality/ca1835.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ The rule can detect a variety of violations for the `ReadAsync` and `WriteAsync`
6464
##### Example 1
6565

6666
Invocations of `ReadAsync`, without and with a `CancellationToken` argument:
67+
6768
```cs
6869
using System;
6970
using System.IO;
@@ -82,7 +83,9 @@ class MyClass
8283
}
8384
}
8485
```
86+
8587
##### Fix
88+
8689
```cs
8790
using System;
8891
using System.IO;
@@ -105,6 +108,7 @@ class MyClass
105108
##### Example 2
106109

107110
Invocations of `WriteAsync`, without and with a `CancellationToken` argument:
111+
108112
```cs
109113
using System;
110114
using System.IO;
@@ -123,7 +127,9 @@ class MyClass
123127
}
124128
}
125129
```
130+
126131
##### Fix
132+
127133
```cs
128134
using System;
129135
using System.IO;
@@ -167,7 +173,9 @@ class MyClass
167173
}
168174
}
169175
```
176+
170177
##### Fix
178+
171179
```cs
172180
using System;
173181
using System.IO;
@@ -196,6 +204,7 @@ Here are some examples of invocations where the rule will **not** be fired:
196204
##### Example 1
197205

198206
The return value is saved in a `Task` variable instead of being awaited:
207+
199208
```cs
200209
using System;
201210
using System.IO;
@@ -218,6 +227,7 @@ class MyClass
218227
##### Example 2
219228

220229
The return value is returned by the wrapping method instead of being awaited:
230+
221231
```cs
222232
using System;
223233
using System.IO;
@@ -236,6 +246,7 @@ class MyClass
236246
##### Example 3
237247

238248
The return value is used to call `ContinueWith`, which is the method being awaited:
249+
239250
```cs
240251
using System;
241252
using System.IO;
@@ -261,4 +272,4 @@ It's safe to suppress a violation of this rule if you're not concerned about imp
261272

262273
## See also
263274

264-
- [Performance warnings](../code-quality/performance-warnings.md)
275+
- [Performance warnings](../code-quality/performance-warnings.md)

docs/code-quality/ca1836.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class C
4646
}
4747
```
4848

49-
5049
```csharp
5150
using System.Collections.Concurrent;
5251

docs/code-quality/ca2000.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ dotnet_code_quality.CA2000.excluded_symbol_names = MyType
8989
```
9090

9191
Allowed symbol name formats in the option value (separated by '|'):
92-
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
93-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
94-
- `.ctor` for constructors and `.cctor` for static constructors
92+
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
93+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
94+
- `.ctor` for constructors and `.cctor` for static constructors
9595

9696
Examples:
9797

docs/code-quality/ca2009.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public class C
7878
}
7979
```
8080

81-
8281
```csharp
8382
using System;
8483
using System.Collections.Generic;

docs/code-quality/ca2013.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ To fix the violation, replace it with a more appropriate equality check such as
3737
```csharp
3838

3939
int int1 = 1, int2 = 1;
40-
40+
4141
// Violation occurs, returns false.
4242
Console.WriteLine(Object.ReferenceEquals(int1, int2)); // false
43-
43+
4444
// Use appropriate equality operator or method instead
4545
Console.WriteLine(int1 == int2); // true
4646
Console.WriteLine(Object.Equals(int1, int2)); // true

docs/code-quality/ca2015.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class DerivedClass <T> : MemoryManager<T>
4747
_handle.Dispose();
4848
}
4949
}
50-
50+
5151
...
52-
52+
5353
// Violation occurs, remove the finalizer to fix the warning.
5454
~DerivedClass() => Dispose(false);
5555
}

docs/code-quality/ca2016.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ namespace ConsoleApp
7676
##### Fix
7777

7878
Forward the `c` parameter:
79+
7980
```csharp
8081
public static void MyMethod(CancellationToken c)
8182
{
@@ -86,6 +87,7 @@ Forward the `c` parameter:
8687
If you are not concerned about forwarding cancellation notifications to lower invocations, you can either:
8788

8889
Explicitly pass `default`:
90+
8991
```csharp
9092
public static void MyMethod(CancellationToken c)
9193
{
@@ -94,6 +96,7 @@ Explicitly pass `default`:
9496
```
9597

9698
Or explicitly pass `CancellationToken.None`:
99+
97100
```csharp
98101
public static void MyMethod(CancellationToken c)
99102
{
@@ -131,6 +134,7 @@ namespace ConsoleApp
131134
##### Fix
132135

133136
Forward the `c` parameter:
137+
134138
```csharp
135139
public static void MyMethod(CancellationToken c)
136140
{
@@ -141,6 +145,7 @@ Forward the `c` parameter:
141145
If you are not concerned about forwarding cancellation notifications to lower invocations, you can either:
142146

143147
Explicitly pass `default`:
148+
144149
```csharp
145150
public static void MyMethod(CancellationToken c)
146151
{
@@ -149,14 +154,14 @@ Explicitly pass `default`:
149154
```
150155

151156
Or explicitly pass `CancellationToken.None`:
157+
152158
```csharp
153159
public static void MyMethod(CancellationToken c)
154160
{
155161
MyMethodWithOverload(CancellationToken.None);
156162
}
157163
```
158164

159-
160165
#### No diagnosis
161166

162167
##### Example 1

docs/code-quality/ca2100.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ dotnet_code_quality.CA2100.excluded_symbol_names = MyType
8989
```
9090

9191
Allowed symbol name formats in the option value (separated by '|'):
92-
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
93-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
94-
- `.ctor` for constructors and `.cctor` for static constructors
92+
- Symbol name only (includes all symbols with the name, regardless of the containing type or namespace)
93+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format). Each symbol name requires a symbol kind prefix, such as "M:" prefix for methods, "T:" prefix for types, "N:" prefix for namespaces, etc.
94+
- `.ctor` for constructors and `.cctor` for static constructors
9595

9696
Examples:
9797

docs/code-quality/ca2208.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ If you're running this rule from [FxCop analyzers](install-fxcop-analyzers.md) (
7676
```ini
7777
dotnet_code_quality.ca2208.api_surface = public
7878
```
79+
7980
By default CA2208 rules apply for all API surface (public, internal and private). You can configure this option for just this rule, for all rules, or for all rules in this category (Design). For more information, see [Configure FxCop analyzers](configure-fxcop-analyzers.md).
8081

8182
## Example

docs/code-quality/ca2225.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ This rule examines:
6666
|!|N/A|!|LogicalNot|
6767
|%|Mod|%|Mod or Remainder|
6868
|%=|N/A|%=|Mod|
69-
|* (binary)|*|*|Multiply|
70-
|*=|N/A|*=|Multiply|
69+
|\* (binary)|\*|\*|Multiply|
70+
|\*=|N/A|\*=|Multiply|
7171
|~|Not|~|OnesComplement|
7272
|>>|>>|>>|RightShift|
7373
=|N/A|>>=|RightShift|
@@ -78,7 +78,7 @@ This rule examines:
7878
|+ (unary)|N/A|+|Plus|
7979
|false|IsFalse|False|IsTrue (Property)|
8080

81-
*N/A means the operator cannot be overloaded in the selected language.
81+
\*N/A means the operator cannot be overloaded in the selected language.
8282

8383
> [!NOTE]
8484
> In C#, when a binary operator is overloaded, the corresponding assignment operator, if any, is also implicitly overloaded.

docs/code-quality/ca2241.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ dotnet_code_quality.CA2241.additional_string_formatting_methods = MyFormat
5454
```
5555

5656
Allowed method name formats in the option value (separated by '|'):
57-
- Method name only (includes all methods with the name, regardless of the containing type or namespace)
58-
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format), with an optional `M:` prefix.
57+
- Method name only (includes all methods with the name, regardless of the containing type or namespace)
58+
- Fully qualified names in the symbol's [documentation ID format](https://github.com/dotnet/csharplang/blob/master/spec/documentation-comments.md#id-string-format), with an optional `M:` prefix.
5959

6060
Examples:
6161

docs/code-quality/ca2244.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ class C
8989
>
9090
> ![Code fix for CA2244 - Remove redundant element initializer](media/ca2244-codefix.png)
9191
92-
9392
## When to suppress warnings
9493

9594
Do not suppress violations for this rule.

docs/code-quality/ca2247.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To fix the violation, replace the <xref:System.Threading.Tasks.TaskContinuationO
3838
```csharp
3939
// Violation
4040
var tcs = new TaskCompletionSource<int>(TaskContinuationOptions.RunContinuationsAsynchronously);
41-
41+
4242
// Fixed
4343
var tcs = new TaskCompletionSource<int>(TaskCreationOptions.RunContinuationsAsynchronously);
4444
```
@@ -47,7 +47,6 @@ To fix the violation, replace the <xref:System.Threading.Tasks.TaskContinuationO
4747

4848
A violation of this rule almost always highlights a bug in the calling code, such that the code will not behave as the developer intended, with the TaskCompletionSource effectively ignoring the specified option. The only time it is safe to suppress the warning is if the developer actually intended to pass a boxed <xref:System.Threading.Tasks.TaskContinuationOptions?displayProperty=fullName> as the object state argument to the TaskCompletionSource.
4949

50-
5150
## See also
5251

5352
- [Usage warnings](../code-quality/usage-warnings.md)

0 commit comments

Comments
 (0)