Skip to content

Commit

Permalink
Merge pull request #105 from amantinband/exceptions-for-invalid-use
Browse files Browse the repository at this point in the history
Draft: Migrate from Errors to Exceptions for invalid use of library
  • Loading branch information
amantinband authored May 12, 2024
2 parents dcf6122 + fcc4099 commit 1294ebb
Show file tree
Hide file tree
Showing 45 changed files with 747 additions and 632 deletions.
138 changes: 72 additions & 66 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,66 +1,72 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# SA1615: Element return value should be documented.
dotnet_diagnostic.SA1615.severity = none

# SA1611: Element parameters must be documented.
dotnet_diagnostic.SA1611.severity = none

# SA1633: File must have header.
dotnet_diagnostic.SA1633.severity = none

# SA1633: Generic type parameters must be documented.
dotnet_diagnostic.SA1618.severity = none

# SA1133: Each attribute should be placed in its own set of square brackets.
dotnet_diagnostic.SA1133.severity = none

# SA1600: Elements must be documented.
dotnet_diagnostic.SA1600.severity = none

# SA1601: Partial elementes should be documented.
dotnet_diagnostic.SA1601.severity = none

# SA1313: Parameter names must begin with lower case letter.
dotnet_diagnostic.SA1313.severity = none

# SA1009: Closing parenthesis should be followed by a space.
dotnet_diagnostic.SA1009.severity = none

# SA1000: The keyword 'new' should be followed by a space.
dotnet_diagnostic.SA1000.severity = none

# SA1101: Prefix local calls with this.
dotnet_diagnostic.SA1101.severity = none

# SA1309: Field should not begin with an underscore.
dotnet_diagnostic.SA1309.severity = none

# SA1602: Enumeration items should be documented.
dotnet_diagnostic.SA1602.severity = none

# CS1591: Missing XML comment for publicly visible type or member.
dotnet_diagnostic.CS1591.severity = none

# SA1200: Using directive should appear within a namespace declaration.
dotnet_diagnostic.SA1200.severity = none

# IDE0008: Use explicit type
csharp_style_var_when_type_is_apparent = true

# IDE0130: Namespace does not match folder structure
dotnet_style_namespace_match_folder = false

# IDE0023: Use block body for operators
csharp_style_expression_bodied_operators = when_on_single_line

# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = none
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

# SA1615: Element return value should be documented.
dotnet_diagnostic.SA1615.severity = none

# SA1611: Element parameters must be documented.
dotnet_diagnostic.SA1611.severity = none

# SA1633: File must have header.
dotnet_diagnostic.SA1633.severity = none

# SA1633: Generic type parameters must be documented.
dotnet_diagnostic.SA1618.severity = none

# SA1133: Each attribute should be placed in its own set of square brackets.
dotnet_diagnostic.SA1133.severity = none

# SA1600: Elements must be documented.
dotnet_diagnostic.SA1600.severity = none

# SA1601: Partial elementes should be documented.
dotnet_diagnostic.SA1601.severity = none

# SA1313: Parameter names must begin with lower case letter.
dotnet_diagnostic.SA1313.severity = none

# SA1009: Closing parenthesis should be followed by a space.
dotnet_diagnostic.SA1009.severity = none

# SA1000: The keyword 'new' should be followed by a space.
dotnet_diagnostic.SA1000.severity = none

# SA1101: Prefix local calls with this.
dotnet_diagnostic.SA1101.severity = none

# SA1309: Field should not begin with an underscore.
dotnet_diagnostic.SA1309.severity = none

# SA1602: Enumeration items should be documented.
dotnet_diagnostic.SA1602.severity = none

# CS1591: Missing XML comment for publicly visible type or member.
dotnet_diagnostic.CS1591.severity = none

# SA1200: Using directive should appear within a namespace declaration.
dotnet_diagnostic.SA1200.severity = none

# IDE0008: Use explicit type
csharp_style_var_when_type_is_apparent = true

# IDE0130: Namespace does not match folder structure
dotnet_style_namespace_match_folder = false

# IDE0023: Use block body for operators
csharp_style_expression_bodied_operators = when_on_single_line

# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = none

# SA1642: Constructor summary documentation should begin with standard text
dotnet_diagnostic.SA1642.severity = none

# SA1516: Elements should be separated by blank line
dotnet_diagnostic.SA1516.severity = none
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project>

<PropertyGroup>
<LangVersion>10.0</LangVersion>
<LangVersion>12.0</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
28 changes: 0 additions & 28 deletions src/ErrorOr.ToErrorOrExtensions.cs

This file was deleted.

78 changes: 0 additions & 78 deletions src/ErrorOr.cs

This file was deleted.

3 changes: 3 additions & 0 deletions src/ErrorOr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -24,6 +26,7 @@
<ItemGroup>
<None Include="../assets/icon-square.png" Pack="true" Visible="false" PackagePath="" />
<None Include="../README.md" Pack="true" PackagePath="" />
<None Include="bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml" Pack="true" PackagePath="lib\$(TargetFramework)\" />
<None Include="Stylecop.json" />
<AdditionalFiles Include="Stylecop.json" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/ErrorOr/EmptyErrors.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace ErrorOr;

internal static class EmptyErrors
{
public static List<Error> Instance { get; } = [];
}
3 changes: 0 additions & 3 deletions src/ErrorOr.Else.cs → src/ErrorOr/ErrorOr.Else.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
namespace ErrorOr;

/// <summary>
/// A discriminated union of errors or a value.
/// </summary>
public readonly partial record struct ErrorOr<TValue> : IErrorOr<TValue>
{
/// <summary>
Expand Down
File renamed without changes.
Loading

0 comments on commit 1294ebb

Please sign in to comment.