Skip to content

Commit aa5623b

Browse files
Update EditorConfig and fix formatting issues
1 parent ec9338a commit aa5623b

File tree

8 files changed

+29
-24
lines changed

8 files changed

+29
-24
lines changed

.globalconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = sug
4848
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = suggestion
4949
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = suggestion
5050

51-
dotnet_diagnostic.SA1636.severity = none # SA1636: File header copyright text should match
5251
dotnet_diagnostic.SA1101.severity = none # PrefixLocalCallsWithThis - stylecop appears to be ignoring dotnet_style_qualification_for_*
5352
dotnet_diagnostic.SA1309.severity = none # FieldNamesMustNotBeginWithUnderscore
53+
dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializers
54+
dotnet_diagnostic.SA1633.severity = none # FileMustHaveHeader
55+
dotnet_diagnostic.SA1636.severity = none # FileHeaderCopyrightTextMustMatch
5456

5557
dotnet_diagnostic.SA1503.severity = warning # BracesMustNotBeOmitted
5658
dotnet_diagnostic.SA1117.severity = warning # ParametersMustBeOnSameLineOrSeparateLines
@@ -81,3 +83,6 @@ dotnet_diagnostic.SA1209.severity = warning # UsingAliasDirectivesMustBePlacedAf
8183
dotnet_diagnostic.SA1216.severity = warning # UsingStaticDirectivesMustBePlacedAtTheCorrectLocation
8284
dotnet_diagnostic.SA1133.severity = warning # DoNotCombineAttributes
8385
dotnet_diagnostic.SA1135.severity = warning # UsingDirectivesMustBeQualified
86+
87+
# IDE0058: Expression value is never used
88+
dotnet_diagnostic.IDE0058.severity = none

