Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed May 27, 2018
2 parents b3fd152 + 9417cdc commit 6fde1ff
Show file tree
Hide file tree
Showing 25 changed files with 832 additions and 176 deletions.
3 changes: 3 additions & 0 deletions cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Nuget]
; Use the new InProcess client, because some packages have long file paths.
UseInProcessClient=true
10 changes: 5 additions & 5 deletions nuspec/nuget/Cake.Issues.Markdownlint.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<projectUrl>https://github.com/cake-contrib/Cake.Issues.Markdownlint</projectUrl>
<iconUrl>https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright © 2017 BBT Software AG and contributors</copyright>
<copyright>Copyright © BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-IssueProvider Linting Markdownlint</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Markdownlint/releases/tag/0.1.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.Markdownlint/releases/tag/0.2.0</releaseNotes>
</metadata>
<files>
<file src="Cake.Issues.Markdownlint.dll" target="lib\net45" />
<file src="Cake.Issues.Markdownlint.pdb" target="lib\net45" />
<file src="Cake.Issues.Markdownlint.xml" target="lib\net45" />
<file src="Cake.Issues.Markdownlint.dll" target="lib\net46" />
<file src="Cake.Issues.Markdownlint.pdb" target="lib\net46" />
<file src="Cake.Issues.Markdownlint.xml" target="lib\net46" />
</files>
</package>
12 changes: 10 additions & 2 deletions setup.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ BuildParameters.SetParameters(
title: "Cake.Issues.Markdownlint",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Issues.Markdownlint",
appVeyorAccountName: "cakecontrib");
appVeyorAccountName: "cakecontrib",
shouldRunCodecov: false);

BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(
context: Context,
dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint.Tests/*.cs" },
dupFinderExcludePattern: new string[]
{
BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint/Markdownlint/MarkdownlintIssuesSettings.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint/MarkdownlintCli/MarkdownlintCliIssuesSettings.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint.Tests/*.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint.Tests/Markdownlint/*.cs",
BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Markdownlint.Tests/MarkdownlintCli/*.cs"
},
testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[Cake.Issues]* -[Cake.Issues.Testing]*",
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -10,7 +11,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cake.Issues.Markdownlint.Tests</RootNamespace>
<AssemblyName>Cake.Issues.Markdownlint.Tests</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
Expand All @@ -36,20 +37,20 @@
<CodeAnalysisRuleSet>..\Cake.Issues.Markdownlint.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cake.Core, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll</HintPath>
<Reference Include="Cake.Core, Version=0.26.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.26.0\lib\net46\Cake.Core.dll</HintPath>
</Reference>
<Reference Include="Cake.Issues, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Issues.0.1.0\lib\net45\Cake.Issues.dll</HintPath>
<Reference Include="Cake.Issues, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Issues.0.2.0\lib\netstandard2.0\Cake.Issues.dll</HintPath>
</Reference>
<Reference Include="Cake.Issues.Testing, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Issues.Testing.0.1.0\lib\net45\Cake.Issues.Testing.dll</HintPath>
<Reference Include="Cake.Issues.Testing, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Issues.Testing.0.2.0\lib\netstandard2.0\Cake.Issues.Testing.dll</HintPath>
</Reference>
<Reference Include="Cake.Testing, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Testing.0.22.0\lib\net46\Cake.Testing.dll</HintPath>
<Reference Include="Cake.Testing, Version=0.26.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Testing.0.26.0\lib\net46\Cake.Testing.dll</HintPath>
</Reference>
<Reference Include="Shouldly, Version=2.8.3.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
<HintPath>..\packages\Shouldly.2.8.3\lib\net451\Shouldly.dll</HintPath>
<Reference Include="Shouldly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
<HintPath>..\packages\Shouldly.3.0.0\lib\net451\Shouldly.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -62,20 +63,23 @@
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll</HintPath>
<Reference Include="xunit.assert, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.3.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll</HintPath>
<Reference Include="xunit.core, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.3.1\lib\netstandard1.1\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll</HintPath>
<Reference Include="xunit.execution.desktop, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.3.1\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MarkdownlintIssuesProviderFixture.cs" />
<Compile Include="MarkdownlintIssuesProviderTests.cs" />
<Compile Include="MarkdownlintIssuesSettingsTests.cs" />
<Compile Include="MarkdownlintCli\MarkdownlintCliIssuesProviderFixture.cs" />
<Compile Include="MarkdownlintCli\MarkdownlintCliIssuesProviderTests.cs" />
<Compile Include="MarkdownlintCli\MarkdownlintCliIssuesSettingsTests.cs" />
<Compile Include="Markdownlint\MarkdownlintIssuesProviderFixture.cs" />
<Compile Include="Markdownlint\MarkdownlintIssuesProviderTests.cs" />
<Compile Include="Markdownlint\MarkdownlintIssuesSettingsTests.cs" />
<Compile Include="MarkdownlintRuleUrlResolverTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -93,16 +97,22 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<EmbeddedResource Include="Testfiles\markdownlint-cli.log" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
<Analyzer Include="..\packages\xunit.analyzers.0.8.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.2.0\build\net20\xunit.runner.visualstudio.props'))" />
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.props'))" />
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.targets'))" />
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace Cake.Issues.Markdownlint.Tests
namespace Cake.Issues.Markdownlint.Tests.Markdownlint
{
using System.Collections.Generic;
using System.IO;
using Cake.Issues.Markdownlint.Markdownlint;
using Cake.Testing;
using Core.Diagnostics;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Cake.Issues.Markdownlint.Tests
namespace Cake.Issues.Markdownlint.Tests.Markdownlint
{
using System.Linq;
using Cake.Issues.Markdownlint.Markdownlint;
using Cake.Testing;
using Core.IO;
using Shouldly;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
namespace Cake.Issues.Markdownlint.Tests
namespace Cake.Issues.Markdownlint.Tests.Markdownlint
{
using System;
using System.IO;
using System.Linq;
using System.Text;
using Cake.Issues.Markdownlint.Markdownlint;
using Shouldly;
using Testing;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace Cake.Issues.Markdownlint.Tests.MarkdownlintCli
{
using System.Collections.Generic;
using System.IO;
using Cake.Issues.Markdownlint.MarkdownlintCli;
using Cake.Testing;
using Core.Diagnostics;

internal class MarkdownlintCliIssuesProviderFixture
{
public MarkdownlintCliIssuesProviderFixture(string fileResourceName)
{
this.Log = new FakeLog { Verbosity = Verbosity.Normal };

using (var stream = this.GetType().Assembly.GetManifestResourceStream("Cake.Issues.Markdownlint.Tests.Testfiles." + fileResourceName))
{
using (var sr = new StreamReader(stream))
{
this.Settings =
MarkdownlintCliIssuesSettings.FromContent(
sr.ReadToEnd());
}
}

this.RepositorySettings =
new RepositorySettings(@"c:\Source\Cake.Issues");
}

public FakeLog Log { get; set; }

public MarkdownlintCliIssuesSettings Settings { get; set; }

public RepositorySettings RepositorySettings { get; set; }

public MarkdownlintCliIssuesProvider Create()
{
var provider = new MarkdownlintCliIssuesProvider(this.Log, this.Settings);
provider.Initialize(this.RepositorySettings);
return provider;
}

public IEnumerable<IIssue> ReadIssues()
{
var issueProvider = this.Create();
return issueProvider.ReadIssues(IssueCommentFormat.PlainText);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
namespace Cake.Issues.Markdownlint.Tests.MarkdownlintCli
{
using System.Linq;
using Cake.Issues.Markdownlint.MarkdownlintCli;
using Cake.Testing;
using Core.IO;
using Shouldly;
using Testing;
using Xunit;

public sealed class MarkdownlintCliIssuesProviderTests
{
public sealed class TheCtor
{
[Fact]
public void Should_Throw_If_Log_Is_Null()
{
// Given / When
var result = Record.Exception(() =>
new MarkdownlintCliIssuesProvider(
null,
MarkdownlintCliIssuesSettings.FromContent("Foo")));

// Then
result.IsArgumentNullException("log");
}

[Fact]
public void Should_Throw_If_Settings_Are_Null()
{
var result = Record.Exception(() =>
new MarkdownlintCliIssuesProvider(
new FakeLog(),
null));

// Then
result.IsArgumentNullException("settings");
}
}

public sealed class TheReadIssuesMethod
{
[Fact]
public void Should_Read_Issue_Correct()
{
// Given
var fixture = new MarkdownlintCliIssuesProviderFixture("markdownlint-cli.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,
"Headers 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,
"Trailing spaces [Expected: 2; Actual: 1]");
CheckIssue(
issues[2],
@"docs/index.md",
2,
"MD013",
"https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md013",
0,
"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,
"Headers 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,
"Multiple top level headers 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,
"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,
"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,
"Trailing spaces [Expected: 2; Actual: 1]");
}

private static void CheckIssue(
IIssue issue,
string affectedFileRelativePath,
int? line,
string rule,
string ruleUrl,
int priority,
string message)
{
if (issue.AffectedFileRelativePath == null)
{
affectedFileRelativePath.ShouldBeNull();
}
else
{
issue.AffectedFileRelativePath.ToString().ShouldBe(new FilePath(affectedFileRelativePath).ToString());
issue.AffectedFileRelativePath.IsRelative.ShouldBe(true, "Issue path is not relative");
}

issue.Line.ShouldBe(line);
issue.Rule.ShouldBe(rule);

if (issue.RuleUrl == null)
{
ruleUrl.ShouldBeNull();
}
else
{
issue.RuleUrl.ToString().ShouldBe(ruleUrl);
}

issue.Priority.ShouldBe(priority);
issue.Message.ShouldBe(message);
}
}
}
}
Loading

0 comments on commit 6fde1ff

Please sign in to comment.