Skip to content

Commit e951ed0

Browse files
authored
refactor: fix ReSharper code issues (#542)
- Fix "XML no root tag defined" - Fix Spelling issues - Fix Formatting - Simplify Dictionary Lookup - Fix grammar issues - Fix redundancies in code - Fix potential code quality issues - Add Async overload for CancellationTokenSource.Cancel - Implement Language Usage Opportunities: - Use collection expression syntax - Use deconstruction to swap variables - Use primary constructor in tests
1 parent 2145b05 commit e951ed0

File tree

92 files changed

+559
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+559
-577
lines changed

.github/coverage-settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-coverage#settings -->
32

43
<Configuration>
4+
<!-- https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-coverage#settings -->
55
<CodeCoverage>
66
<Attributes>
77
<Exclude>

Source/Testably.Abstractions.Compression/Internal/ZipUtilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ internal static void CreateFromDirectory(
180180
else if (file is IDirectoryInfo directoryInfo &&
181181
directoryInfo.GetFileSystemInfos().Length == 0)
182182
{
183-
#pragma warning disable CA1845
183+
#pragma warning disable CA1845
184184
string entryName = file.FullName.Substring(basePath.Length + 1) + "/";
185-
#pragma warning restore CA1845
185+
#pragma warning restore CA1845
186186
archive.CreateEntry(entryName);
187187
}
188188
}
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#if NETSTANDARD2_0 || NETSTANDARD2_1
22
global using Testably.Abstractions.Polyfills;
3-
#else
4-
global using System.Runtime.Versioning;
53
#endif

Source/Testably.Abstractions.Testing/FileSystem/DirectoryInfoMock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public IDirectoryInfo CreateSubdirectory(string path)
8989
_fileSystem.Storage.GetLocation(
9090
_fileSystem.Execute.Path.Combine(FullName, path
9191
.EnsureValidFormat(_fileSystem, nameof(path),
92-
_fileSystem.Execute.IsWindows && !_fileSystem.Execute.IsNetFramework))),
92+
_fileSystem.Execute is { IsWindows: true, IsNetFramework: false }))),
9393
_fileSystem);
9494
directory.Create();
9595
return directory;

Source/Testably.Abstractions.Testing/FileSystem/DriveInfoMock.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ public string VolumeLabel
183183
using IDisposable registration =
184184
RegisterProperty(nameof(VolumeLabel), PropertyAccess.Set);
185185

186+
// ReSharper disable once ConstantNullCoalescingCondition
186187
_volumeLabel = value ?? _volumeLabel;
187188
_fileSystem.Execute.NotOnWindows(
188189
() => throw ExceptionFactory.OperationNotSupportedOnThisPlatform());

Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal sealed class FileSystemWatcherMock : Component, IFileSystemWatcher
2727
private IDisposable? _changeHandler;
2828
private bool _enableRaisingEvents;
2929
private readonly MockFileSystem _fileSystem;
30-
private readonly Collection<string> _filters = new();
30+
private readonly Collection<string> _filters = [];
3131
private bool _includeSubdirectories;
3232
private int _internalBufferSize = 8192;
3333
private bool _isInitializing;

Source/Testably.Abstractions.Testing/FileSystem/INotificationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface INotificationHandler : IFileSystemEntity
1616
/// (optional) A predicate used to filter which callbacks should be notified.<br />
1717
/// If set to <see langword="null" /> (default value) all callbacks are notified.
1818
/// </param>
19-
/// <returns>An <see cref="Notification.IAwaitableCallback{ChangeDescription}" /> to un-register the callback on dispose.</returns>
19+
/// <returns>A <see cref="Notification.IAwaitableCallback{ChangeDescription}" /> to un-register the callback on dispose.</returns>
2020
Notification.IAwaitableCallback<ChangeDescription> OnEvent(
2121
Action<ChangeDescription>? notificationCallback = null,
2222
Func<ChangeDescription, bool>? predicate = null);

Source/Testably.Abstractions.Testing/FileSystemTypes.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Testably.Abstractions.Testing;
44

55
/// <summary>
6-
/// Determines the type of an entry in the <see cref="MockFileSystem" />.
6+
/// Determines the entry's type in the <see cref="MockFileSystem" />.
77
/// </summary>
88
[Flags]
99
public enum FileSystemTypes

Source/Testably.Abstractions.Testing/Helpers/EnumerationOptionsHelper.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,7 @@ private static bool MatchPattern(Execute execute,
145145
/// </summary>
146146
private static string SimplifyExpression(Execute execute, string searchString)
147147
{
148-
char[] unixEscapeChars =
149-
{
150-
'\\',
151-
'"',
152-
'<',
153-
'>'
154-
};
148+
char[] unixEscapeChars = ['\\', '"', '<', '>'];
155149
if (string.Equals(searchString, DefaultSearchPattern, StringComparison.Ordinal))
156150
{
157151
return searchString;

Source/Testably.Abstractions.Testing/Helpers/Execute.NativePath.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System.Diagnostics.CodeAnalysis;
2-
using System.IO;
3-
#if FEATURE_SPAN
1+
#if FEATURE_SPAN
42
using System;
53
#endif
4+
using System.Diagnostics.CodeAnalysis;
5+
using System.IO;
66
#if FEATURE_FILESYSTEM_NET7
77
using Testably.Abstractions.Testing.Storage;
88
#endif

0 commit comments

Comments
 (0)