Skip to content

Commit c49093c

Browse files
authored
Update code formatting and dependencies (#34)
1 parent 4957546 commit c49093c

31 files changed

+571
-593
lines changed

.editorconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
8383
csharp_using_directive_placement = outside_namespace:suggestion
8484
dotnet_sort_system_directives_first = true
8585
dotnet_separate_import_directive_groups = true
86-
csharp_prefer_braces = true:refactoring
86+
csharp_prefer_braces = true:error
8787
csharp_preserve_single_line_blocks = true:none
8888
csharp_preserve_single_line_statements = false:none
8989
csharp_prefer_static_local_function = true:suggestion
@@ -131,6 +131,7 @@ csharp_style_conditional_delegate_call = true:suggestion
131131
csharp_style_prefer_index_operator = false:none
132132
csharp_style_prefer_range_operator = false:none
133133
csharp_style_pattern_local_over_anonymous_function = false:none
134+
csharp_style_namespace_declarations = file_scoped:warning
134135

135136
# Space preferences
136137
csharp_space_after_cast = false
@@ -192,4 +193,4 @@ indent_size= 2
192193

193194
# Html files
194195
[*.html]
195-
indent_size= 2
196+
indent_size= 2

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818

1919
- name: Use .NET ${{ env.DOTNET_VERSION }}
20-
uses: actions/setup-dotnet@v1
20+
uses: actions/setup-dotnet@v2
2121
with:
2222
dotnet-version: ${{ env.DOTNET_VERSION }}
2323

2424
- name: Use .NET Core ${{ env.DOTNETCORE_VERSION }}
25-
uses: actions/setup-dotnet@v1
25+
uses: actions/setup-dotnet@v2
2626
with:
2727
dotnet-version: ${{ env.DOTNETCORE_VERSION }}
2828

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ jobs:
1212
publish:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616

1717
- name: Use .NET ${{ env.DOTNET_VERSION }}
18-
uses: actions/setup-dotnet@v1
18+
uses: actions/setup-dotnet@v2
1919
with:
2020
dotnet-version: ${{ env.DOTNET_VERSION }}
2121

2222
- name: Use .NET Core ${{ env.DOTNETCORE_VERSION }}
23-
uses: actions/setup-dotnet@v1
23+
uses: actions/setup-dotnet@v2
2424
with:
2525
dotnet-version: ${{ env.DOTNETCORE_VERSION }}
2626

samples/BasicSample/BasicSample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
7+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
88
</ItemGroup>
99
<ItemGroup>
1010
<ProjectReference Include="..\..\src\Azure.WebJobs.Extensions.HttpApi\Azure.WebJobs.Extensions.HttpApi.csproj" />
@@ -18,4 +18,4 @@
1818
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
1919
</None>
2020
</ItemGroup>
21-
</Project>
21+
</Project>

samples/BasicSample/Function1.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@
66
using Microsoft.Azure.WebJobs.Extensions.Http;
77
using Microsoft.Extensions.Logging;
88

9-
namespace BasicSample
9+
namespace BasicSample;
10+
11+
public class Function1 : HttpFunctionBase
1012
{
11-
public class Function1 : HttpFunctionBase
13+
public Function1(IHttpContextAccessor httpContextAccessor)
14+
: base(httpContextAccessor)
1215
{
13-
public Function1(IHttpContextAccessor httpContextAccessor)
14-
: base(httpContextAccessor)
15-
{
16-
}
16+
}
1717

18-
[FunctionName(nameof(Function1))]
19-
public IActionResult Run(
20-
[HttpTrigger(AuthorizationLevel.Function, "post")]
21-
SampleModel model,
22-
ILogger log)
18+
[FunctionName(nameof(Function1))]
19+
public IActionResult Run(
20+
[HttpTrigger(AuthorizationLevel.Function, "post")]
21+
SampleModel model,
22+
ILogger log)
23+
{
24+
if (!TryValidateModel(model))
2325
{
24-
if (!TryValidateModel(model))
25-
{
26-
return BadRequest(ModelState);
27-
}
28-
29-
return Ok(model);
26+
return BadRequest(ModelState);
3027
}
28+
29+
return Ok(model);
3130
}
3231
}

samples/BasicSample/Function2.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@
88
using Microsoft.Azure.WebJobs.Extensions.Http;
99
using Microsoft.Extensions.Logging;
1010

11-
namespace BasicSample
11+
namespace BasicSample;
12+
13+
public class Function2 : HttpFunctionBase
1214
{
13-
public class Function2 : HttpFunctionBase
15+
public Function2(IHttpContextAccessor httpContextAccessor)
16+
: base(httpContextAccessor)
1417
{
15-
public Function2(IHttpContextAccessor httpContextAccessor)
16-
: base(httpContextAccessor)
17-
{
18-
}
18+
}
1919

20-
[FunctionName(nameof(Function2))]
21-
public IActionResult Run(
22-
[HttpTrigger(AuthorizationLevel.Function, "get")]
23-
HttpRequest req,
24-
ILogger log)
25-
{
26-
Response.Headers.Add("Cache-Control", "no-cache");
20+
[FunctionName(nameof(Function2))]
21+
public IActionResult Run(
22+
[HttpTrigger(AuthorizationLevel.Function, "get")]
23+
HttpRequest req,
24+
ILogger log)
25+
{
26+
Response.Headers.Add("Cache-Control", "no-cache");
2727

28-
return Ok($"Now: {DateTime.Now}");
29-
}
28+
return Ok($"Now: {DateTime.Now}");
3029
}
3130
}

samples/BasicSample/Function3.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@
66
using Microsoft.Azure.WebJobs.Extensions.Http;
77
using Microsoft.Extensions.Logging;
88

9-
namespace BasicSample
9+
namespace BasicSample;
10+
11+
public class Function3 : HttpFunctionBase
1012
{
11-
public class Function3 : HttpFunctionBase
13+
public Function3(IHttpContextAccessor httpContextAccessor)
14+
: base(httpContextAccessor)
1215
{
13-
public Function3(IHttpContextAccessor httpContextAccessor)
14-
: base(httpContextAccessor)
15-
{
16-
}
16+
}
1717

18-
[FunctionName(nameof(Function3))]
19-
public IActionResult Run(
20-
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "route/{id}")]
21-
HttpRequest req,
22-
string id,
23-
ILogger log)
24-
{
25-
return CreatedAtFunction("Function3", new { id = "kazuakix" }, null);
26-
}
18+
[FunctionName(nameof(Function3))]
19+
public IActionResult Run(
20+
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "route/{id}")]
21+
HttpRequest req,
22+
string id,
23+
ILogger log)
24+
{
25+
return CreatedAtFunction("Function3", new { id = "kazuakix" }, null);
2726
}
2827
}

