From 0adc70feb96a1a37961023819e674811c9fd8b6f Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 31 May 2018 21:27:49 +0200 Subject: [PATCH 1/8] (GH-15) Update to Cake.Issues 0.3.0 --- .../Cake.Issues.Markdownlint.Tests.csproj | 8 ++++---- .../Markdownlint/MarkdownlintIssuesProviderTests.cs | 8 ++++++++ .../MarkdownlintCliIssuesProviderTests.cs | 13 +++++++++++++ src/Cake.Issues.Markdownlint.Tests/packages.config | 4 ++-- .../Cake.Issues.Markdownlint.csproj | 4 ++-- .../Markdownlint/MarkdownlintIssuesProvider.cs | 5 +++++ .../MarkdownlintCliIssuesProvider.cs | 5 +++++ src/Cake.Issues.Markdownlint/packages.config | 2 +- 8 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index 831e6f4..278ade8 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -40,11 +40,11 @@ ..\packages\Cake.Core.0.26.0\lib\net46\Cake.Core.dll - - ..\packages\Cake.Issues.0.2.0\lib\netstandard2.0\Cake.Issues.dll + + ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll - - ..\packages\Cake.Issues.Testing.0.2.0\lib\netstandard2.0\Cake.Issues.Testing.dll + + ..\packages\Cake.Issues.Testing.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.Testing.dll ..\packages\Cake.Testing.0.26.0\lib\net46\Cake.Testing.dll diff --git a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs index 080a365..cfeb9a0 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs @@ -58,6 +58,7 @@ public void Should_Read_Issue_Correct() "MD010", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md010", 0, + "Warning", "Hard tabs"); CheckIssue( issues[1], @@ -66,6 +67,7 @@ public void Should_Read_Issue_Correct() "MD018", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018", 0, + "Warning", "No space after hash on atx style header"); CheckIssue( issues[2], @@ -74,6 +76,7 @@ public void Should_Read_Issue_Correct() "MD018", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018", 0, + "Warning", "No space after hash on atx style header"); } @@ -84,8 +87,12 @@ private static void CheckIssue( string rule, string ruleUrl, int priority, + string priorityName, string message) { + issue.ProviderType.ShouldBe("Cake.Issues.Markdownlint.Markdownlint.MarkdownlintIssuesProvider"); + issue.ProviderName.ShouldBe("markdownlint"); + if (issue.AffectedFileRelativePath == null) { affectedFileRelativePath.ShouldBeNull(); @@ -109,6 +116,7 @@ private static void CheckIssue( } issue.Priority.ShouldBe(priority); + issue.PriorityName.ShouldBe(priorityName); issue.Message.ShouldBe(message); } } diff --git a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs index f2f37e6..1555852 100644 --- a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs @@ -58,6 +58,7 @@ public void Should_Read_Issue_Correct() "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", 0, + "Warning", "Headers should be surrounded by blank lines [Context: \"# foo\"]"); CheckIssue( issues[1], @@ -66,6 +67,7 @@ public void Should_Read_Issue_Correct() "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", 0, + "Warning", "Trailing spaces [Expected: 2; Actual: 1]"); CheckIssue( issues[2], @@ -74,6 +76,7 @@ public void Should_Read_Issue_Correct() "MD013", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013", 0, + "Warning", "Line length [Expected: 100; Actual: 811]"); CheckIssue( issues[3], @@ -82,6 +85,7 @@ public void Should_Read_Issue_Correct() "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", 0, + "Warning", "Headers should be surrounded by blank lines [Context: \"# bar\"]"); CheckIssue( issues[4], @@ -90,6 +94,7 @@ public void Should_Read_Issue_Correct() "MD025", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025", 0, + "Warning", "Multiple top level headers in the same document [Context: \"# bar\"]"); CheckIssue( issues[5], @@ -98,6 +103,7 @@ public void Should_Read_Issue_Correct() "MD031", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031", 0, + "Warning", "Fenced code blocks should be surrounded by blank lines [Context: \"```\"]"); CheckIssue( issues[6], @@ -106,6 +112,7 @@ public void Should_Read_Issue_Correct() "MD040", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040", 0, + "Warning", "Fenced code blocks should have a language specified [Context: \"```\"]"); CheckIssue( issues[7], @@ -114,6 +121,7 @@ public void Should_Read_Issue_Correct() "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", 0, + "Warning", "Trailing spaces [Expected: 2; Actual: 1]"); } @@ -124,8 +132,12 @@ private static void CheckIssue( string rule, string ruleUrl, int priority, + string priorityName, string message) { + issue.ProviderType.ShouldBe("Cake.Issues.Markdownlint.MarkdownlintCli.MarkdownlintCliIssuesProvider"); + issue.ProviderName.ShouldBe("markdownlint"); + if (issue.AffectedFileRelativePath == null) { affectedFileRelativePath.ShouldBeNull(); @@ -149,6 +161,7 @@ private static void CheckIssue( } issue.Priority.ShouldBe(priority); + issue.PriorityName.ShouldBe(priorityName); issue.Message.ShouldBe(message); } } diff --git a/src/Cake.Issues.Markdownlint.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config index 4bcb8fe..9875f6c 100644 --- a/src/Cake.Issues.Markdownlint.Tests/packages.config +++ b/src/Cake.Issues.Markdownlint.Tests/packages.config @@ -1,8 +1,8 @@  - - + + diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj index 36615f8..7e0b155 100644 --- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj +++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj @@ -44,8 +44,8 @@ ..\packages\Cake.Core.0.26.0\lib\net46\Cake.Core.dll - - ..\packages\Cake.Issues.0.2.0\lib\netstandard2.0\Cake.Issues.dll + + ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll diff --git a/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs b/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs index 1ea3d2b..70ed1a6 100644 --- a/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs +++ b/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs @@ -26,6 +26,9 @@ public MarkdownlintIssuesProvider(ICakeLog log, MarkdownlintIssuesSettings setti this.settings = settings; } + /// + public override string ProviderName => "markdownlint"; + /// protected override IEnumerable InternalReadIssues(IssueCommentFormat format) { @@ -39,10 +42,12 @@ from entry in file.Value rule = (string)entry.SelectToken("ruleName") select new Issue( + this, file.Key, (int)entry.SelectToken("lineNumber"), (string)entry.SelectToken("ruleDescription"), 0, + "Warning", rule, MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); } diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs index 5d482f4..c817784 100644 --- a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs +++ b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs @@ -27,6 +27,9 @@ public MarkdownlintCliIssuesProvider(ICakeLog log, MarkdownlintCliIssuesSettings this.settings = settings; } + /// + public override string ProviderName => "markdownlint"; + /// protected override IEnumerable InternalReadIssues(IssueCommentFormat format) { @@ -48,10 +51,12 @@ protected override IEnumerable InternalReadIssues(IssueCommentFormat for yield return new Issue( + this, fileName, lineNumber, ruleDescription, 0, + "Warning", rule, MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); } diff --git a/src/Cake.Issues.Markdownlint/packages.config b/src/Cake.Issues.Markdownlint/packages.config index 4bc732a..e44d6ce 100644 --- a/src/Cake.Issues.Markdownlint/packages.config +++ b/src/Cake.Issues.Markdownlint/packages.config @@ -1,7 +1,7 @@  - + From 6794f3f54266b3ee49e618c014d8a0df8b0ae5a9 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 31 May 2018 21:41:58 +0200 Subject: [PATCH 2/8] Update release notes link --- nuspec/nuget/Cake.Issues.Markdownlint.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.Issues.Markdownlint.nuspec b/nuspec/nuget/Cake.Issues.Markdownlint.nuspec index e36dd1b..e7de09a 100644 --- a/nuspec/nuget/Cake.Issues.Markdownlint.nuspec +++ b/nuspec/nuget/Cake.Issues.Markdownlint.nuspec @@ -23,7 +23,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin false Copyright © BBT Software AG and contributors Cake Script Cake-Issues Cake-IssueProvider Linting Markdownlint - https://github.com/cake-contrib/Cake.Issues.Markdownlint/releases/tag/0.2.0 + https://github.com/cake-contrib/Cake.Issues.Markdownlint/releases/tag/0.3.0 From 6b4521207c25cb4f7d7343bec855081b983f681a Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 31 May 2018 21:43:02 +0200 Subject: [PATCH 3/8] Update XUnit analyzers to 0.9.0 --- .../Cake.Issues.Markdownlint.Tests.csproj | 2 +- src/Cake.Issues.Markdownlint.Tests/packages.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index 278ade8..e166b2a 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -102,7 +102,7 @@ - + diff --git a/src/Cake.Issues.Markdownlint.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config index 9875f6c..24261b2 100644 --- a/src/Cake.Issues.Markdownlint.Tests/packages.config +++ b/src/Cake.Issues.Markdownlint.Tests/packages.config @@ -8,7 +8,7 @@ - + From cb56517df50fe9fbdef199de672b98be07b1e849 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 31 May 2018 21:43:26 +0200 Subject: [PATCH 4/8] Update JSON.NET to 11.0.2 --- src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj | 4 ++-- src/Cake.Issues.Markdownlint/packages.config | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj index 7e0b155..662d27b 100644 --- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj +++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj @@ -51,8 +51,8 @@ ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll False - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/src/Cake.Issues.Markdownlint/packages.config b/src/Cake.Issues.Markdownlint/packages.config index e44d6ce..7096134 100644 --- a/src/Cake.Issues.Markdownlint/packages.config +++ b/src/Cake.Issues.Markdownlint/packages.config @@ -8,7 +8,7 @@ - + \ No newline at end of file From 08675384f363db6b0987b4a524100c58f545213d Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 31 May 2018 22:30:29 +0200 Subject: [PATCH 5/8] (GH-17) Add compatibility with markdownlint-cli 0.9.0 --- .../Cake.Issues.Markdownlint.Tests.csproj | 3 +- .../MarkdownlintCliIssuesProviderTests.cs | 89 ++++++++++++++++++- .../MarkdownlintCliIssuesSettingsTests.cs | 2 +- ...int-cli.log => markdownlint-cli-0-8-1.log} | 0 .../Testfiles/markdownlint-cli-0.10.0.log | 8 ++ .../MarkdownlintCliIssuesProvider.cs | 2 +- 6 files changed, 99 insertions(+), 5 deletions(-) rename src/Cake.Issues.Markdownlint.Tests/Testfiles/{markdownlint-cli.log => markdownlint-cli-0-8-1.log} (100%) create mode 100644 src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0.10.0.log diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index e166b2a..17620e2 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -97,7 +97,8 @@ - + + diff --git a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs index 1555852..0cb9f5e 100644 --- a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs @@ -41,10 +41,10 @@ public void Should_Throw_If_Settings_Are_Null() public sealed class TheReadIssuesMethod { [Fact] - public void Should_Read_Issue_Correct() + public void Should_Read_Issue_Correct_0_8_1() { // Given - var fixture = new MarkdownlintCliIssuesProviderFixture("markdownlint-cli.log"); + var fixture = new MarkdownlintCliIssuesProviderFixture("markdownlint-cli-0-8-1.log"); // When var issues = fixture.ReadIssues().ToList(); @@ -125,6 +125,91 @@ public void Should_Read_Issue_Correct() "Trailing spaces [Expected: 2; Actual: 1]"); } + [Fact] + public void Should_Read_Issue_Correct_0_10_0() + { + // Given + var fixture = new MarkdownlintCliIssuesProviderFixture("markdownlint-cli-0.10.0.log"); + + // When + var issues = fixture.ReadIssues().ToList(); + + // Then + issues.Count.ShouldBe(8); + CheckIssue( + issues[0], + @"docs/index.md", + 1, + "MD022", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", + 0, + "Warning", + "Headings should be surrounded by blank lines [Context: \"# foo\"]"); + CheckIssue( + issues[1], + @"docs/index.md", + 2, + "MD009", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", + 0, + "Warning", + "Trailing spaces [Expected: 0 or 2; Actual: 1]"); + CheckIssue( + issues[2], + @"docs/index.md", + 2, + "MD013", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013", + 0, + "Warning", + "Line length [Expected: 100; Actual: 811]"); + CheckIssue( + issues[3], + @"docs/index.md", + 4, + "MD022", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", + 0, + "Warning", + "Headings should be surrounded by blank lines [Context: \"# bar\"]"); + CheckIssue( + issues[4], + @"docs/index.md", + 4, + "MD025", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025", + 0, + "Warning", + "Multiple top level headings in the same document [Context: \"# bar\"]"); + CheckIssue( + issues[5], + @"docs/index.md", + 5, + "MD031", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031", + 0, + "Warning", + "Fenced code blocks should be surrounded by blank lines [Context: \"```\"]"); + CheckIssue( + issues[6], + @"docs/index.md", + 5, + "MD040", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040", + 0, + "Warning", + "Fenced code blocks should have a language specified [Context: \"```\"]"); + CheckIssue( + issues[7], + @"docs/index.md", + 6, + "MD009", + "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", + 0, + "Warning", + "Trailing spaces [Expected: 0 or 2; Actual: 1]"); + } + private static void CheckIssue( IIssue issue, string affectedFileRelativePath, diff --git a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesSettingsTests.cs b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesSettingsTests.cs index 0eea153..84a6de1 100644 --- a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesSettingsTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesSettingsTests.cs @@ -79,7 +79,7 @@ public void Should_Read_File_From_Disk() // Given string expected; using (var ms = new MemoryStream()) - using (var stream = this.GetType().Assembly.GetManifestResourceStream("Cake.Issues.Markdownlint.Tests.Testfiles.markdownlint-cli.log")) + using (var stream = this.GetType().Assembly.GetManifestResourceStream("Cake.Issues.Markdownlint.Tests.Testfiles.markdownlint-cli-0-8-1.log")) { stream.CopyTo(ms); var data = ms.ToArray(); diff --git a/src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli.log b/src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0-8-1.log similarity index 100% rename from src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli.log rename to src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0-8-1.log diff --git a/src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0.10.0.log b/src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0.10.0.log new file mode 100644 index 0000000..8404a84 --- /dev/null +++ b/src/Cake.Issues.Markdownlint.Tests/Testfiles/markdownlint-cli-0.10.0.log @@ -0,0 +1,8 @@ +C:/Git/Test/Cake.Prca/docs/index.md: 1: MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Context: "# foo"] +C:/Git/Test/Cake.Prca/docs/index.md: 2: MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] +C:/Git/Test/Cake.Prca/docs/index.md: 2: MD013/line-length Line length [Expected: 100; Actual: 811] +C:/Git/Test/Cake.Prca/docs/index.md: 4: MD022/blanks-around-headings/blanks-around-headers Headings should be surrounded by blank lines [Context: "# bar"] +C:/Git/Test/Cake.Prca/docs/index.md: 4: MD025/single-h1 Multiple top level headings in the same document [Context: "# bar"] +C:/Git/Test/Cake.Prca/docs/index.md: 5: MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```"] +C:/Git/Test/Cake.Prca/docs/index.md: 5: MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] +C:/Git/Test/Cake.Prca/docs/index.md: 6: MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] \ No newline at end of file diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs index c817784..17380c9 100644 --- a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs +++ b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs @@ -33,7 +33,7 @@ public MarkdownlintCliIssuesProvider(ICakeLog log, MarkdownlintCliIssuesSettings /// protected override IEnumerable InternalReadIssues(IssueCommentFormat format) { - var regex = new Regex(@"(.*): (\d*): (MD\d*)/((?:\w*-*)*) (.*)"); + var regex = new Regex(@"(.*): (\d*): (MD\d*)/((?:\w*-*/*)*) (.*)"); foreach (var line in this.settings.LogFileContent.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None).ToList().Where(s => !string.IsNullOrEmpty(s))) { From faf7491dd0ba123f9e49d4b8e1069903a5fe72bc Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Fri, 1 Jun 2018 22:13:16 +0200 Subject: [PATCH 6/8] (GH-18) Build against Cake 0.28.0 --- .../Cake.Issues.Markdownlint.Tests.csproj | 8 ++++---- src/Cake.Issues.Markdownlint.Tests/packages.config | 4 ++-- .../Cake.Issues.Markdownlint.csproj | 4 ++-- src/Cake.Issues.Markdownlint/packages.config | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index 17620e2..1b8a7da 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -37,8 +37,8 @@ ..\Cake.Issues.Markdownlint.Tests.ruleset - - ..\packages\Cake.Core.0.26.0\lib\net46\Cake.Core.dll + + ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll @@ -46,8 +46,8 @@ ..\packages\Cake.Issues.Testing.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.Testing.dll - - ..\packages\Cake.Testing.0.26.0\lib\net46\Cake.Testing.dll + + ..\packages\Cake.Testing.0.28.0\lib\net46\Cake.Testing.dll ..\packages\Shouldly.3.0.0\lib\net451\Shouldly.dll diff --git a/src/Cake.Issues.Markdownlint.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config index 24261b2..e0e3585 100644 --- a/src/Cake.Issues.Markdownlint.Tests/packages.config +++ b/src/Cake.Issues.Markdownlint.Tests/packages.config @@ -1,9 +1,9 @@  - + - + diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj index 662d27b..4b9f996 100644 --- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj +++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj @@ -41,8 +41,8 @@ ..\Cake.Issues.Markdownlint.ruleset - - ..\packages\Cake.Core.0.26.0\lib\net46\Cake.Core.dll + + ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll diff --git a/src/Cake.Issues.Markdownlint/packages.config b/src/Cake.Issues.Markdownlint/packages.config index 7096134..6580b16 100644 --- a/src/Cake.Issues.Markdownlint/packages.config +++ b/src/Cake.Issues.Markdownlint/packages.config @@ -1,6 +1,6 @@  - + From 7c5df8a2024ba53265e27853a84e8a7c627475a4 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Fri, 1 Jun 2018 22:20:42 +0200 Subject: [PATCH 7/8] Update to Cake.Issues 0.3.0-beta.2 --- .../Cake.Issues.Markdownlint.Tests.csproj | 4 +-- .../MarkdownlintIssuesProviderTests.cs | 6 ++-- .../MarkdownlintCliIssuesProviderTests.cs | 32 +++++++++---------- .../packages.config | 4 +-- .../Cake.Issues.Markdownlint.csproj | 2 +- .../MarkdownlintIssuesProvider.cs | 15 ++++----- .../MarkdownlintCliIssuesProvider.cs | 15 ++++----- .../MarkdownlintIssuesAliases.Markdownlint.cs | 2 +- ...rkdownlintIssuesAliases.MarkdownlintCli.cs | 2 +- src/Cake.Issues.Markdownlint/packages.config | 2 +- 10 files changed, 39 insertions(+), 45 deletions(-) diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index 1b8a7da..7596bfd 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -41,10 +41,10 @@ ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll - ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll + ..\packages\Cake.Issues.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.dll - ..\packages\Cake.Issues.Testing.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.Testing.dll + ..\packages\Cake.Issues.Testing.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.Testing.dll ..\packages\Cake.Testing.0.28.0\lib\net46\Cake.Testing.dll diff --git a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs index cfeb9a0..9d8a987 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs @@ -57,7 +57,7 @@ public void Should_Read_Issue_Correct() 3, "MD010", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md010", - 0, + 300, "Warning", "Hard tabs"); CheckIssue( @@ -66,7 +66,7 @@ public void Should_Read_Issue_Correct() 1, "MD018", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018", - 0, + 300, "Warning", "No space after hash on atx style header"); CheckIssue( @@ -75,7 +75,7 @@ public void Should_Read_Issue_Correct() 3, "MD018", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md018", - 0, + 300, "Warning", "No space after hash on atx style header"); } diff --git a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs index 0cb9f5e..61d837a 100644 --- a/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs +++ b/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/MarkdownlintCliIssuesProviderTests.cs @@ -57,7 +57,7 @@ public void Should_Read_Issue_Correct_0_8_1() 1, "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", - 0, + 300, "Warning", "Headers should be surrounded by blank lines [Context: \"# foo\"]"); CheckIssue( @@ -66,7 +66,7 @@ public void Should_Read_Issue_Correct_0_8_1() 2, "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", - 0, + 300, "Warning", "Trailing spaces [Expected: 2; Actual: 1]"); CheckIssue( @@ -75,7 +75,7 @@ public void Should_Read_Issue_Correct_0_8_1() 2, "MD013", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013", - 0, + 300, "Warning", "Line length [Expected: 100; Actual: 811]"); CheckIssue( @@ -84,7 +84,7 @@ public void Should_Read_Issue_Correct_0_8_1() 4, "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", - 0, + 300, "Warning", "Headers should be surrounded by blank lines [Context: \"# bar\"]"); CheckIssue( @@ -93,7 +93,7 @@ public void Should_Read_Issue_Correct_0_8_1() 4, "MD025", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025", - 0, + 300, "Warning", "Multiple top level headers in the same document [Context: \"# bar\"]"); CheckIssue( @@ -102,7 +102,7 @@ public void Should_Read_Issue_Correct_0_8_1() 5, "MD031", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031", - 0, + 300, "Warning", "Fenced code blocks should be surrounded by blank lines [Context: \"```\"]"); CheckIssue( @@ -111,7 +111,7 @@ public void Should_Read_Issue_Correct_0_8_1() 5, "MD040", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040", - 0, + 300, "Warning", "Fenced code blocks should have a language specified [Context: \"```\"]"); CheckIssue( @@ -120,7 +120,7 @@ public void Should_Read_Issue_Correct_0_8_1() 6, "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", - 0, + 300, "Warning", "Trailing spaces [Expected: 2; Actual: 1]"); } @@ -142,7 +142,7 @@ public void Should_Read_Issue_Correct_0_10_0() 1, "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", - 0, + 300, "Warning", "Headings should be surrounded by blank lines [Context: \"# foo\"]"); CheckIssue( @@ -151,7 +151,7 @@ public void Should_Read_Issue_Correct_0_10_0() 2, "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", - 0, + 300, "Warning", "Trailing spaces [Expected: 0 or 2; Actual: 1]"); CheckIssue( @@ -160,7 +160,7 @@ public void Should_Read_Issue_Correct_0_10_0() 2, "MD013", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013", - 0, + 300, "Warning", "Line length [Expected: 100; Actual: 811]"); CheckIssue( @@ -169,7 +169,7 @@ public void Should_Read_Issue_Correct_0_10_0() 4, "MD022", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md022", - 0, + 300, "Warning", "Headings should be surrounded by blank lines [Context: \"# bar\"]"); CheckIssue( @@ -178,7 +178,7 @@ public void Should_Read_Issue_Correct_0_10_0() 4, "MD025", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md025", - 0, + 300, "Warning", "Multiple top level headings in the same document [Context: \"# bar\"]"); CheckIssue( @@ -187,7 +187,7 @@ public void Should_Read_Issue_Correct_0_10_0() 5, "MD031", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md031", - 0, + 300, "Warning", "Fenced code blocks should be surrounded by blank lines [Context: \"```\"]"); CheckIssue( @@ -196,7 +196,7 @@ public void Should_Read_Issue_Correct_0_10_0() 5, "MD040", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md040", - 0, + 300, "Warning", "Fenced code blocks should have a language specified [Context: \"```\"]"); CheckIssue( @@ -205,7 +205,7 @@ public void Should_Read_Issue_Correct_0_10_0() 6, "MD009", "https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009", - 0, + 300, "Warning", "Trailing spaces [Expected: 0 or 2; Actual: 1]"); } diff --git a/src/Cake.Issues.Markdownlint.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config index e0e3585..9463e49 100644 --- a/src/Cake.Issues.Markdownlint.Tests/packages.config +++ b/src/Cake.Issues.Markdownlint.Tests/packages.config @@ -1,8 +1,8 @@  - - + + diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj index 4b9f996..ce79666 100644 --- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj +++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj @@ -45,7 +45,7 @@ ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll - ..\packages\Cake.Issues.0.3.0-beta0001\lib\netstandard2.0\Cake.Issues.dll + ..\packages\Cake.Issues.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.dll ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll diff --git a/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs b/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs index 70ed1a6..3303fcd 100644 --- a/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs +++ b/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs @@ -41,15 +41,12 @@ from entry in file.Value let rule = (string)entry.SelectToken("ruleName") select - new Issue( - this, - file.Key, - (int)entry.SelectToken("lineNumber"), - (string)entry.SelectToken("ruleDescription"), - 0, - "Warning", - rule, - MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); + IssueBuilder + .NewIssue((string)entry.SelectToken("ruleDescription"), this) + .InFile(file.Key, (int)entry.SelectToken("lineNumber")) + .WithPriority(IssuePriority.Warning) + .OfRule(rule, MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)) + .Create(); } } } diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs index 17380c9..7573c5b 100644 --- a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs +++ b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs @@ -50,15 +50,12 @@ protected override IEnumerable InternalReadIssues(IssueCommentFormat for var ruleDescription = groups[5].Value; yield return - new Issue( - this, - fileName, - lineNumber, - ruleDescription, - 0, - "Warning", - rule, - MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); + IssueBuilder + .NewIssue(ruleDescription, this) + .InFile(fileName, lineNumber) + .WithPriority(IssuePriority.Warning) + .OfRule(rule, MarkdownlintRuleUrlResolver.Instance.ResolveRuleUrl(rule)) + .Create(); } } diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.Markdownlint.cs b/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.Markdownlint.cs index b9ecbdb..1435fa9 100644 --- a/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.Markdownlint.cs +++ b/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.Markdownlint.cs @@ -23,7 +23,7 @@ public static string MarkdownlintIssuesProviderTypeName( { context.NotNull(nameof(context)); - return Issue.GetProviderTypeName(); + return typeof(MarkdownlintIssuesProvider).FullName; } /// diff --git a/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.MarkdownlintCli.cs b/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.MarkdownlintCli.cs index 33858a5..11dfa4b 100644 --- a/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.MarkdownlintCli.cs +++ b/src/Cake.Issues.Markdownlint/MarkdownlintIssuesAliases.MarkdownlintCli.cs @@ -23,7 +23,7 @@ public static string MarkdownlintCliIssuesProviderTypeName( { context.NotNull(nameof(context)); - return Issue.GetProviderTypeName(); + return typeof(MarkdownlintCliIssuesProvider).FullName; } /// diff --git a/src/Cake.Issues.Markdownlint/packages.config b/src/Cake.Issues.Markdownlint/packages.config index 6580b16..55ad019 100644 --- a/src/Cake.Issues.Markdownlint/packages.config +++ b/src/Cake.Issues.Markdownlint/packages.config @@ -1,7 +1,7 @@  - + From 09936fef2c0212327f98718d61b20a2b0d22a8e8 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Mon, 4 Jun 2018 18:35:27 +0200 Subject: [PATCH 8/8] Update Cake.Issues to 0.3.0 --- .../Cake.Issues.Markdownlint.Tests.csproj | 4 ++-- src/Cake.Issues.Markdownlint.Tests/packages.config | 4 ++-- src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj | 2 +- src/Cake.Issues.Markdownlint/packages.config | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj index 7596bfd..b515391 100644 --- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj +++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj @@ -41,10 +41,10 @@ ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll - ..\packages\Cake.Issues.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.dll + ..\packages\Cake.Issues.0.3.0\lib\netstandard2.0\Cake.Issues.dll - ..\packages\Cake.Issues.Testing.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.Testing.dll + ..\packages\Cake.Issues.Testing.0.3.0\lib\netstandard2.0\Cake.Issues.Testing.dll ..\packages\Cake.Testing.0.28.0\lib\net46\Cake.Testing.dll diff --git a/src/Cake.Issues.Markdownlint.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config index 9463e49..39c7cf8 100644 --- a/src/Cake.Issues.Markdownlint.Tests/packages.config +++ b/src/Cake.Issues.Markdownlint.Tests/packages.config @@ -1,8 +1,8 @@  - - + + diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj index ce79666..ac3622a 100644 --- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj +++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj @@ -45,7 +45,7 @@ ..\packages\Cake.Core.0.28.0\lib\net46\Cake.Core.dll - ..\packages\Cake.Issues.0.3.0-beta0002\lib\netstandard2.0\Cake.Issues.dll + ..\packages\Cake.Issues.0.3.0\lib\netstandard2.0\Cake.Issues.dll ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll diff --git a/src/Cake.Issues.Markdownlint/packages.config b/src/Cake.Issues.Markdownlint/packages.config index 55ad019..cc19bf0 100644 --- a/src/Cake.Issues.Markdownlint/packages.config +++ b/src/Cake.Issues.Markdownlint/packages.config @@ -1,7 +1,7 @@  - +