Skip to content

Commit 13e315d

Browse files
committed
Merge branch 'vmrocha-master'
2 parents d1d1c53 + bb29394 commit 13e315d

File tree

9 files changed

+169
-0
lines changed

9 files changed

+169
-0
lines changed

assets/images/CC0034/codefix0.png

21.3 KB
Loading

assets/images/CC0037/codefix0.png

11.3 KB
Loading

assets/images/CC0038/codefix0.png

18.8 KB
Loading

assets/images/CC0057/codefix0.png

17.3 KB
Loading

diagnostics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ tagline: All our diagnostics, ordered by category
4343
|[CC0018](/diagnostics/CC0018.html)|ExistenceOperatorAnalyzer|
4444
|[CC0019](/diagnostics/CC0019.html)|ConvertToSwitchAnalyzer|
4545
|[CC0020](/diagnostics/CC0020.html)|ConvertLambdaExpressionToMethodGroupAnalyzer|
46+
|[CC0037](/diagnostics/CC0037.html)|RemoveCommentedCodeAnalyzer|
47+
|[CC0038](/diagnostics/CC0038.html)|ConvertToExpressionBodiedMemberAnalyzer|
4648
|[CC0048](/diagnostics/CC0048.html)|StringFormatAnalyzer|
4749

4850
## Usage
@@ -55,5 +57,7 @@ tagline: All our diagnostics, ordered by category
5557
|[CC0026](/diagnostics/CC0026.html)|CallExtensionMethodAsExtensionAnalyzer|
5658
|[CC0032](/diagnostics/CC0032.html)|DisposableFieldNotDisposedAnalyzer (Info - method call)|
5759
|[CC0033](/diagnostics/CC0033.html)|DisposableFieldNotDisposedAnalyzer (Warning - object creation)|
60+
|[CC0034](/diagnostics/CC0034.html)|RedundantFieldAssignmentAnalyzer|
5861
|[CC0052](/diagnostics/CC0052.html)|ReadonlyFieldAnalyzer|
62+
|[CC0057](/diagnostics/CC0057.html)|UnusedParametersAnalyzer|
5963
|[CC0089](/diagnostics/CC0089.html)|RemoveRedundantElseClauseAnalyzer|

diagnostics/CC0034.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: page
3+
title: CC0034
4+
tagline: RedundantFieldAssignmentAnalyzer
5+
---
6+
7+
|TypeName|RedundantFieldAssignmentAnalyzer |
8+
|Check Id | CC0034 |
9+
|Category | Usage |
10+
|Severity | Info |
11+
12+
# Cause
13+
14+
It's recommend not to assign the default value to a field as a performance optimization.
15+
16+
# Example
17+
18+
{% highlight csharp %}
19+
class SampleClass
20+
{
21+
private int number = 0;
22+
// ...
23+
}
24+
{% endhighlight %}
25+
26+
# Code fix
27+
28+
A code fix will be presented to you that will transform the code, it will remove the initialization with the default value.
29+
30+
{% highlight csharp %}
31+
class SampleClass
32+
{
33+
private int number;
34+
// ...
35+
}
36+
{% endhighlight %}
37+
38+
![Code fix]({{ BASE_PATH }}/assets/images/CC0034/codefix0.png)
39+
40+
# Related rules
41+
42+
TBD
43+
44+
# See also
45+
46+
TBD

diagnostics/CC0037.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: page
3+
title: CC0037
4+
tagline: RemoveCommentedCodeAnalyzer
5+
---
6+
7+
|TypeName|RemoveCommentedCodeAnalyzer |
8+
|Check Id | CC0037 |
9+
|Category | Style |
10+
|Severity | Info |
11+
12+
# Cause
13+
14+
Useless commented code should be removed.
15+
16+
# Example
17+
18+
{% highlight csharp %}
19+
//class SampleClass
20+
//{
21+
//}
22+
{% endhighlight %}
23+
24+
# Code fix
25+
26+
A code fix will be presented to you that will transform the code, it will delete the comment.
27+
28+
![Code fix]({{ BASE_PATH }}/assets/images/CC0037/codefix0.png)
29+
30+
# Related rules
31+
32+
TBD
33+
34+
# See also
35+
36+
TBD

diagnostics/CC0038.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
layout: page
3+
title: CC0038
4+
tagline: ConvertToExpressionBodiedMemberAnalyzer
5+
---
6+
7+
|TypeName|ConvertToExpressionBodiedMemberAnalyzer |
8+
|Check Id | CC0038 |
9+
|Category | Style |
10+
|Severity | Hidden |
11+
12+
# Cause
13+
14+
Usage of an expression-bodied members improve readability of the code.
15+
16+
# Example
17+
18+
{% highlight csharp %}
19+
public override string ToString()
20+
{
21+
return this.Name;
22+
}
23+
{% endhighlight %}
24+
25+
# Code fix
26+
27+
A code fix will be presented to you that will transform the code, it will convert the method or property into an expression-bodied function.
28+
29+
{% highlight csharp %}
30+
public override string ToString() => this.Name;
31+
{% endhighlight %}
32+
33+
![Code fix]({{ BASE_PATH }}/assets/images/CC0038/codefix0.png)
34+
35+
# Related rules
36+
37+
TBD
38+
39+
# See also
40+
41+
TBD

diagnostics/CC0057.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
layout: page
3+
title: CC0057
4+
tagline: UnusedParametersAnalyzer
5+
---
6+
7+
|TypeName|UnusedParametersAnalyzer |
8+
|Check Id | CC0057 |
9+
|Category | Usage |
10+
|Severity | Warning |
11+
12+
# Cause
13+
14+
When a method declares a parameter and does not use it might bring incorrect conclusions for anyone reading the code and also demands the parameter when the method is called, unnecessarily.
15+
16+
# Example
17+
18+
{% highlight csharp %}
19+
public static void SampleMethod(string name)
20+
{
21+
}
22+
{% endhighlight %}
23+
24+
# Code fix
25+
26+
A code fix will be presented to you that will transform the code to remove the unused parameter.
27+
28+
{% highlight csharp %}
29+
public static void SampleMethod()
30+
{
31+
}
32+
{% endhighlight %}
33+
34+
![Code fix]({{ BASE_PATH }}/assets/images/CC0057/codefix0.png)
35+
36+
# Related rules
37+
38+
None
39+
40+
# See also
41+
42+
TBD

0 commit comments

Comments
 (0)