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
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..b515391 100644
--- a/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj
+++ b/src/Cake.Issues.Markdownlint.Tests/Cake.Issues.Markdownlint.Tests.csproj
@@ -37,17 +37,17 @@
..\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.2.0\lib\netstandard2.0\Cake.Issues.dll
+
+ ..\packages\Cake.Issues.0.3.0\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\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
@@ -97,12 +97,13 @@
-
+
+
-
+
diff --git a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs
index 080a365..9d8a987 100644
--- a/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs
+++ b/src/Cake.Issues.Markdownlint.Tests/Markdownlint/MarkdownlintIssuesProviderTests.cs
@@ -57,7 +57,8 @@ 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(
issues[1],
@@ -65,7 +66,8 @@ 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(
issues[2],
@@ -73,7 +75,8 @@ 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");
}
@@ -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..61d837a 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();
@@ -57,7 +57,8 @@ public void Should_Read_Issue_Correct()
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(
issues[1],
@@ -65,7 +66,8 @@ public void Should_Read_Issue_Correct()
2,
"MD009",
"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009",
- 0,
+ 300,
+ "Warning",
"Trailing spaces [Expected: 2; Actual: 1]");
CheckIssue(
issues[2],
@@ -73,7 +75,8 @@ public void Should_Read_Issue_Correct()
2,
"MD013",
"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013",
- 0,
+ 300,
+ "Warning",
"Line length [Expected: 100; Actual: 811]");
CheckIssue(
issues[3],
@@ -81,7 +84,8 @@ public void Should_Read_Issue_Correct()
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(
issues[4],
@@ -89,7 +93,8 @@ public void Should_Read_Issue_Correct()
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(
issues[5],
@@ -97,7 +102,8 @@ public void Should_Read_Issue_Correct()
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(
issues[6],
@@ -105,7 +111,8 @@ public void Should_Read_Issue_Correct()
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(
issues[7],
@@ -113,10 +120,96 @@ public void Should_Read_Issue_Correct()
6,
"MD009",
"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md009",
- 0,
+ 300,
+ "Warning",
"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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "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",
+ 300,
+ "Warning",
+ "Trailing spaces [Expected: 0 or 2; Actual: 1]");
+ }
+
private static void CheckIssue(
IIssue issue,
string affectedFileRelativePath,
@@ -124,8 +217,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 +246,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/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.Tests/packages.config b/src/Cake.Issues.Markdownlint.Tests/packages.config
index 4bcb8fe..39c7cf8 100644
--- a/src/Cake.Issues.Markdownlint.Tests/packages.config
+++ b/src/Cake.Issues.Markdownlint.Tests/packages.config
@@ -1,14 +1,14 @@
-
-
-
-
+
+
+
+
-
+
diff --git a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj
index 36615f8..ac3622a 100644
--- a/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj
+++ b/src/Cake.Issues.Markdownlint/Cake.Issues.Markdownlint.csproj
@@ -41,18 +41,18 @@
..\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.2.0\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
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/Markdownlint/MarkdownlintIssuesProvider.cs b/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesProvider.cs
index 1ea3d2b..3303fcd 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)
{
@@ -38,13 +41,12 @@ from entry in file.Value
let
rule = (string)entry.SelectToken("ruleName")
select
- new Issue(
- file.Key,
- (int)entry.SelectToken("lineNumber"),
- (string)entry.SelectToken("ruleDescription"),
- 0,
- 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 5d482f4..7573c5b 100644
--- a/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs
+++ b/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesProvider.cs
@@ -27,10 +27,13 @@ public MarkdownlintCliIssuesProvider(ICakeLog log, MarkdownlintCliIssuesSettings
this.settings = settings;
}
+ ///
+ public override string ProviderName => "markdownlint";
+
///
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)))
{
@@ -47,13 +50,12 @@ protected override IEnumerable InternalReadIssues(IssueCommentFormat for
var ruleDescription = groups[5].Value;
yield return
- new Issue(
- fileName,
- lineNumber,
- ruleDescription,
- 0,
- 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 4bc732a..cc19bf0 100644
--- a/src/Cake.Issues.Markdownlint/packages.config
+++ b/src/Cake.Issues.Markdownlint/packages.config
@@ -1,14 +1,14 @@
-
-
+
+
-
+
\ No newline at end of file