Skip to content

Commit

Permalink
Merge branch 'hotfix/7.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Sep 4, 2023
2 parents ea86450 + 538cf31 commit f6123b1
Show file tree
Hide file tree
Showing 6 changed files with 745 additions and 454 deletions.
399 changes: 8 additions & 391 deletions CHANGELOG.md

Large diffs are not rendered by default.

40 changes: 0 additions & 40 deletions source/Nuke.Common.Tests/ChangelogTasksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,6 @@ public class ChangelogTasksTest

private static AbsolutePath PathToChangelogReferenceFiles => RootDirectory / "source" / "Nuke.Common.Tests" / "ChangelogReferenceFiles";

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadReleaseNotes_ChangelogReferenceFile_ThrowsNoExceptions(AbsolutePath file)
{
Action act = () => ChangelogTasks.ReadReleaseNotes(file);

act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadReleaseNotes_ChangelogReferenceFile_ReturnsAnyReleaseNotes(AbsolutePath file)
{
var releaseNotes = ChangelogTasks.ReadReleaseNotes(file);

releaseNotes.Should().NotBeEmpty();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public void ReadChangelog_ChangelogReferenceFile_ThrowsNoExceptions(AbsolutePath file)
{
Action act = () => ChangelogTasks.ReadChangelog(file);

act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
Expand All @@ -62,16 +32,6 @@ public void ExtractChangelogSectionNotes_ChangelogReferenceFile_ThrowsNoExceptio
act.Should().NotThrow();
}

[Theory]
[MemberData(nameof(AllChangelogReference_1_0_0_Files))]
[MemberData(nameof(AllChangelogReference_NUKE_Files))]
public Task ReadReleaseNotes_ChangelogReferenceFile_HasParsedCorrectly(AbsolutePath file)
{
var releaseNotes = ChangelogTasks.ReadReleaseNotes(file);

return Verifier.Verify(releaseNotes).UseDirectory(PathToChangelogReferenceFiles).UseFileName(file.NameWithoutExtension);
}

[Fact]
public void GetReleaseSections_ChangelogReferenceFileWithoutReleaseHead_ReturnsEmpty()
{
Expand Down
8 changes: 7 additions & 1 deletion source/Nuke.Common/ChangeLog/ChangeLogTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ internal static IEnumerable<ReleaseSection> GetReleaseSections(List<string> cont
static bool IsReleaseHead(string str)
=> str.StartsWith("## ");

static bool IsReleaseContent(string str)
=> str.StartsWith("###")
|| str.Trim().StartsWith("-")
|| str.Trim().StartsWith("*")
|| str.Trim().StartsWith("+");

static string GetCaption(string str)
=> str
.TrimStart('#', ' ', '[')
Expand All @@ -199,7 +205,7 @@ static string GetCaption(string str)
}

var caption = GetCaption(line);
var nextReleaseHeadIndex = content.FindIndex(index + 1, IsReleaseHead);
var nextReleaseHeadIndex = content.FindIndex(index + 1, x => IsReleaseHead(x) || !IsReleaseContent(x));

var releaseData =
new ReleaseSection
Expand Down
Loading

0 comments on commit f6123b1

Please sign in to comment.