Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Wikipedia scraping code to separate project #384

Merged
merged 3 commits into from Mar 28, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion Qowaiv.sln
Expand Up @@ -70,7 +70,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{7F291C
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.Benchmarks", "specs\Qowaiv.Benchmarks\Qowaiv.Benchmarks.csproj", "{6F2DEAC5-6E5D-4144-BA24-37039F387D67}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Qowaiv.Diagnostics.Contracts", "src\Qowaiv.Diagnostics.Contracts\Qowaiv.Diagnostics.Contracts.csproj", "{75090D12-3917-4CDD-8DDE-09B8407723A8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.Diagnostics.Contracts", "src\Qowaiv.Diagnostics.Contracts\Qowaiv.Diagnostics.Contracts.csproj", "{75090D12-3917-4CDD-8DDE-09B8407723A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Qowaiv.Wikipedia", "specs\Qowaiv.Wikipedia\Qowaiv.Wikipedia.csproj", "{472741F3-7CA5-49B0-90B2-5BFB82832D99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -114,6 +116,10 @@ Global
{75090D12-3917-4CDD-8DDE-09B8407723A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75090D12-3917-4CDD-8DDE-09B8407723A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75090D12-3917-4CDD-8DDE-09B8407723A8}.Release|Any CPU.Build.0 = Release|Any CPU
{472741F3-7CA5-49B0-90B2-5BFB82832D99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{472741F3-7CA5-49B0-90B2-5BFB82832D99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{472741F3-7CA5-49B0-90B2-5BFB82832D99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{472741F3-7CA5-49B0-90B2-5BFB82832D99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -130,6 +136,7 @@ Global
{9CCFB684-06FA-48B1-8732-0A520B639E11} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029}
{7F291C39-7785-41A7-8678-2E79B347E7AD} = {A4C3C9FF-4EED-41FE-8849-C896429254B5}
{6F2DEAC5-6E5D-4144-BA24-37039F387D67} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029}
{472741F3-7CA5-49B0-90B2-5BFB82832D99} = {40C1E942-8DB1-4E58-8FB4-71F5EDA66029}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9B55A336-E2D3-4656-9840-D519B3E1159B}
Expand Down
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\props\nopackage.props" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 13 additions & 1 deletion props/common.props
Expand Up @@ -23,7 +23,19 @@
Value Objects that can be used in a wide variety of modeling scenarios, both
inside and outside a Domain-driven context.
</Description>
<Authors>Ad van der Hoeven;Corniel Nobel;Erik Ammerlaan;Fons Sonnemans;Jack Kester;Hanif Hafez Nezami;Laura Kramer;Patrick Evers;Vincent Lesierse;Wilko Frieke</Authors>
<Authors>
Ad van der Hoeven;
Corniel Nobel;
Erik Ammerlaan;
Fons Sonnemans;
Jack Kester;
Hanif Hafez Nezami;
Laura Kramer;
Patrick Evers;
Renzo Baasdam;
Vincent Lesierse;
Wilko Frieke
</Authors>
<Owners>Qowaiv community</Owners>
<PackageTags>
DDD;
Expand Down
2 changes: 1 addition & 1 deletion specs/Qowaiv.Benchmarks/Qowaiv.Benchmarks.csproj
Expand Up @@ -28,8 +28,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Qowaiv.Diagnostics.Contracts\Qowaiv.Diagnostics.Contracts.csproj" />
<ProjectReference Include="..\..\src\Qowaiv\Qowaiv.csproj" />
<ProjectReference Include="..\..\src\Qowaiv.Diagnostics.Contracts\Qowaiv.Diagnostics.Contracts.csproj" />
<ProjectReference Include="..\..\src\Qowaiv.TestTools\Qowaiv.TestTools.csproj" />
</ItemGroup>

Expand Down
14 changes: 9 additions & 5 deletions specs/Qowaiv.Specs/OpenApi/Open_API_specs.cs
Expand Up @@ -60,11 +60,7 @@ public void Describes()
@enum = info.Enum?.ToArray(),
});
#if DEBUG
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(all, new System.Text.Json.JsonSerializerOptions
{
WriteIndented = true,
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
}));
Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(all, Options));
#endif
all.Should().NotBeEmpty();
}
Expand All @@ -79,5 +75,13 @@ private sealed record OpenApiDataTypeInfo
public bool nullable { get; init; }
public string[]? @enum { get; init; } = [];
}

#if DEBUG
private static readonly System.Text.Json.JsonSerializerOptions Options = new()
{
WriteIndented = true,
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
};
#endif
}
#endif
@@ -1,7 +1,4 @@
#if NET8_0_OR_GREATER
#if DEBUG

