Skip to content

Commit

Permalink
Code quality updates
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite committed Sep 15, 2024
1 parent af1d30b commit 9970798
Show file tree
Hide file tree
Showing 34 changed files with 2,405 additions and 2,436 deletions.
2 changes: 1 addition & 1 deletion src/PSRule.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Project defaults -->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>9.0</LangVersion>
<LangVersion>12.0</LangVersion>
<!-- <Nullable>enable</Nullable> -->
<!-- <ImplicitUsings>enable</ImplicitUsings> -->
<NeutralLanguage>en-US</NeutralLanguage>
Expand Down
30 changes: 14 additions & 16 deletions src/PSRule.Rules.Azure/Data/AvailabilityZoneMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@

using Newtonsoft.Json;

namespace PSRule.Rules.Azure.Data
{
namespace PSRule.Rules.Azure.Data;

/// <summary>
/// An Azure Availability Zone mapping between location and zones.
/// </summary>
public sealed class AvailabilityZoneMapping
{
/// <summary>
/// An Azure Availability Zone mapping between location and zones.
/// The location/ region where AZ is available.
/// </summary>
public sealed class AvailabilityZoneMapping
{
/// <summary>
/// The location/ region where AZ is available.
/// </summary>
[JsonProperty(PropertyName = "l")]
public string Location { get; set; }
[JsonProperty(PropertyName = "l")]
public string Location { get; set; }

/// <summary>
/// The zone names available at the location.
/// </summary>
[JsonProperty(PropertyName = "z")]
public string[] Zones { get; set; }
}
/// <summary>
/// The zone names available at the location.
/// </summary>
[JsonProperty(PropertyName = "z")]
public string[] Zones { get; set; }
}
39 changes: 19 additions & 20 deletions src/PSRule.Rules.Azure/Data/Template/ArrayDeploymentSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,30 @@
using System;
using System.Collections.Generic;

namespace PSRule.Rules.Azure.Data.Template
namespace PSRule.Rules.Azure.Data.Template;

internal sealed class ArrayDeploymentSymbol : DeploymentSymbol, IDeploymentSymbol
{
internal sealed class ArrayDeploymentSymbol : DeploymentSymbol, IDeploymentSymbol
{
private List<string> _Ids;
private List<string> _Ids;

public ArrayDeploymentSymbol(string name)
: base(name) { }
public ArrayDeploymentSymbol(string name)
: base(name) { }

public DeploymentSymbolKind Kind => DeploymentSymbolKind.Array;
public DeploymentSymbolKind Kind => DeploymentSymbolKind.Array;

public void Configure(ResourceValue resource)
{
_Ids ??= new List<string>();
_Ids.Add(resource.Id);
}
public void Configure(ResourceValue resource)
{
_Ids ??= [];
_Ids.Add(resource.Id);
}

public string GetId(int index)
{
return _Ids[index];
}
public string GetId(int index)
{
return _Ids[index];
}

public string[] GetIds()
{
return _Ids?.ToArray() ?? Array.Empty<string>();
}
public string[] GetIds()
{
return _Ids?.ToArray() ?? Array.Empty<string>();
}
}
26 changes: 9 additions & 17 deletions src/PSRule.Rules.Azure/Data/Template/BaseResourceValue.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace PSRule.Rules.Azure.Data.Template
{
internal abstract class BaseResourceValue
{
protected BaseResourceValue(string id, string name, string symbolicName)
{
Id = id;
Name = name;
SymbolicName = symbolicName;
}
namespace PSRule.Rules.Azure.Data.Template;

/// <inheritdoc/>
public string Id { get; }
internal abstract class BaseResourceValue(string id, string name, string symbolicName)
{
/// <inheritdoc/>
public string Id { get; } = id;

/// <inheritdoc/>
public string Name { get; }
/// <inheritdoc/>
public string Name { get; } = name;

/// <inheritdoc/>
public string SymbolicName { get; }
}
/// <inheritdoc/>
public string SymbolicName { get; } = symbolicName;
}
Loading

0 comments on commit 9970798

Please sign in to comment.