Skip to content

Commit 3c554ed

Browse files
committed
reformat code
1 parent 4b6fcf8 commit 3c554ed

17 files changed

+114
-71
lines changed

.editorconfig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ csharp_style_conditional_delegate_call = true:suggestion
135135

136136
# Modifier preferences
137137
csharp_prefer_static_local_function = true:suggestion
138-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
138+
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:silent
139139

140140
# Code-block preferences
141141
csharp_prefer_braces = true:silent
@@ -191,7 +191,7 @@ dotnet_naming_symbols.non_field_members.required_modifiers =
191191

192192
dotnet_naming_symbols.private_method.applicable_kinds = method
193193
dotnet_naming_symbols.private_method.applicable_accessibilities = private
194-
dotnet_naming_symbols.private_method.required_modifiers =
194+
dotnet_naming_symbols.private_method.required_modifiers =
195195

196196
# Naming styles
197197

@@ -205,9 +205,9 @@ dotnet_naming_style.begins_with_i.required_suffix =
205205
dotnet_naming_style.begins_with_i.word_separator =
206206
dotnet_naming_style.begins_with_i.capitalization = pascal_case
207207

208-
dotnet_naming_style.camelcase.required_prefix =
209-
dotnet_naming_style.camelcase.required_suffix =
210-
dotnet_naming_style.camelcase.word_separator =
208+
dotnet_naming_style.camelcase.required_prefix =
209+
dotnet_naming_style.camelcase.required_suffix =
210+
dotnet_naming_style.camelcase.word_separator =
211211
dotnet_naming_style.camelcase.capitalization = camel_case
212212

213213

@@ -414,7 +414,7 @@ dotnet_diagnostic.CA1703.severity = warning
414414

415415
dotnet_diagnostic.CA1704.severity = warning
416416

417-
dotnet_diagnostic.CA1707.severity =suggestion
417+
dotnet_diagnostic.CA1707.severity = suggestion
418418

419419
dotnet_diagnostic.CA1708.severity = warning
420420

@@ -737,4 +737,4 @@ dotnet_diagnostic.SA1642.severity = none
737737
dotnet_diagnostic.SA1643.severity = none
738738

739739
dotnet_diagnostic.SA1652.severity = none
740-
dotnet_diagnostic.CA2007.severity=silent
740+
dotnet_diagnostic.CA2007.severity = silent

github-monitor/Ahk.GitHub.Monitor/Ahk.GitHub.Monitor.csproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25-
<Content Include="local.settings.json" />
25+
<Content Include="local.settings.json"/>
2626
</ItemGroup>
2727

2828
<ItemGroup>
29-
<PackageReference Include="Microsoft.Azure.Core.NewtonsoftJson" Version="2.0.0" />
30-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
31-
<PackageReference Include="Polly" Version="8.4.1" />
29+
<PackageReference Include="Microsoft.Azure.Core.NewtonsoftJson" Version="2.0.0"/>
30+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0"/>
31+
<PackageReference Include="Polly" Version="8.4.1"/>
3232
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354">
3333
<PrivateAssets>all</PrivateAssets>
3434
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3535
</PackageReference>
36-
<PackageReference Include="Azure.Storage.Queues" Version="12.19.1" />
37-
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.4" />
38-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.1" />
39-
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
40-
<FrameworkReference Include="Microsoft.AspNetCore.App" />
41-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
42-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
43-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
44-
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
45-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.3.0" />
46-
<PackageReference Include="Octokit" Version="13.0.1" />
36+
<PackageReference Include="Azure.Storage.Queues" Version="12.19.1"/>
37+
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.4"/>
38+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.1"/>
39+
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0"/>
40+
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
41+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0"/>
42+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4"/>
43+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2"/>
44+
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0"/>
45+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.3.0"/>
46+
<PackageReference Include="Octokit" Version="13.0.1"/>
4747
</ItemGroup>
4848

4949
<ItemGroup>
50-
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
50+
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext"/>
5151
</ItemGroup>
5252

5353
<ItemGroup>

