Skip to content

Commit

Permalink
Run code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Bicep Automation committed May 26, 2024
1 parent 9633b80 commit dd5b569
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Bicep.Core.IntegrationTests/RegistryProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public async Task Providers_published_to_filesystem_can_be_compiled()
var typesTgz = ThirdPartyTypeHelper.GetTestTypesTgz();
var tempDirectory = FileHelper.GetUniqueTestOutputPath(TestContext);
Directory.CreateDirectory(tempDirectory);

var providerPath = Path.Combine(tempDirectory, "provider.tgz");
await RegistryHelper.PublishProviderToRegistryAsync(services.Build(), Path.Combine(tempDirectory, providerPath), typesTgz);

Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.Core.UnitTests/Utils/ThirdPartyTypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static void WriteTypesTgzToFs(IFileSystem fileSystem, string basePath, Bi
}

var outputPath = Path.Combine(basePath, entry.Name);
if (Path.GetDirectoryName(outputPath) is {} outputParentDir &&
if (Path.GetDirectoryName(outputPath) is { } outputParentDir &&
!fileSystem.Directory.Exists(outputParentDir))
{
fileSystem.Directory.CreateDirectory(outputParentDir);
Expand Down
12 changes: 7 additions & 5 deletions src/Bicep.Core/Registry/LocalModuleRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// Licensed under the MIT License.

using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using System.Diagnostics;
using Bicep.Core.Diagnostics;
using Bicep.Core.Extensions;
using Bicep.Core.FileSystem;
using Bicep.Core.Modules;
using Bicep.Core.Registry.Providers;
using Bicep.Core.Semantics;
using Bicep.Core.SourceCode;
using Bicep.Core.Utils;
using Bicep.Core.Registry.Providers;

namespace Bicep.Core.Registry
{
Expand All @@ -32,7 +32,8 @@ public LocalModuleRegistry(IFileResolver fileResolver, Uri parentModuleUri, Bice
public override string Scheme => ArtifactReferenceSchemes.Local;

public override RegistryCapabilities GetCapabilities(ArtifactType artifactType, LocalModuleReference reference)
=> artifactType switch {
=> artifactType switch
{
ArtifactType.Module => RegistryCapabilities.Default,
ArtifactType.Provider => RegistryCapabilities.Publish,
_ => throw new UnreachableException(),
Expand All @@ -44,7 +45,7 @@ public override ResultWithDiagnostic<ArtifactReference> TryParseArtifactReferenc
{
return new(x => x.UnsupportedArtifactType(artifactType));
}

if (!LocalModuleReference.TryParse(reference, parentModuleUri).IsSuccess(out var @ref, out var failureBuilder))
{
return new(failureBuilder);
Expand Down Expand Up @@ -93,7 +94,8 @@ public override async Task PublishProvider(LocalModuleReference reference, Binar
}

public override Task<bool> CheckArtifactExists(ArtifactType artifactType, LocalModuleReference reference)
=> artifactType switch {
=> artifactType switch
{
ArtifactType.Module => throw new NotSupportedException("Local modules cannot be published."),
ArtifactType.Provider => Task.FromResult(false),
_ => throw new UnreachableException(),
Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Core/Registry/Providers/TypesV1Archive.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ private static IEnumerable<string> GetAllUniqueTypePaths(string pathToIndex, IFi
var index = TypeSerializer.DeserializeIndex(indexStream);

var typeReferences = index.Resources.Values.ToList();
if (index.Settings?.ConfigurationType is {} configType)
if (index.Settings?.ConfigurationType is { } configType)
{
typeReferences.Add(configType);
}
if (index.FallbackResourceType is {} fallbackType)
if (index.FallbackResourceType is { } fallbackType)
{
typeReferences.Add(fallbackType);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Core/TypeSystem/TypeAssignmentVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1782,12 +1782,12 @@ private TypeSymbol GetAccessedType(AccessExpressionSyntax syntax, IDiagnosticWri

private static TypeSymbol? TryGetReadablePropertyType(ObjectType objectType, string propertyName)
{
if (objectType.Properties.TryGetValue(propertyName) is {} property && !property.Flags.HasFlag(TypePropertyFlags.WriteOnly))
if (objectType.Properties.TryGetValue(propertyName) is { } property && !property.Flags.HasFlag(TypePropertyFlags.WriteOnly))
{
return property.TypeReference.Type;
}

if (objectType.AdditionalPropertiesType is {} additionalPropertiesType && !objectType.AdditionalPropertiesFlags.HasFlag(TypePropertyFlags.WriteOnly))
if (objectType.AdditionalPropertiesType is { } additionalPropertiesType && !objectType.AdditionalPropertiesFlags.HasFlag(TypePropertyFlags.WriteOnly))
{
return additionalPropertiesType.Type;
}
Expand All @@ -1801,7 +1801,7 @@ private static TypeSymbol GetNamedPropertyType(UnionType unionType, string prope
foreach (var member in unionType.Members)
{
if (member is not ObjectType objectType ||
TryGetReadablePropertyType(objectType, propertyName) is not {} propertyType)
TryGetReadablePropertyType(objectType, propertyName) is not { } propertyType)
{
// fall back to any if we can't definitively obtain the property type.
// this may give some false positives - we can further refine this if desired.
Expand Down

0 comments on commit dd5b569

Please sign in to comment.