src/Umbraco.StorageProviders.AzureBlob.ImageSharp/AzureBlobFileSystemImageCache.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public AzureBlobFileSystemImageCache(IOptionsMonitor<AzureBlobFileSystemOptions>
3030
ArgumentNullException.ThrowIfNull(options);
3131
ArgumentNullException.ThrowIfNull(name);
3232

33-
var fileSystemOptions = options.Get(name);
33+
AzureBlobFileSystemOptions fileSystemOptions = options.Get(name);
3434
_container = new BlobContainerClient(fileSystemOptions.ConnectionString, fileSystemOptions.ContainerName);
3535
_containerRootPath = GetContainerRootPath(containerRootPath, fileSystemOptions);
3636

@@ -56,17 +56,10 @@ public AzureBlobFileSystemImageCache(BlobContainerClient blobContainerClient, st
5656
_containerRootPath = GetContainerRootPath(containerRootPath);
5757
}
5858

59-
private static string? GetContainerRootPath(string? containerRootPath, AzureBlobFileSystemOptions? options = null)
60-
{
61-
var path = containerRootPath ?? options?.ContainerRootPath;
62-
63-
return string.IsNullOrEmpty(path) ? null : path.EnsureEndsWith('/');
64-
}
65-
6659
/// <inheritdoc />
6760
public async Task<IImageCacheResolver?> GetAsync(string key)
6861
{
69-
var blob = _container.GetBlobClient(_containerRootPath + key);
62+
BlobClient blob = _container.GetBlobClient(_containerRootPath + key);
7063

7164
return !await blob.ExistsAsync().ConfigureAwait(false)
7265
? null
@@ -76,11 +69,18 @@ public AzureBlobFileSystemImageCache(BlobContainerClient blobContainerClient, st
7669
/// <inheritdoc />
7770
public async Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata)
7871
{
79-
var blob = _container.GetBlobClient(_containerRootPath + key);
72+
BlobClient blob = _container.GetBlobClient(_containerRootPath + key);
8073

8174
await blob.UploadAsync(stream, new BlobUploadOptions()
8275
{
8376
Metadata = metadata.ToDictionary()
8477
}).ConfigureAwait(false);
8578
}
79+
80+
private static string? GetContainerRootPath(string? containerRootPath, AzureBlobFileSystemOptions? options = null)
81+
{
82+
var path = containerRootPath ?? options?.ContainerRootPath;
83+
84+
return string.IsNullOrEmpty(path) ? null : path.EnsureEndsWith('/');
85+
}
8686
}

src/Umbraco.StorageProviders.AzureBlob/AzureBlobFileProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public IDirectoryContents GetDirectoryContents(string subpath)
6161
public IFileInfo GetFileInfo(string subpath)
6262
{
6363
var path = GetFullPath(subpath);
64-
var blobClient = _containerClient.GetBlobClient(path);
64+
BlobClient blobClient = _containerClient.GetBlobClient(path);
6565

6666
BlobProperties properties;
6767
try

src/Umbraco.StorageProviders.AzureBlob/DependencyInjection/AzureBlobFileSystemExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ internal static IUmbracoBuilder AddInternal(this IUmbracoBuilder builder, string
8989

9090
builder.Services.TryAddSingleton<IAzureBlobFileSystemProvider, AzureBlobFileSystemProvider>();
9191

92-
var optionsBuilder = builder.Services.AddOptions<AzureBlobFileSystemOptions>(name)
92+
OptionsBuilder<AzureBlobFileSystemOptions> optionsBuilder = builder.Services.AddOptions<AzureBlobFileSystemOptions>(name)
9393
.BindConfiguration($"Umbraco:Storage:AzureBlob:{name}")
9494
.ValidateDataAnnotations();
9595

src/Umbraco.StorageProviders.AzureBlob/IO/AzureBlobFileSystem.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void DeleteDirectory(string path, bool recursive)
112112
{
113113
ArgumentNullException.ThrowIfNull(path);
114114

115-
foreach (var blob in ListBlobs(GetDirectoryPath(path)))
115+
foreach (BlobHierarchyItem blob in ListBlobs(GetDirectoryPath(path)))
116116
{
117117
if (blob.IsPrefix)
118118
{
@@ -153,7 +153,7 @@ public void AddFile(string path, Stream stream, bool overrideIfExists)
153153
ArgumentNullException.ThrowIfNull(path);
154154
ArgumentNullException.ThrowIfNull(stream);
155155

156-
var blob = GetBlobClient(path);
156+
BlobClient blob = GetBlobClient(path);
157157
if (!overrideIfExists && blob.Exists())
158158
{
159159
throw new InvalidOperationException($"A file at path '{path}' already exists");
@@ -165,7 +165,7 @@ public void AddFile(string path, Stream stream, bool overrideIfExists)
165165
headers.ContentType = contentType;
166166
}
167167

168-
var conditions = overrideIfExists ? null : new BlobRequestConditions
168+
BlobRequestConditions? conditions = overrideIfExists ? null : new BlobRequestConditions
169169
{
170170
IfNoneMatch = ETag.All
171171
};
@@ -185,19 +185,19 @@ public void AddFile(string path, string physicalPath, bool overrideIfExists = tr
185185
ArgumentNullException.ThrowIfNull(path);
186186
ArgumentNullException.ThrowIfNull(physicalPath);
187187

188-
var destinationBlob = GetBlobClient(path);
188+
BlobClient destinationBlob = GetBlobClient(path);
189189
if (!overrideIfExists && destinationBlob.Exists())
190190
{
191191
throw new InvalidOperationException($"A file at path '{path}' already exists");
192192
}
193193

194-
var sourceBlob = GetBlobClient(physicalPath);
195-
var destinationConditions = overrideIfExists ? null : new BlobRequestConditions
194+
BlobClient sourceBlob = GetBlobClient(physicalPath);
195+
BlobRequestConditions? destinationConditions = overrideIfExists ? null : new BlobRequestConditions
196196
{
197197
IfNoneMatch = ETag.All
198198
};
199199

200-
var copyFromUriOperation = destinationBlob.StartCopyFromUri(sourceBlob.Uri, new BlobCopyFromUriOptions()
200+
CopyFromUriOperation copyFromUriOperation = destinationBlob.StartCopyFromUri(sourceBlob.Uri, new BlobCopyFromUriOptions()
201201
{
202202
DestinationConditions = destinationConditions
203203
});
@@ -228,7 +228,7 @@ public IEnumerable<string> GetFiles(string path, string? filter)
228228
{
229229
ArgumentNullException.ThrowIfNull(path);
230230

231-
var files = ListBlobs(GetDirectoryPath(path)).Where(x => x.IsBlob).Select(x => x.Blob.Name);
231+
IEnumerable<string> files = ListBlobs(GetDirectoryPath(path)).Where(x => x.IsBlob).Select(x => x.Blob.Name);
232232
if (!string.IsNullOrEmpty(filter) && filter != "*.*")
233233
{
234234
// TODO: Might be better to use a globbing library

src/Umbraco.StorageProviders.AzureBlob/IO/AzureBlobFileSystemProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public IAzureBlobFileSystem GetFileSystem(string name)
4242

4343
return _fileSystems.GetOrAdd(name, name =>
4444
{
45-
var options = _optionsMonitor.Get(name);
45+
AzureBlobFileSystemOptions options = _optionsMonitor.Get(name);
4646

4747
return new AzureBlobFileSystem(options, _hostingEnvironment, _ioHelper, _fileExtensionContentTypeProvider);
4848
});

src/Umbraco.StorageProviders/CdnMediaUrlProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public CdnMediaUrlProvider(IOptionsMonitor<CdnMediaUrlProviderOptions> options,
6161
/// <inheritdoc />
6262
public override UrlInfo? GetMediaUrl(IPublishedContent content, string propertyAlias, UrlMode mode, string? culture, Uri current)
6363
{
64-
var mediaUrl = base.GetMediaUrl(content, propertyAlias, UrlMode.Relative, culture, current);
64+
UrlInfo? mediaUrl = base.GetMediaUrl(content, propertyAlias, UrlMode.Relative, culture, current);
6565
if (mediaUrl?.IsUrl == true)
6666
{
6767
string url = mediaUrl.Text;

src/Umbraco.StorageProviders/DependencyInjection/CdnMediaUrlProviderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ internal static IUmbracoBuilder AddInternal(this IUmbracoBuilder builder, Action
7373

7474
builder.MediaUrlProviders().Insert<CdnMediaUrlProvider>();
7575

76-
var optionsBuilder = builder.Services.AddOptions<CdnMediaUrlProviderOptions>()
76+
OptionsBuilder<CdnMediaUrlProviderOptions> optionsBuilder = builder.Services.AddOptions<CdnMediaUrlProviderOptions>()
7777
.BindConfiguration("Umbraco:Storage:Cdn")
7878
.ValidateDataAnnotations();
7979

0 commit comments

Comments
 (0)