github-monitor/Ahk.GitHub.Monitor/EventHandlers/ConfigYamlParser.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ namespace Ahk.GitHub.Monitor.EventHandlers
55
{
66
internal static class ConfigYamlParser
77
{
8-
private static readonly Regex EnabledRegex = new Regex(@"^enabled:?\s*(?<value>\w+)?", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline);
8+
private static readonly Regex EnabledRegex = new Regex(
9+
@"^enabled:?\s*(?<value>\w+)?",
10+
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Multiline);
911

1012
public static bool IsEnabled(string fileContent)
1113
{
@@ -26,8 +28,8 @@ public static bool IsEnabled(string fileContent)
2628

2729
// "enabled: ..." must match either of the following
2830
return value.Value.Equals("true", StringComparison.OrdinalIgnoreCase)
29-
|| value.Value.Equals("yes", StringComparison.OrdinalIgnoreCase)
30-
|| value.Value.Equals("1", StringComparison.OrdinalIgnoreCase);
31+
|| value.Value.Equals("yes", StringComparison.OrdinalIgnoreCase)
32+
|| value.Value.Equals("1", StringComparison.OrdinalIgnoreCase);
3133
}
3234
}
3335
}

github-monitor/Ahk.GitHub.Monitor/EventHandlers/EventHandlerResult.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ public class EventHandlerResult(string result)
44
{
55
public string Result { get; } = result;
66

7-
public static EventHandlerResult PayloadError(string message) => new EventHandlerResult($"payload error: {message}");
8-
public static EventHandlerResult NoActionNeeded(string message) => new EventHandlerResult($"no action needed: {message}");
9-
public static EventHandlerResult ActionPerformed(string message) => new EventHandlerResult($"action performed: {message}");
10-
public static EventHandlerResult EventNotOfInterest(string action) => new EventHandlerResult($"action not of interest: {action}");
11-
public static EventHandlerResult Disabled(string message = null) => new EventHandlerResult(message == null ? $"event handler disabled" : $"event handler disabled: {message}");
7+
public static EventHandlerResult PayloadError(string message) =>
8+
new EventHandlerResult($"payload error: {message}");
9+
10+
public static EventHandlerResult NoActionNeeded(string message) =>
11+
new EventHandlerResult($"no action needed: {message}");
12+
13+
public static EventHandlerResult ActionPerformed(string message) =>
14+
new EventHandlerResult($"action performed: {message}");
15+
16+
public static EventHandlerResult EventNotOfInterest(string action) =>
17+
new EventHandlerResult($"action not of interest: {action}");
18+
19+
public static EventHandlerResult Disabled(string message = null) =>
20+
new EventHandlerResult(message == null ? $"event handler disabled" : $"event handler disabled: {message}");
1221
}
1322
}

