Skip to content

Commit 74dd7c8

Browse files
authored
Merge pull request #35 from rameel/cleanup
Cosmetic improvements
2 parents d9d7215 + 243f40c commit 74dd7c8

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

src/Ramstack.FileSystem.Abstractions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Console.WriteLine(await reader.ReadToEndAsync());
8383

8484
### VirtualDirectory
8585

86-
The `VirtualDirectory` class provides properties and methods for creating, deleting, and enumerating directories and subdirectories.
86+
The `VirtualDirectory` class provides properties and methods for creating, deleting and enumerating directories and subdirectories.
8787

8888
```csharp
8989
public static async Task PrintFilesAsync(VirtualDirectory directory, string padding = "", CancellationToken cancellationToken = default)

src/Ramstack.FileSystem.Abstractions/VirtualFileExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ namespace Ramstack.FileSystem;
88
/// </summary>
99
public static class VirtualFileExtensions
1010
{
11-
private static Encoding? _utf8NoBom;
11+
private static Encoding? s_utf8NoBom;
1212

1313
/// <summary>
14-
/// Gets an instance of <c>UTF8</c> encoding without BOM.
14+
/// Gets an instance of the <see cref="UTF8Encoding"/> without BOM.
1515
/// </summary>
16-
private static Encoding Utf8NoBom => _utf8NoBom ??= new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
16+
private static Encoding Utf8NoBom => s_utf8NoBom ??= new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
1717

1818
/// <summary>
1919
/// Asynchronously returns a <see cref="StreamReader"/> with <see cref="Encoding.UTF8"/>
@@ -279,7 +279,7 @@ public static ValueTask WriteAllTextAsync(this VirtualFile file, string contents
279279
WriteAllTextAsync(file, contents.AsMemory(), encoding, cancellationToken);
280280

281281
/// <summary>
282-
/// Asynchronously writes the specified string to current the file. If the file already exists, it is truncated and overwritten.
282+
/// Asynchronously writes the specified string to the current file. If the file already exists, it is truncated and overwritten.
283283
/// </summary>
284284
/// <param name="file">The file to write to.</param>
285285
/// <param name="contents">The contents to write to the file.</param>

src/Ramstack.FileSystem.Abstractions/VirtualFileSystemExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public static ValueTask WriteAllTextAsync(this IVirtualFileSystem fs, string pat
189189
fs.GetFile(path).WriteAllTextAsync(contents, encoding, cancellationToken);
190190

191191
/// <summary>
192-
/// Asynchronously writes the specified string to specified the file. If the file already exists, it is truncated and overwritten.
192+
/// Asynchronously writes the specified string to the specified the file. If the file already exists, it is truncated and overwritten.
193193
/// </summary>
194194
/// <param name="fs">The file system to use.</param>
195195
/// <param name="path">The file to write to.</param>

src/Ramstack.FileSystem.Abstractions/VirtualPath.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static ReadOnlySpan<char> GetExtension(ReadOnlySpan<char> path)
8282
/// <summary>
8383
/// Returns the file name and extension for the specified path.
8484
/// </summary>
85-
/// <param name="path">The path from which to obtain the file name and extension.</param>
85+
/// <param name="path">The path from which to get the file name and extension.</param>
8686
/// <returns>
8787
/// The file name and extension for the <paramref name="path"/>.
8888
/// </returns>
@@ -100,7 +100,7 @@ public static string GetFileName(string path)
100100
/// <summary>
101101
/// Returns the file name and extension for the specified path.
102102
/// </summary>
103-
/// <param name="path">The path from which to obtain the file name and extension.</param>
103+
/// <param name="path">The path from which to get the file name and extension.</param>
104104
/// <returns>
105105
/// The file name and extension for the <paramref name="path"/>.
106106
/// </returns>
@@ -118,7 +118,7 @@ public static ReadOnlySpan<char> GetFileName(ReadOnlySpan<char> path)
118118
/// </summary>
119119
/// <param name="path">The path to retrieve the directory portion from.</param>
120120
/// <returns>
121-
/// Directory portion for <paramref name="path"/>, or an empty string if path denotes a root directory.
121+
/// Directory portion for <paramref name="path"/>, or an empty string if the path denotes a root directory.
122122
/// </returns>
123123
public static string GetDirectoryName(string path)
124124
{

src/Ramstack.FileSystem.Amazon/S3UploadStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public override Task WriteAsync(byte[] buffer, int offset, int count, Cancellati
124124
WriteAsync(buffer.AsMemory(offset, count), cancellationToken).AsTask();
125125

126126
/// <inheritdoc />
127-
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = new CancellationToken())
127+
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
128128
{
129129
try
130130
{

src/Ramstack.FileSystem.Azure/AzureFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public ValueTask CreateContainerAsync(CancellationToken cancellationToken = defa
118118
/// <item>
119119
/// <description>
120120
/// <see cref="PublicAccessType.BlobContainer" />: Specifies full public read access for both the container and blob data.
121-
/// Clients can enumerate blobs within the container via anonymous requests, but cannot enumerate containers within the storage account.
121+
/// Clients can enumerate blobs within the container via anonymous requests but cannot enumerate containers within the storage account.
122122
/// </description>
123123
/// </item>
124124
/// <item>

src/Ramstack.FileSystem.Physical/PhysicalDirectory.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal sealed class PhysicalDirectory : VirtualDirectory
1515
/// including system and hidden files, not recurse through subdirectories,
1616
/// and ignore inaccessible files.
1717
/// </summary>
18-
private static readonly EnumerationOptions DefaultOptions = new()
18+
private static readonly EnumerationOptions s_defaultOptions = new()
1919
{
2020
AttributesToSkip = 0,
2121
RecurseSubdirectories = false,
@@ -85,7 +85,7 @@ protected override IAsyncEnumerable<VirtualNode> GetFileNodesCoreAsync(Cancellat
8585
// its existence was checked.
8686

8787
var nodes = Directory.Exists(_physicalPath)
88-
? new FileSystemEnumerable<VirtualNode>(_physicalPath, FindTransform, DefaultOptions)
88+
? new FileSystemEnumerable<VirtualNode>(_physicalPath, FindTransform, s_defaultOptions)
8989
: Enumerable.Empty<VirtualNode>();
9090

9191
return nodes.ToAsyncEnumerable();
@@ -108,17 +108,17 @@ protected override IAsyncEnumerable<VirtualFile> GetFilesCoreAsync(CancellationT
108108

109109
if (Directory.Exists(_physicalPath))
110110
{
111-
nodes = new FileSystemEnumerable<VirtualFile>(_physicalPath, FindTransform, DefaultOptions)
111+
nodes = new FileSystemEnumerable<VirtualFile>(_physicalPath, FindTransform, s_defaultOptions)
112112
{
113-
ShouldIncludePredicate = (ref FileSystemEntry entry) => !entry.IsDirectory
113+
ShouldIncludePredicate = (ref entry) => !entry.IsDirectory
114114
};
115115
}
116116

117117
return nodes.ToAsyncEnumerable();
118118

119119
VirtualFile FindTransform(ref FileSystemEntry entry)
120120
{
121-
Debug.Assert(entry.IsDirectory == false);
121+
Debug.Assert(!entry.IsDirectory);
122122

123123
var fullName = VirtualPath.Join(FullName, entry.FileName);
124124
var physicalPath = entry.ToFullPath();
@@ -134,9 +134,9 @@ protected override IAsyncEnumerable<VirtualDirectory> GetDirectoriesCoreAsync(Ca
134134

135135
if (Directory.Exists(_physicalPath))
136136
{
137-
nodes = new FileSystemEnumerable<VirtualDirectory>(_physicalPath, FindTransform, DefaultOptions)
137+
nodes = new FileSystemEnumerable<VirtualDirectory>(_physicalPath, FindTransform, s_defaultOptions)
138138
{
139-
ShouldIncludePredicate = (ref FileSystemEntry entry) => entry.IsDirectory
139+
ShouldIncludePredicate = (ref entry) => entry.IsDirectory
140140
};
141141
}
142142

src/Ramstack.FileSystem.Physical/PhysicalFile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected override ValueTask<Stream> OpenWriteCoreAsync(CancellationToken cancel
6565

6666
var stream = new FileStream(_physicalPath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, DefaultBufferSize, options);
6767

68-
// Since, FileMode.OpenOrCreate doesn't truncate the file, we manually
68+
// Since FileMode.OpenOrCreate doesn't truncate the file, we manually
6969
// set the file length to zero to remove any leftover data.
7070
stream.SetLength(0);
7171

@@ -90,7 +90,7 @@ protected override async ValueTask WriteCoreAsync(Stream stream, bool overwrite,
9090

9191
await using var fs = new FileStream(_physicalPath, fileMode, FileAccess.Write, FileShare.None, DefaultBufferSize, options);
9292

93-
// Since, FileMode.OpenOrCreate doesn't truncate the file, we manually
93+
// Since FileMode.OpenOrCreate doesn't truncate the file, we manually
9494
// set the file length to zero to remove any leftover data.
9595
fs.SetLength(0);
9696

src/Ramstack.FileSystem.Prefixed/PrefixedFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public PrefixedFileSystem(string prefix, IVirtualFileSystem fileSystem)
2929
prefix = VirtualPath.Normalize(prefix);
3030
(_prefix, _fs) = (prefix, fileSystem);
3131

32-
// Create artificial directory list
32+
// Create an artificial directory list
3333
_directories = CreateArtificialDirectories(this, prefix);
3434

3535
static VirtualDirectory[] CreateArtificialDirectories(PrefixedFileSystem fs, string path)

0 commit comments

Comments
 (0)