Skip to content

Commit 60bb72c

Browse files
committed
Adjust .editorconfig, use .NET 8 recommended styles. Code cleanup
1 parent 236d475 commit 60bb72c

14 files changed

+74
-56
lines changed

.editorconfig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ root = true
44

55
; For more visit http://editorconfig.org.
66

7-
; Choose between lf or rf on "end_of_line" property
8-
[*.proto]
9-
indent_style = tab
10-
indent_size = tab
11-
tab_width = 4
12-
137
[*.{asax,ascx,aspx,cs,cshtml,css,htm,html,js,jsx,master,razor,skin,ts,tsx,vb,xaml,xamlx,xoml}]
148
indent_style = space
159
indent_size = 4
@@ -74,3 +68,7 @@ dotnet_style_qualification_for_field = false:hint
7468
dotnet_style_qualification_for_method = false:hint
7569
dotnet_style_qualification_for_property = false:hint
7670
dotnet_style_require_accessibility_modifiers = for_non_interface_members:hint
71+
72+
[*.cs]
73+
dotnet_diagnostic.CA1715.severity = none # Identifiers should have correct prefix
74+
dotnet_diagnostic.CA1707.severity = none # Identifiers should not contain underscores

Build.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ function Exec
1313
{
1414
[CmdletBinding()]
1515
param(
16-
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
17-
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
16+
[Parameter(Position = 0, Mandatory = 1)][scriptblock]$cmd,
17+
[Parameter(Position = 1, Mandatory = 0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
1818
)
1919
& $cmd
20-
if ($lastexitcode -ne 0) {
20+
if ($lastexitcode -ne 0)
21+
{
2122
throw ("Exec: " + $errorMessage)
2223
}
2324
}
2425

2526
$artifacts = ".\artifacts"
2627

27-
if(Test-Path $artifacts) { Remove-Item $artifacts -Force -Recurse }
28+
if (Test-Path $artifacts)
29+
{
30+
Remove-Item $artifacts -Force -Recurse
31+
}
2832

2933
exec { & dotnet clean -c Release }
3034

Directory.Build.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
<Authors>Ivan Dugalić, Srđan Živojinović</Authors>
55
<Copyright>Copyright © 2024 Fraktalio. All rights reserved.</Copyright>
66
<Company>Fraktalio</Company>
7-
7+
88
<TargetFramework>net8.0</TargetFramework>
99
<ImplicitUsings>enable</ImplicitUsings>
1010
<Nullable>enable</Nullable>
1111
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
12-
12+
1313
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
1414
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
1515
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1616
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1717
<Features>strict</Features>
18-
<AnalysisLevel>latest</AnalysisLevel>
19-
<WarningLevel>9999</WarningLevel>
20-
18+
<AnalysisLevel>8.0</AnalysisLevel>
19+
<AnalysisMode>Recommended</AnalysisMode>
20+
2121
<PackageTags>domain-modeling;event-sourcing;eventsourcing;cqrs</PackageTags>
2222
<PackageIcon>gradient_128x128.png</PackageIcon>
2323
<PublishRepositoryUrl>true</PublishRepositoryUrl>

Directory.Packages.props

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
7-
<PackageVersion Include="FakeItEasy" Version="8.1.0" />
8-
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
9-
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
10-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11-
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
12-
<PackageVersion Include="MinVer" Version="5.0.0" />
13-
<PackageVersion Include="NUnit" Version="3.14.0" />
14-
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
15-
<PackageVersion Include="Verify.NUnit" Version="22.5.0" />
6+
<PackageVersion Include="coverlet.collector" Version="6.0.0"/>
7+
<PackageVersion Include="FakeItEasy" Version="8.1.0"/>
8+
<PackageVersion Include="FluentAssertions" Version="6.12.0"/>
9+
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0"/>
10+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
11+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
12+
<PackageVersion Include="MinVer" Version="5.0.0"/>
13+
<PackageVersion Include="NUnit" Version="3.14.0"/>
14+
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0"/>
15+
<PackageVersion Include="Verify.NUnit" Version="22.5.0"/>
1616
<PackageVersion Include="NUnit.Analyzers" Version="4.1.0">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Push.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
$scriptName = $MyInvocation.MyCommand.Name
22
$artifacts = "./artifacts"
33

4-
if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) {
4+
if ( [string]::IsNullOrEmpty($Env:NUGET_API_KEY))
5+
{
56
Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)."
6-
} else {
7+
}
8+
else
9+
{
710
Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object {
8-
Write-Host "$($scriptName): Pushing $($_.Name)"
11+
Write-Host "$( $scriptName ): Pushing $( $_.Name )"
912
dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY
10-
if ($lastexitcode -ne 0) {
13+
if ($lastexitcode -ne 0)
14+
{
1115
throw ("Exec: " + $errorMessage)
1216
}
1317
}

src/Fraktalio.FModel/Fraktalio.FModel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
15+
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/Fraktalio.FModel/InternalDecider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// <typeparam name="So">Output State type</typeparam>
1414
/// <typeparam name="Ei">Input Event type</typeparam>
1515
/// <typeparam name="Eo">Output Event type</typeparam>
16-
internal class InternalDecider<C, Si, So, Ei, Eo>
16+
internal sealed class InternalDecider<C, Si, So, Ei, Eo>
1717
{
1818
/// <summary>
1919
/// [InternalDecider] is a datatype that represents the main decision-making algorithm.

src/Fraktalio.FModel/InternalDeciderExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ internal static class InternalDeciderExtensions
2626
/// <typeparam name="Ei_SUPER">Super type of the Ei and Ei2 types</typeparam>
2727
/// <typeparam name="Eo_SUPER">super type of the Eo and Eo2 types</typeparam>
2828
/// <returns></returns>
29-
internal static InternalDecider<C_SUPER?, Tuple<Si, Si2>, Tuple<So, So2>, Ei_SUPER, Eo_SUPER?> Combine<C, Si, So, Ei,
29+
internal static InternalDecider<C_SUPER?, Tuple<Si, Si2>, Tuple<So, So2>, Ei_SUPER, Eo_SUPER?> Combine<C, Si, So,
30+
Ei,
3031
Eo, C2, Si2, So2, Ei2, Eo2, C_SUPER, Ei_SUPER, Eo_SUPER>(
3132
this InternalDecider<C?, Si, So, Ei?, Eo?> x,
3233
InternalDecider<C2?, Si2, So2, Ei2?, Eo2?> y)

src/Fraktalio.FModel/InternalView.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Fraktalio.FModel;
1616
/// <typeparam name="Si">Input State type</typeparam>
1717
/// <typeparam name="So">Output State type</typeparam>
1818
/// <typeparam name="E">Event type</typeparam>
19-
internal class InternalView<Si, So, E>(Func<Si, E, So> evolve, So initialState)
19+
internal sealed class InternalView<Si, So, E>(Func<Si, E, So> evolve, So initialState)
2020
{
2121
internal Func<Si, E, So> Evolve { get; } = evolve;
2222
internal So InitialState { get; } = initialState;
@@ -77,6 +77,4 @@ public InternalView<Si, Son, E> ApplyOnState<Son>(InternalView<Si, Func<So, Son>
7777

7878
internal InternalView<Si, Tuple<So, Son>, E> ProductOnState<Son>(InternalView<Si, Son, E> fb) =>
7979
ApplyOnState(fb.MapOnState(b => new Func<So, Tuple<So, Son>>(a => new Tuple<So, Son>(a, b))));
80-
81-
8280
}

src/Fraktalio.FModel/ViewBuilder.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
namespace Fraktalio.FModel;
22

3-
internal class ViewBuilder<S, E>
3+
internal sealed class ViewBuilder<S, E>
44
{
55
private Func<S, E, S> Evolve { get; set; } = (s, _) => s;
6-
private Func<S> InitialState { get; set; } = () => throw new Exception("Initial State is not initialized");
6+
7+
private Func<S> InitialState { get; set; } =
8+
() => throw new InvalidOperationException("Initial State is not initialized");
79

810
public void SetEvolve(Func<S, E, S> value) => Evolve = value;
911

0 commit comments

Comments
 (0)