github-monitor/Ahk.GitHub.Monitor/EventHandlers/IGitHubEventHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Ahk.GitHub.Monitor.EventHandlers
44
{
5-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Event is a GitHub terminology in this context.")]
5+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix",
6+
Justification = "Event is a GitHub terminology in this context.")]
67
public interface IGitHubEventHandler
78
{
89
Task<EventHandlerResult> Execute(string requestBody);

github-monitor/Ahk.GitHub.Monitor/EventHandlers/RepositoryEventBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ private async Task<bool> getConfigIsEnabledInRepository(TPayload webhookPayload)
120120
{
121121
try
122122
{
123-
var contents = await GitHubClient.Repository.Content.GetAllContentsByRef(webhookPayload.Repository.Id, ".github/ahk-monitor.yml", webhookPayload.Repository.DefaultBranch);
123+
var contents = await GitHubClient.Repository.Content.GetAllContentsByRef(webhookPayload.Repository.Id,
124+
".github/ahk-monitor.yml", webhookPayload.Repository.DefaultBranch);
124125
if (contents.Count == 0)
125126
return false;
126127
var contentAsString = contents[0].Content;

github-monitor/Ahk.GitHub.Monitor/Extensions/GitHubClientWorkflowRunsExtensions.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ namespace Octokit
66
{
77
internal static class GitHubClientWorkflowRunsExtensions
88
{
9-
public static async Task<int> CountWorkflowRunsInRepository(this IGitHubClient client, string owner, string repo, string actor)
9+
public static async Task<int> CountWorkflowRunsInRepository(this IGitHubClient client, string owner,
10+
string repo, string actor)
1011
{
1112
var r = await client.Connection.Get<ListWorkflowRunsResponse>(
1213
uri: new Uri($"repos/{owner}/{repo}/actions/runs", UriKind.Relative),
13-
parameters: new Dictionary<string, string>()
14-
{
15-
["actor"] = actor,
16-
["status"] = "completed",
17-
},
14+
parameters: new Dictionary<string, string>() { ["actor"] = actor, ["status"] = "completed", },
1815
accepts: AcceptHeaders.StableVersionJson);
1916
return r.Body.TotalCount;
2017
}

github-monitor/Ahk.GitHub.Monitor/GitHubMonitorFunction.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ private async Task<IActionResult> runCore(string eventName, string deliveryId, s
7171
try
7272
{
7373
await eventDispatchService.Process(eventName, requestBody, webhookResult, logger);
74-
logger.LogInformation("Webhook delivery processed succesfully with Delivery id = '{DeliveryId}'", deliveryId);
74+
logger.LogInformation("Webhook delivery processed succesfully with Delivery id = '{DeliveryId}'",
75+
deliveryId);
7576
}
7677
catch (Exception ex)
7778
{

github-monitor/Ahk.GitHub.Monitor/Helpers/GradeCommentParser.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ namespace Ahk.GitHub.Monitor.Helpers
88
{
99
internal class GradeCommentParser
1010
{
11-
private static readonly Regex CommandRegex = new Regex(@"^/ahk ok($|(\s.*))", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
12-
private static readonly Regex GradesRegex = new Regex(@"[0-9]+([,\.][0-9]{1,3})?", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
11+
private static readonly Regex CommandRegex = new Regex(@"^/ahk ok($|(\s.*))",
12+
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
13+
14+
private static readonly Regex GradesRegex = new Regex(@"[0-9]+([,\.][0-9]{1,3})?",
15+
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
1316

1417
public GradeCommentParser(string value)
1518
{
@@ -56,7 +59,8 @@ private static double parseNum(string value)
5659
return d1;
5760

5861
// replace commas with decimal point
59-
if (double.TryParse(value.Replace(",", ".", StringComparison.OrdinalIgnoreCase), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var d2))
62+
if (double.TryParse(value.Replace(",", ".", StringComparison.OrdinalIgnoreCase),
63+
NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var d2))
6064
return d2;
6165

6266
return double.NaN;

github-monitor/Ahk.GitHub.Monitor/Services/EventDispatch/EventDispatchService.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public EventDispatchService(IServiceProvider serviceProvider, EventDispatchConfi
2727
handlers = handlersList;
2828
}
2929

30-
public async Task Process(string gitHubEventName, string requestBody, WebhookResult webhookResult, ILogger logger)
30+
public async Task Process(string gitHubEventName, string requestBody, WebhookResult webhookResult,
31+
ILogger logger)
3132
{
3233
if (!handlers.TryGetValue(gitHubEventName, out var handlersForEvent))
3334
{
@@ -44,11 +45,14 @@ public async Task Process(string gitHubEventName, string requestBody, WebhookRes
4445
}
4546
}
4647

47-
private async Task executeHandler(string requestBody, WebhookResult webhookResult, Type handlerType, ILogger logger)
48+
private async Task executeHandler(string requestBody, WebhookResult webhookResult, Type handlerType,
49+
ILogger logger)
4850
{
4951
try
5052
{
51-
var handler = ActivatorUtilities.CreateInstance(serviceProvider, handlerType) as EventHandlers.IGitHubEventHandler;
53+
var handler =
54+
ActivatorUtilities.CreateInstance(
55+
serviceProvider, handlerType) as EventHandlers.IGitHubEventHandler;
5256
var handlerResult = await handler.Execute(requestBody);
5357

5458
logger.LogInformation($"{handlerType.Name} result: {handlerResult.Result}");

0 commit comments

Comments
 (0)