Skip to content

Commit

Permalink
[BMSPT-174] refactoring, JsonExtension static regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
BalintBende committed May 8, 2024
1 parent 654a1a5 commit 0e34071
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions bcf-toolkit.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=69156f6d_002D4f0a_002D4f92_002Dae69_002Da7ef11a55cba/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=bbf717af_002D4d25_002D42ff_002Dba1f_002D7a2ecce2ee53/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution #5" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String>


<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=f23341d3_002De9f8_002D4cc8_002Db98f_002Dd4283d5ad0db/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from Solution #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
Expand Down
4 changes: 2 additions & 2 deletions src/bcf-toolkit/Builder/Bcf30/Interfaces/IBcfBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public interface IBcfBuilder<
/// <summary>
/// Returns the builder object set with the `ProjectInfo`.
/// </summary>
/// <param name="builder">Builder of the project.</param>
/// <param name="builder">Builder of the project info.</param>
/// <returns>Returns the builder object.</returns>
TBuilder SetProjectInfo(Action<TProjectBuilder> builder);

/// <summary>
/// Returns the builder object set with the `Extensions`.
/// </summary>
/// <param name="builder">Builder of the markup.</param>
/// <param name="builder">Builder of the extensions.</param>
/// <returns>Returns the builder object.</returns>
TBuilder SetExtensions(Action<TExtensionsBuilder> builder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace BcfToolkit.Builder.Bcf30.Interfaces;

public interface IProjectBuilder<out TBuilder> : IBuilder<ProjectInfo> {
public interface IProjectInfoBuilder<out TBuilder> : IBuilder<ProjectInfo> {
/// <summary>
/// Returns the builder object set with the `ProjectName`.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/bcf-toolkit/Builder/Bcf30/ProjectInfoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace BcfToolkit.Builder.Bcf30;

public class ProjectInfoBuilder :
IProjectBuilder<ProjectInfoBuilder>,
IProjectInfoBuilder<ProjectInfoBuilder>,
IDefaultBuilder<ProjectInfoBuilder> {
private readonly ProjectInfo _project = new();

Expand Down
10 changes: 6 additions & 4 deletions src/bcf-toolkit/Utils/JsonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace BcfToolkit.Utils;

/// <summary>
/// The `JsonConverter` static class opens and parses the BCF json files
/// The `JsonExtensions` static class opens and parses the BCF json files
/// and puts their contents into the BCF models. It also writes the in
/// memory BCF models into json files.
/// </summary>
Expand All @@ -40,12 +40,14 @@ public static Task<ConcurrentBag<TMarkup>> ParseMarkups<TMarkup>(
return Task.Run(async () => {
// A thread-safe storage for the parsed topics.
var markups = new ConcurrentBag<TMarkup>();

const string guidPattern = "^[a-fA-F0-9]+$";
var files = new List<string>(Directory.EnumerateFiles(sourceFolder));
var topicFiles = files
.Where(file =>
Regex.IsMatch(Path.GetFileNameWithoutExtension((string?)file).Replace("-", ""),
"^[a-fA-F0-9]+$"))
Regex.IsMatch(
Path.GetFileNameWithoutExtension(file)
.Replace("-", ""),
guidPattern))
.ToList();

foreach (var file in topicFiles) {
Expand Down

0 comments on commit 0e34071

Please sign in to comment.