samples/BasicSample/Function4.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@
66
using Microsoft.Azure.WebJobs.Extensions.Http;
77
using Microsoft.Extensions.Logging;
88

9-
namespace BasicSample
9+
namespace BasicSample;
10+
11+
public class Function4 : HttpFunctionBase
1012
{
11-
public class Function4 : HttpFunctionBase
13+
public Function4(IHttpContextAccessor httpContextAccessor)
14+
: base(httpContextAccessor)
1215
{
13-
public Function4(IHttpContextAccessor httpContextAccessor)
14-
: base(httpContextAccessor)
15-
{
16-
}
16+
}
1717

18-
[FunctionName(nameof(Function4))]
19-
public IActionResult Run(
20-
[HttpTrigger(AuthorizationLevel.Function, "post")]
21-
SampleModel model,
22-
ILogger log)
18+
[FunctionName(nameof(Function4))]
19+
public IActionResult Run(
20+
[HttpTrigger(AuthorizationLevel.Function, "post")]
21+
SampleModel model,
22+
ILogger log)
23+
{
24+
if (!TryValidateModel(model))
2325
{
24-
if (!TryValidateModel(model))
25-
{
26-
return ValidationProblem(ModelState);
27-
}
28-
29-
return Ok(model);
26+
return ValidationProblem(ModelState);
3027
}
28+
29+
return Ok(model);
3130
}
3231
}

samples/BasicSample/Function5.cs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@
66
using Microsoft.Azure.WebJobs.Extensions.Http;
77
using Microsoft.Extensions.Logging;
88

9-
namespace BasicSample
9+
namespace BasicSample;
10+
11+
public class Function5 : HttpFunctionBase
1012
{
11-
public class Function5 : HttpFunctionBase
13+
public Function5(IHttpContextAccessor httpContextAccessor)
14+
: base(httpContextAccessor)
1215
{
13-
public Function5(IHttpContextAccessor httpContextAccessor)
14-
: base(httpContextAccessor)
15-
{
16-
}
16+
}
1717

18-
[FunctionName(nameof(Function5))]
19-
public IActionResult Run(
20-
[HttpTrigger(AuthorizationLevel.Function, "post")]
21-
SampleNestedModel model,
22-
ILogger log)
18+
[FunctionName(nameof(Function5))]
19+
public IActionResult Run(
20+
[HttpTrigger(AuthorizationLevel.Function, "post")]
21+
SampleNestedModel model,
22+
ILogger log)
23+
{
24+
if (!TryValidateModel(model))
2325
{
24-
if (!TryValidateModel(model))
25-
{
26-
return BadRequest(ModelState);
27-
}
28-
29-
return Ok(model);
26+
return BadRequest(ModelState);
3027
}
28+
29+
return Ok(model);
3130
}
3231
}

samples/BasicSample/SampleModel.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using System.ComponentModel.DataAnnotations;
22

3-
namespace BasicSample
3+
namespace BasicSample;
4+
5+
public class SampleModel
46
{
5-
public class SampleModel
6-
{
7-
[Required]
8-
public string Name { get; set; }
7+
[Required]
8+
public string Name { get; set; }
99

10-
public string[] Array { get; set; }
10+
public string[] Array { get; set; }
1111

12-
[Range(100, 10000)]
13-
public int Price { get; set; }
14-
}
12+
[Range(100, 10000)]
13+
public int Price { get; set; }
1514
}

0 commit comments

Comments
 (0)