using Qowaiv.TestTools.Generation;
using Qowaiv.TestTools.Generation;
using Qowaiv.TestTools.Resx;
using Qowaiv.TestTools.Wikipedia;

Expand Down Expand Up @@ -255,6 +252,3 @@ public async Task zh()
.Should().NotThrow();
}
}

#endif
#endif
49 changes: 49 additions & 0 deletions specs/Qowaiv.Wikipedia/Properties/GlobalUsings.cs
@@ -0,0 +1,49 @@
global using FluentAssertions;
global using NUnit.Framework;
global using Qowaiv;
global using Qowaiv.Conversion.Security;
global using Qowaiv.Conversion.Security.Cryptography;
global using Qowaiv.Diagnostics.Contracts;
global using Qowaiv.Financial;
global using Qowaiv.Formatting;
global using Qowaiv.Globalization;
global using Qowaiv.Hashing;
global using Qowaiv.Identifiers;
global using Qowaiv.IO;
global using Qowaiv.Mathematics;
global using Qowaiv.OpenApi;
global using Qowaiv.Security;
global using Qowaiv.Security.Cryptography;
global using Qowaiv.Sql;
global using Qowaiv.Statistics;
global using Qowaiv.TestTools;
global using Qowaiv.TestTools.Globalization;
global using Qowaiv.TestTools.IO;
global using Qowaiv.Text;
global using Qowaiv.Web;
global using System;
global using System.Collections;
global using System.Collections.Generic;
global using System.ComponentModel;
global using System.Diagnostics;
global using System.Diagnostics.CodeAnalysis;
global using System.Diagnostics.Contracts;
global using System.Globalization;
global using System.IO;
global using System.Linq;
global using System.Reflection;
global using System.Runtime.Serialization;
global using System.Security.Cryptography;
global using System.Text;
global using System.Text.RegularExpressions;
global using System.Threading.Tasks;
global using System.Xml.Serialization;
global using CustomSvo = Qowaiv.Customization.Svo<Qowaiv.TestTools.ForCustomSvo>;
global using GenericSvo = Qowaiv.Customization.Svo<Qowaiv.TestTools.WithDefaultBehavior>;
global using CustomGuid = Qowaiv.Identifiers.Id<Qowaiv.TestTools.ForGuid>;
global using Int32Id = Qowaiv.Identifiers.Id<Qowaiv.TestTools.ForInt32>;
global using Int64Id = Qowaiv.Identifiers.Id<Qowaiv.TestTools.ForInt64>;
global using StringId = Qowaiv.Identifiers.Id<Qowaiv.TestTools.ForString>;
global using CustomUuid = Qowaiv.Identifiers.Id<Qowaiv.TestTools.ForUuid>;
global using Svo = Qowaiv.TestTools.Svo;

1 change: 1 addition & 0 deletions specs/Qowaiv.Wikipedia/Properties/PropertyInfo.cs
@@ -0,0 +1 @@
[assembly:ExcludeFromCodeCoverage(Justification = "This assembly just exists design-time and is not run during a build.")]
15 changes: 15 additions & 0 deletions specs/Qowaiv.Wikipedia/Qowaiv.Wikipedia.csproj
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="..\..\props\nopackage.props" />

<PropertyGroup>
<Nullable>enable</Nullable>
<TargetFramework>net8.0</TargetFramework>
<DefineConstants>CONTRACTS_FULL</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Qowaiv.Specs\Qowaiv.Specs.csproj" />
</ItemGroup>

</Project>
Expand Up @@ -87,12 +87,12 @@ private async Task Update()
throw new InvalidOperationException($"GET {Url} responded with {response.StatusCode}: {body}");
}
}
#endif

public bool HasExpired => !Cached.Exists || (Clock.UtcNow() - Cached.LastWriteTimeUtc) > Expiration;

private static readonly JsonSerializerOptions Options = new()
{
PropertyNameCaseInsensitive = true,
};
#endif

public bool HasExpired => !Cached.Exists || (Clock.UtcNow() - Cached.LastWriteTimeUtc) > Expiration;
}
3 changes: 0 additions & 3 deletions src/Qowaiv/Financial/IbanParser.cs
Expand Up @@ -27,8 +27,6 @@ internal static partial class IbanParser

if (++pos == 1) continue;

#pragma warning disable S2589 // Boolean expressions should not be gratuitous
// FP. See: https://github.com/SonarSource/sonar-dotnet/issues/8474
if (Parsers[id] is { } bban)
{
return bban.Parse(str, index, id);
Expand All @@ -41,7 +39,6 @@ internal static partial class IbanParser
prefixed = true;
}
else return null;
#pragma warning restore S2589 // Boolean expressions should not be gratuitous
}
else if (pos != 0)
{
Expand Down