Skip to content

Commit 4555ac0

Browse files
authored
Code quality updates (Azure#3040)
1 parent 1d4183d commit 4555ac0

34 files changed

+2405
-2436
lines changed

src/PSRule.Common.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- Project defaults -->
44
<PropertyGroup>
55
<TargetFramework>netstandard2.0</TargetFramework>
6-
<LangVersion>9.0</LangVersion>
6+
<LangVersion>12.0</LangVersion>
77
<!-- <Nullable>enable</Nullable> -->
88
<!-- <ImplicitUsings>enable</ImplicitUsings> -->
99
<NeutralLanguage>en-US</NeutralLanguage>

src/PSRule.Rules.Azure/Data/AvailabilityZoneMapping.cs

+14-16
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33

44
using Newtonsoft.Json;
55

6-
namespace PSRule.Rules.Azure.Data
7-
{
6+
namespace PSRule.Rules.Azure.Data;
87

8+
/// <summary>
9+
/// An Azure Availability Zone mapping between location and zones.
10+
/// </summary>
11+
public sealed class AvailabilityZoneMapping
12+
{
913
/// <summary>
10-
/// An Azure Availability Zone mapping between location and zones.
14+
/// The location/ region where AZ is available.
1115
/// </summary>
12-
public sealed class AvailabilityZoneMapping
13-
{
14-
/// <summary>
15-
/// The location/ region where AZ is available.
16-
/// </summary>
17-
[JsonProperty(PropertyName = "l")]
18-
public string Location { get; set; }
16+
[JsonProperty(PropertyName = "l")]
17+
public string Location { get; set; }
1918

20-
/// <summary>
21-
/// The zone names available at the location.
22-
/// </summary>
23-
[JsonProperty(PropertyName = "z")]
24-
public string[] Zones { get; set; }
25-
}
19+
/// <summary>
20+
/// The zone names available at the location.
21+
/// </summary>
22+
[JsonProperty(PropertyName = "z")]
23+
public string[] Zones { get; set; }
2624
}

src/PSRule.Rules.Azure/Data/Template/ArrayDeploymentSymbol.cs

+19-20
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,30 @@
44
using System;
55
using System.Collections.Generic;
66

7-
namespace PSRule.Rules.Azure.Data.Template
7+
namespace PSRule.Rules.Azure.Data.Template;
8+
9+
internal sealed class ArrayDeploymentSymbol : DeploymentSymbol, IDeploymentSymbol
810
{
9-
internal sealed class ArrayDeploymentSymbol : DeploymentSymbol, IDeploymentSymbol
10-
{
11-
private List<string> _Ids;
11+
private List<string> _Ids;
1212

13-
public ArrayDeploymentSymbol(string name)
14-
: base(name) { }
13+
public ArrayDeploymentSymbol(string name)
14+
: base(name) { }
1515

16-
public DeploymentSymbolKind Kind => DeploymentSymbolKind.Array;
16+
public DeploymentSymbolKind Kind => DeploymentSymbolKind.Array;
1717

18-
public void Configure(ResourceValue resource)
19-
{
20-
_Ids ??= new List<string>();
21-
_Ids.Add(resource.Id);
22-
}
18+
public void Configure(ResourceValue resource)
19+
{
20+
_Ids ??= [];
21+
_Ids.Add(resource.Id);
22+
}
2323

24-
public string GetId(int index)
25-
{
26-
return _Ids[index];
27-
}
24+
public string GetId(int index)
25+
{
26+
return _Ids[index];
27+
}
2828

29-
public string[] GetIds()
30-
{
31-
return _Ids?.ToArray() ?? Array.Empty<string>();
32-
}
29+
public string[] GetIds()
30+
{
31+
return _Ids?.ToArray() ?? Array.Empty<string>();
3332
}
3433
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
namespace PSRule.Rules.Azure.Data.Template
5-
{
6-
internal abstract class BaseResourceValue
7-
{
8-
protected BaseResourceValue(string id, string name, string symbolicName)
9-
{
10-
Id = id;
11-
Name = name;
12-
SymbolicName = symbolicName;
13-
}
4+
namespace PSRule.Rules.Azure.Data.Template;
145

15-
/// <inheritdoc/>
16-
public string Id { get; }
6+
internal abstract class BaseResourceValue(string id, string name, string symbolicName)
7+
{
8+
/// <inheritdoc/>
9+
public string Id { get; } = id;
1710

18-
/// <inheritdoc/>
19-
public string Name { get; }
11+
/// <inheritdoc/>
12+
public string Name { get; } = name;
2013

21-
/// <inheritdoc/>
22-
public string SymbolicName { get; }
23-
}
14+
/// <inheritdoc/>
15+
public string SymbolicName { get; } = symbolicName;
2416
}

0 commit comments

Comments
 (0)