Skip to content

Commit 4922729

Browse files
committed
Fixed code style.
1 parent 1bf8c17 commit 4922729

File tree

56 files changed

+622
-241
lines changed

Some content is hidden

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

56 files changed

+622
-241
lines changed

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@ csharp_space_between_parentheses = false
141141
csharp_space_between_square_brackets = false
142142

143143
# Wrapping preferences
144-
csharp_preserve_single_line_blocks = true
145-
csharp_preserve_single_line_statements = true
144+
csharp_preserve_single_line_blocks = false
145+
csharp_preserve_single_line_statements = false
146146

Diagnostics/PostSharp.Samples.Audit.Extended/DbAuditRecord.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public void AppendToDatabase()
2929
Console.WriteLine(
3030
$"Writing to the database: {{PrimaryBusinessObjectId={PrimaryBusinessObjectId}, Operation={Method}, Description=\"{Description}\", User={User}}}.");
3131
foreach (var id in RelatedBusinessObjectIds)
32+
{
3233
Console.WriteLine($"Writing to database: correlation with BusinessObjectId={id}.");
34+
}
3335
}
3436
}
3537
}

Diagnostics/PostSharp.Samples.Audit.Extended/ExtendedAuditRecordBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public override void SetParameter<T>(
2828
var businessObject = value as BusinessObject;
2929

3030
if (businessObject != null)
31+
{
3132
((ExtendedAuditRecord) CurrentRecord).RelatedBusinessObjects.Add(businessObject);
33+
}
3234
}
3335
}
3436
}

Diagnostics/PostSharp.Samples.Logging.BusinessLogic/QueueProcessor.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ private static void ProcessItem(QueueItem item)
3333
}
3434

3535
if (item.Id == 145)
36+
{
3637
RequestStorage.GetUser(0);
38+
}
3739
else
40+
{
3841
RequestStorage.GetUser(14);
39-
42+
}
4043

4144
Thread.Sleep(125);
4245

Diagnostics/PostSharp.Samples.Logging.BusinessLogic/RequestStorage.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ public static Request GetRequest(int id)
1313

1414
public static User GetUser(int id)
1515
{
16-
if (id <= 0) throw new ArgumentOutOfRangeException("id", "The user id must be greater than zero.");
16+
if (id <= 0)
17+
{
18+
throw new ArgumentOutOfRangeException("id", "The user id must be greater than zero.");
19+
}
1720

18-
if (id == 14) Thread.Sleep(56);
21+
if (id == 14)
22+
{
23+
Thread.Sleep(56);
24+
}
1925

2026
return new User();
2127
}

Diagnostics/PostSharp.Samples.Logging.CustomBackend.ServiceStack/ServiceStackLogRecordBuilder.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,62 @@ protected override void Write(UnsafeString message)
2424
case LogLevel.Trace:
2525
case LogLevel.Debug:
2626
if (Exception == null)
27+
{
2728
log.Debug(messageString);
29+
}
2830
else
31+
{
2932
log.Debug(messageString, Exception);
33+
}
34+
3035
break;
3136

3237
case LogLevel.Info:
3338
if (Exception == null)
39+
{
3440
log.Info(messageString);
41+
}
3542
else
43+
{
3644
log.Info(messageString, Exception);
45+
}
46+
3747
break;
3848

3949
case LogLevel.Warning:
4050
if (Exception == null)
51+
{
4152
log.Warn(messageString);
53+
}
4254
else
55+
{
4356
log.Warn(messageString, Exception);
57+
}
58+
4459
break;
4560

4661
case LogLevel.Error:
4762
if (Exception == null)
63+
{
4864
log.Error(messageString);
65+
}
4966
else
67+
{
5068
log.Error(messageString, Exception);
69+
}
70+
5171
break;
5272

5373
case LogLevel.Critical:
5474
if (Exception == null)
75+
{
5576
log.Fatal(messageString);
77+
}
5678
else
79+
{
5780
log.Fatal(messageString, Exception);
81+
}
82+
5883
break;
5984
}
6085
}

Diagnostics/PostSharp.Samples.Logging.ElasticStack/ClientExample/InstrumentOutgoingRequestsAspect.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ public override async Task OnInvokeAsync(MethodInterceptionArgs args)
5050
{
5151
activity.Context.ForEachProperty((LoggingProperty property, object value, ref object _) =>
5252
{
53-
if (!property.IsBaggage || !propertyNames.Add(property.Name)) return;
53+
if (!property.IsBaggage || !propertyNames.Add(property.Name))
54+
{
55+
return;
56+
}
5457

5558
if (correlationContextBuilder == null)
5659
{

Diagnostics/PostSharp.Samples.Logging.ElasticStack/MicroserviceExample/LoggingActionFilter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
3939
foreach (var pair in correlationContext.Split(',', StringSplitOptions.RemoveEmptyEntries))
4040
{
4141
var posOfEqual = pair.IndexOf('=');
42-
if (posOfEqual <= 0) continue;
42+
if (posOfEqual <= 0)
43+
{
44+
continue;
45+
}
46+
4347
var propertyName = pair.Substring(0, posOfEqual);
4448
var propertyValue = pair.Substring(posOfEqual + 1);
4549
properties.Add(new LoggingProperty(propertyName, propertyValue) { IsBaggage = true });

Diagnostics/PostSharp.Samples.Logging.Etw.CustomSource/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ private static void Main(string[] args)
1414
{
1515
var eventSourceBackend = new EventSourceLoggingBackend(new MyEventSource());
1616
if (eventSourceBackend.EventSource.ConstructionException != null)
17+
{
1718
throw eventSourceBackend.EventSource.ConstructionException;
19+
}
1820

1921
LoggingServices.DefaultBackend = eventSourceBackend;
2022

Diagnostics/PostSharp.Samples.Logging.Etw/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ private static void Main(string[] args)
1414
{
1515
var eventSourceBackend = new EventSourceLoggingBackend(new PostSharpEventSource());
1616
if (eventSourceBackend.EventSource.ConstructionException != null)
17+
{
1718
throw eventSourceBackend.EventSource.ConstructionException;
19+
}
1820

1921
LoggingServices.DefaultBackend = eventSourceBackend;
2022

0 commit comments

Comments
 (0)