Skip to content

Commit

Permalink
Simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
credfeto committed Dec 8, 2023
1 parent 1a7a893 commit 43a39cc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Credfeto.ChangeLog/ChangeLogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public static string ExtractReleaseNotes(string changeLog, string version)
{
Version? releaseVersion = BuildNumberHelpers.DetermineVersionForChangeLog(version);

IReadOnlyList<string> text = CommonRegex.RemoveComments.Replace(input: changeLog, replacement: string.Empty)
.Trim()
.SplitToLines();
IReadOnlyList<string> text = RemoveComments(changeLog);

FindSectionForBuild(text: text, version: releaseVersion, out int foundStart, out int foundEnd);

Expand Down Expand Up @@ -78,6 +76,13 @@ public static string ExtractReleaseNotes(string changeLog, string version)
.Trim();
}

private static IReadOnlyList<string> RemoveComments(string changeLog)
{
return CommonRegex.RemoveComments.Replace(input: changeLog, replacement: string.Empty)
.Trim()
.SplitToLines();
}

public static async Task<int?> FindFirstReleaseVersionPositionAsync(string changeLogFileName, CancellationToken cancellationToken)
{
IReadOnlyList<string> changelog = await File.ReadAllLinesAsync(path: changeLogFileName, encoding: Encoding.UTF8, cancellationToken: cancellationToken);
Expand Down

0 comments on commit 43a39cc

Please sign in to comment.