Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 11 additions & 55 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ root = true
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yml,yaml}]
indent_size = 2
Expand All @@ -28,62 +28,18 @@ csharp_style_var_elsewhere = true:suggestion
# Indentation preferences
csharp_indent_labels = no_change

# IDE0059: Unnecessary assigment of a value
dotnet_diagnostic.IDE0059.severity = none

# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = none

# IDE0079: Remove unnecessary suppression
# dotnet_diagnostic.IDE0079.severity = none

# IDE0079: Remove unnecessary suppression
dotnet_remove_unnecessary_suppression_exclusions = category:ReSharper

# CS8600: Converting null literal or possible null value to non-nullable type.
dotnet_diagnostic.CS8600.severity = error

# CS8601: Possible null reference assignment.
dotnet_diagnostic.CS8601.severity = error

# CS8602: Dereference of a possibly null reference.
dotnet_diagnostic.CS8602.severity = error

# CS8603: Possible null reference return.
dotnet_diagnostic.CS8603.severity = error

# CS8604: Possible null reference argument.
dotnet_diagnostic.CS8604.severity = error

# CS8610: Nullability of reference types in type of parameter doesn't match overridden member.
dotnet_diagnostic.CS8610.severity = error

# CS8613: Nullability of reference types in return type doesn't match implicitly implemented member.
dotnet_diagnostic.CS8613.severity = error

# CS8614: Nullability of reference types in type of parameter doesn't match implicitly implemented member.
dotnet_diagnostic.CS8614.severity = error

# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = error

# CS8619: Nullability of reference types in value doesn't match target type.
dotnet_diagnostic.CS8619.severity = error

# CS8620: Argument cannot be used for parameter due to differences in the nullability of reference types.
dotnet_diagnostic.CS8620.severity = error

# CS8625: Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8625.severity = error

# CS8634: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'class' constraint.
dotnet_diagnostic.CS8634.severity = error

# CS8643: Nullability of reference types in explicit interface specifier doesn't match interface implemented by the type.
dotnet_diagnostic.CS8643.severity = error
[tests/**.cs]
# CA1707: Identifiers should not contain underscores
# Tests follow the Method_Condition_ExpectedResult naming convention.
dotnet_diagnostic.CA1707.severity = none

# CS8653: A default expression introduces a null value for a type parameter.
dotnet_diagnostic.CS8653.severity = error
# CA1001: Types that own disposable fields should be disposable
# Test fixtures release their resources in [OneTimeTearDown] methods, which the rule does not recognize.
dotnet_diagnostic.CA1001.severity = none

# CS8714: The type cannot be used as type parameter in the generic type or method. Nullability of type argument doesn't match 'notnull' constraint.
dotnet_diagnostic.CS8714.severity = error
# CA1716: Identifiers should not match keywords
# Test namespaces match the namespaces of the code under test.
dotnet_diagnostic.CA1716.severity = none
14 changes: 14 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@
<PropertyGroup>
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);CS0649</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>Recommended</AnalysisMode>
<AnalysisModeStyle>Default</AnalysisModeStyle>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
<RootNamespace>Ramstack.FileSystem</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
2 changes: 2 additions & 0 deletions src/Ramstack.FileSystem.Amazon/S3UploadStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ protected override void Dispose(bool disposing)
}

/// <inheritdoc />
[SuppressMessage("Usage", "CA2215:Dispose methods should call base class dispose",
Justification = "Stream.DisposeAsync only calls Dispose, which re-enters this method, and the base Stream releases nothing on disposal.")]
public override async ValueTask DisposeAsync()
{
if (Interlocked.Exchange(ref _disposed, 1) != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
2 changes: 1 addition & 1 deletion src/Ramstack.FileSystem.Prefixed/PrefixedDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Ramstack.FileSystem.Prefixed;
/// Represents a directory in a <see cref="PrefixedFileSystem"/>,
/// wrapping an existing <see cref="VirtualDirectory"/> instance with a prefixed path.
/// </summary>
internal class PrefixedDirectory : VirtualDirectory
internal sealed class PrefixedDirectory : VirtualDirectory
{
private readonly PrefixedFileSystem _fs;
private readonly VirtualDirectory _directory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
5 changes: 5 additions & 0 deletions src/Ramstack.FileSystem.Readonly/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Naming", "CA1716:Identifiers should not match keywords",
Scope = "namespace", Target = "~N:Ramstack.FileSystem.Readonly",
Justification = "The namespace matches the package name, and renaming it would break the public API.")]
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
5 changes: 5 additions & 0 deletions src/Ramstack.FileSystem.Sub/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Naming", "CA1716:Identifiers should not match keywords",
Scope = "namespace", Target = "~N:Ramstack.FileSystem.Sub",
Justification = "The namespace matches the package name, and renaming it would break the public API.")]
5 changes: 0 additions & 5 deletions src/Ramstack.FileSystem.Sub/Ramstack.FileSystem.Sub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup>
<NoWarn>649;1591</NoWarn>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8604;CS8610;CS8613;CS8614;CS8618;CS8619;CS8620;CS8625;CS8643;CS8653;CS8714</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<RepositoryUrl>https://github.com/rameel/ramstack.filesystem</RepositoryUrl>
<Authors>Rameel</Authors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,9 @@ await file.GetLengthAsync(),

var count = 0;

while (!reader.EndOfStream)
while (await reader.ReadLineAsync() is { } line)
{
Assert.That(
await reader.ReadLineAsync(),
Is.EqualTo(value));
Assert.That(line, Is.EqualTo(value));

count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,9 @@ await file.GetLengthAsync(),

var count = 0;

while (!reader.EndOfStream)
while (await reader.ReadLineAsync() is { } line)
{
Assert.That(
await reader.ReadLineAsync(),
Is.EqualTo(value));
Assert.That(line, Is.EqualTo(value));

count++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public sealed class TempFileStorage : IDisposable
public TempFileStorage()
{
var path = Root;
var list = new[]
{
string[] files =
[
"project/docs/user_manual.pdf",
"project/docs/api_reference.md",
"project/docs/troubleshooting/common_issues.txt",
Expand Down Expand Up @@ -79,7 +79,9 @@ public TempFileStorage()
"project/README.md",
"project/global.json",
"project/nuget.config",
}
];

var list = files
.Select(p => Path.Combine(path, p))
.ToArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public async Task FileTree_MatchesStructure()

static async Task CompareDirectoriesAsync(VirtualDirectory virtualDir, DirectoryInfo localDir)
{
if (await virtualDir.ExistsAsync() != localDir.Exists)
Assert.Fail($"Directory '{virtualDir.FullName}'.Exists ({virtualDir.ExistsAsync().Result}) != '{localDir.FullName}'.Exists ({localDir.Exists})");
var exists = await virtualDir.ExistsAsync();
if (exists != localDir.Exists)
Assert.Fail($"Directory '{virtualDir.FullName}'.Exists ({exists}) != '{localDir.FullName}'.Exists ({localDir.Exists})");

var virtualFiles = await virtualDir.GetFilesAsync().OrderBy(f => f.Name).ToArrayAsync();
var localFiles = localDir.EnumerateFiles().OrderBy(f => f.Name).ToArray();
Expand Down
Loading