Skip to content
Merged
Changes from 14 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b8601c0
AVRO-3360 Updated XML documentation
Feb 3, 2022
d01699a
Revert "AVRO-3360 Updated XML documentation"
Feb 3, 2022
83093e1
Merge branch 'apache:master' into master
KyleSchoonover Feb 4, 2022
c992da4
Merge branch 'apache:master' into master
KyleSchoonover Feb 10, 2022
a99e652
AVRO-3384 Initial check in
Feb 10, 2022
759f088
Formatting fix
Feb 10, 2022
8383e3d
Additional formatting
Feb 10, 2022
c468c18
More formatting
Feb 10, 2022
38e3b4c
Added additional rule
Feb 10, 2022
56381b7
Completed new line rules
Feb 10, 2022
f235b3d
Indentation preferences complete
Feb 10, 2022
446affe
Updated header
Feb 10, 2022
0b9190e
Additional formatting
Feb 10, 2022
2b25fed
More formatting changes
Feb 10, 2022
2190042
Added spacing options
Feb 11, 2022
c7535da
Updated wrap options
Feb 11, 2022
9ffea5a
Additional documentation for styling
Feb 11, 2022
8057598
Updated notes
Feb 11, 2022
d3c7aa2
Updated more
Feb 11, 2022
62e05ad
Added var preferences and Expression-bodied member preferences
Feb 11, 2022
972728b
Initial styling rules documented
Feb 11, 2022
e8d5bde
Updated naming rules to reflect Roslyn naming rules
Feb 11, 2022
99f596f
Added other styling rule callouts.
Feb 11, 2022
8c9e9c3
Updated Readme
Feb 12, 2022
fa5f7c2
Merge branch 'apache:master' into master
KyleSchoonover Feb 14, 2022
7ebc80e
Updated rule
Feb 15, 2022
6989e61
Merge branch 'apache:master' into master
KyleSchoonover Feb 16, 2022
5b4202e
Add header template
Feb 16, 2022
93585f3
Microsoft has a bug for semicolon which makes this not work.
Feb 16, 2022
d06604a
Merge branch 'apache:master' into master
KyleSchoonover Feb 24, 2022
2b39bb0
Merge branch 'apache:master' into master
KyleSchoonover Feb 28, 2022
f8a7611
Merge branch 'apache:master' into master
KyleSchoonover Mar 9, 2022
a5fa2ef
Merge branch 'apache:master' into master
KyleSchoonover Mar 18, 2022
0216b4d
Merge branch 'apache:master' into master
KyleSchoonover Mar 21, 2022
d97a23c
Merge branch 'apache:master' into master
KyleSchoonover Apr 8, 2022
e1db956
Merge branch 'apache:master' into master
KyleSchoonover Apr 13, 2022
a72110e
Merge branch 'master' into AVRO-3384
KyleSchoonover Apr 13, 2022
ca978e4
Added license
KyleSchoonover Apr 13, 2022
180c8cc
Added note about IDE0055
KyleSchoonover Apr 13, 2022
e586782
Merge branch 'apache:master' into master
KyleSchoonover Apr 14, 2022
9ab3fb2
Merge branch 'apache:master' into master
KyleSchoonover Apr 19, 2022
25378bb
Merge branch 'master' into AVRO-3384
KyleSchoonover Apr 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 193 additions & 0 deletions lang/csharp/STYLING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
# C# Styling Rules for Apache.Avro

The following rules are currently used within the .editorconfig of the Avro solution. Any changes to this documentation should be reflected in the .editorconfig file and vice versa.

Note that the examples shown are based on the current settings in .editorconfig

## New line preferences

### csharp_new_line_before_open_brace
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_open_brace)

This rule concerns whether an open brace { should be placed on the same line as the preceding code, or on a new line.

**Example**
```
void MyMethod()
{
if (...)
{
...
}
}
```
---
### csharp_new_line_before_else
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_else)

**Example**
```
if (...) {
...
}
else {
...
}
```
---
### csharp_new_line_before_catch
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_catch)

**Example**
```
try {
...
}
catch (Exception e) {
...
}
```
---
### csharp_new_line_before_finally
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_finally)

**Example**
```
try {
...
}
catch (Exception e) {
...
}
finally {
...
}
```
---
### csharp_new_line_before_members_in_object_initializers
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_members_in_object_initializers)

**Example**
```
var z = new B()
{
A = 3,
B = 4
}
```
---
### csharp_new_line_before_members_in_anonymous_types
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_before_members_in_anonymous_types)

**Example**
```
var z = new
{
A = 3,
B = 4
}
```
---
### csharp_new_line_between_query_expression_clauses
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_new_line_between_query_expression_clauses)

**Example**
```
var q = from a in e
from b in e
select a * b;
```
---

## Indentation preferences

### csharp_indent_case_contents
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_case_contents)

**Example**
```
switch(c) {
case Color.Red:
Console.WriteLine("The color is red");
break;
case Color.Blue:
Console.WriteLine("The color is blue");
break;
default:
Console.WriteLine("The color is unknown.");
break;
}
```
---
### csharp_indent_switch_labels
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_switch_labels)

**Example**
```
switch(c) {
case Color.Red:
Console.WriteLine("The color is red");
break;
case Color.Blue:
Console.WriteLine("The color is blue");
break;
default:
Console.WriteLine("The color is unknown.");
break;
}
```
---
### csharp_indent_labels
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_labels)

Labels are placed at one less indent to the current context

**Example**
```
class C
{
private string MyMethod(...)
{
if (...) {
goto error;
}
error:
throw new Exception(...);
}
}
```
---
### csharp_indent_block_contents
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_block_contents)

**Example**
```
static void Hello()
{
Console.WriteLine("Hello");
}
```
---
### csharp_indent_braces
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_braces)

**Example**
```
static void Hello()
{
Console.WriteLine("Hello");
}
```
---
### csharp_indent_case_contents_when_block
[Reference](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#csharp_indent_case_contents_when_block)

**Example**
```
case 0:
{
Console.WriteLine("Hello");
break;
}
```
---