diff --git a/src/Cake.Issues.GitRepository.Tests/Cake.Issues.GitRepository.Tests.csproj b/src/Cake.Issues.GitRepository.Tests/Cake.Issues.GitRepository.Tests.csproj index 898ebf189..1789f1208 100644 --- a/src/Cake.Issues.GitRepository.Tests/Cake.Issues.GitRepository.Tests.csproj +++ b/src/Cake.Issues.GitRepository.Tests/Cake.Issues.GitRepository.Tests.csproj @@ -23,10 +23,10 @@ - 0.7.0 + 0.8.0-beta0001 - 0.7.0 + 0.8.0-beta0001 0.33.0 diff --git a/src/Cake.Issues.GitRepository/Cake.Issues.GitRepository.csproj b/src/Cake.Issues.GitRepository/Cake.Issues.GitRepository.csproj index 4acf060fa..43cc20f26 100644 --- a/src/Cake.Issues.GitRepository/Cake.Issues.GitRepository.csproj +++ b/src/Cake.Issues.GitRepository/Cake.Issues.GitRepository.csproj @@ -30,7 +30,7 @@ 0.33.0 - 0.7.0 + 0.8.0-beta0001 2.9.6 diff --git a/src/Cake.Issues.GitRepository/GitRepositoryIssuesProvider.cs b/src/Cake.Issues.GitRepository/GitRepositoryIssuesProvider.cs index 5d38b5f99..f113efe4f 100644 --- a/src/Cake.Issues.GitRepository/GitRepositoryIssuesProvider.cs +++ b/src/Cake.Issues.GitRepository/GitRepositoryIssuesProvider.cs @@ -74,18 +74,18 @@ public GitRepositoryIssuesProvider( protected GitRepositoryIssuesSettings IssueProviderSettings { get; private set; } /// - protected override IEnumerable InternalReadIssues(IssueCommentFormat format) + protected override IEnumerable InternalReadIssues() { var result = new List(); if (this.IssueProviderSettings.CheckBinaryFilesTrackedByLfs) { - result.AddRange(this.CheckForBinaryFilesNotTrackedByLfs(format)); + result.AddRange(this.CheckForBinaryFilesNotTrackedByLfs()); } if (this.IssueProviderSettings.CheckFilesPathLength) { - result.AddRange(this.CheckForFilesPathLength(format)); + result.AddRange(this.CheckForFilesPathLength()); } return result; @@ -94,9 +94,8 @@ protected override IEnumerable InternalReadIssues(IssueCommentFormat for /// /// Checks for binary files which are not tracked by LFS. /// - /// Preferred format of the messages. /// List of issues for binary files which are not tracked by LFS. - private IEnumerable CheckForBinaryFilesNotTrackedByLfs(IssueCommentFormat format) + private IEnumerable CheckForBinaryFilesNotTrackedByLfs() { if (!this.allFiles.Value.Any()) { @@ -115,25 +114,13 @@ private IEnumerable CheckForBinaryFilesNotTrackedByLfs(IssueCommentForma var result = new List(); foreach (var file in binaryFilesNotTrackedByLfs) { - string message = null; - switch (format) - { - case IssueCommentFormat.Markdown: - message = $"The binary file `{file}` is not tracked by Git LFS"; - break; - case IssueCommentFormat.Html: - message = $"The binary file
{file}
is not tracked by Git LFS"; - break; - default: - message = $"The binary file \"{file}\" is not tracked by Git LFS"; - break; - } - var ruleDescription = new BinaryFileNotTrackedByLfsRuleDescription(); result.Add( IssueBuilder - .NewIssue(message, this) + .NewIssue($"The binary file \"{file}\" is not tracked by Git LFS", this) + .WithMessageInHtmlFormat($"The binary file
{file}
is not tracked by Git LFS") + .WithMessageInMarkdownFormat($"The binary file `{file}` is not tracked by Git LFS") .InFile(file) .OfRule(ruleDescription) .Create()); @@ -145,9 +132,8 @@ private IEnumerable CheckForBinaryFilesNotTrackedByLfs(IssueCommentForma /// /// Checks for files path length. /// - /// Preferred format of the messages. /// List of issues for repository files with paths exceeding the allowed maximum. - private IEnumerable CheckForFilesPathLength(IssueCommentFormat format) + private IEnumerable CheckForFilesPathLength() { if (!this.allFiles.Value.Any()) { @@ -159,28 +145,13 @@ private IEnumerable CheckForFilesPathLength(IssueCommentFormat format) { if (file.Length > this.IssueProviderSettings.MaxFilePathLength) { - string message = null; - switch (format) - { - case IssueCommentFormat.Markdown: - message = - $"The path for the file `{file}` is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}."; - break; - case IssueCommentFormat.Html: - message = - $"The path for the file
{file}
is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}."; - break; - default: - message = - $"The path for the file \"{file}\" is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}."; - break; - } - var ruleDescription = new FilePathTooLongRuleDescription(); result.Add( IssueBuilder - .NewIssue(message, this) + .NewIssue($"The path for the file \"{file}\" is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}.", this) + .WithMessageInHtmlFormat($"The path for the file
{file}
is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}.") + .WithMessageInMarkdownFormat($"The path for the file `{file}` is too long. Maximum allowed path length is {this.IssueProviderSettings.MaxFilePathLength}, actual path length is {file.Length}.") .InFile(file) .OfRule(ruleDescription) .Create()); diff --git a/tests/integration/tests.cake b/tests/integration/tests.cake index 35f2df57e..a4036c4f3 100644 --- a/tests/integration/tests.cake +++ b/tests/integration/tests.cake @@ -1,6 +1,6 @@ -#addin nuget:?package=Cake.Issues -#addin nuget:?package=Cake.Issues.Reporting -#addin nuget:?package=Cake.Issues.Reporting.Generic +#addin nuget:?package=Cake.Issues&prerelease +#addin nuget:?package=Cake.Issues.Reporting&prerelease +#addin nuget:?package=Cake.Issues.Reporting.Generic&prerelease #reference "../../tools/Addins/Cake.Issues.GitRepository/lib/netstandard2.0/Cake.Issues.GitRepository.dll" ////////////////////////////////////////////////// @@ -38,10 +38,7 @@ Task("CheckBinaryFilesTrackedByLfs") { CheckBinaryFilesTrackedByLfs = true }), - new ReadIssuesSettings(repoRootDir) - { - Format = IssueCommentFormat.Html - }); + new ReadIssuesSettings(repoRootDir)); var reportDir = repoRootDir.Combine("BuildArtifacts").Combine("TestResults").Combine("Integration"); @@ -70,10 +67,7 @@ Task("CheckFilesPathLength") CheckFilesPathLength = true, MaxFilePathLength = 60 }), - new ReadIssuesSettings(repoRootDir) - { - Format = IssueCommentFormat.Html - }); + new ReadIssuesSettings(repoRootDir)); var reportDir = repoRootDir.Combine("BuildArtifacts").Combine("TestResults").Combine("Integration");