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

Commit

Permalink
Merge branch 'release/0.6.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Feb 23, 2019
2 parents 8d21b55 + 46c479d commit 98dc869
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 29 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ and for general information about the Cake build automation system see the [Cake

## Build Status

|Develop|Master|
|:--:|:--:|
|[![Build status](https://ci.appveyor.com/api/projects/status/anynhsed2v76icqg/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-docfx/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/anynhsed2v76icqg/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-docfx/branch/master)|
| | Develop | Master |
|:--:|:--:|:--:|
|AppVeyor Windows|[![Build status](https://ci.appveyor.com/api/projects/status/anynhsed2v76icqg/branch/develop?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-docfx/branch/develop)|[![Build status](https://ci.appveyor.com/api/projects/status/anynhsed2v76icqg/branch/master?svg=true)](https://ci.appveyor.com/project/cakecontrib/cake-issues-docfx/branch/master)|
|Azure DevOps Windows|[![Build Status](https://dev.azure.com/cake-contrib/Cake.Issues.DocFx/_apis/build/status/cake-contrib.Cake.Issues.DocFx?branchName=develop&jobName=Windows)](https://dev.azure.com/cake-contrib/Cake.Issues.DocFx/_build/latest?definitionId=13?branchName=develop)|[![Build Status](https://dev.azure.com/cake-contrib/Cake.Issues.DocFx/_apis/build/status/cake-contrib.Cake.Issues.DocFx?branchName=master&jobName=Windows)](https://dev.azure.com/cake-contrib/Cake.Issues.DocFx/_build/latest?definitionId=13?branchName=master)|

## Code Coverage

Expand Down
16 changes: 16 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
trigger:
- develop
- master
- release/*
- hotfix/*

pr:
- develop

jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- powershell: ./build.ps1
displayName: 'Cake Build'
2 changes: 1 addition & 1 deletion nuspec/nuget/Cake.Issues.DocFx.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<repository type="git" url="https://github.com/cake-contrib/Cake.Issues.DocFx"/>
<copyright>Copyright © BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-IssueProvider CodeAnalysis Linting DocFx</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.DocFx/releases/tag/0.6.2</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.DocFx/releases/tag/0.6.3</releaseNotes>
</metadata>
<files>
<file src="net461/Cake.Issues.DocFx.dll" target="lib\net461" />
Expand Down
10 changes: 7 additions & 3 deletions src/Cake.Issues.DocFx.Tests/Cake.Issues.DocFx.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<CodeAnalysisRuleSet>..\Cake.Issues.DocFx.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<None Remove="Testfiles\entry-of-level-suggestion.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Cake.Issues.DocFx\Cake.Issues.DocFx.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Testfiles\docfx.json" />
<EmbeddedResource Include="Testfiles\entry-of-level-suggestion.json" />
<EmbeddedResource Include="Testfiles\entry-with-line.json" />
</ItemGroup>
<ItemGroup>
Expand All @@ -40,18 +44,18 @@
<Version>0.28.0</Version>
</PackageReference>
<PackageReference Include="Shouldly">
<Version>3.0.0</Version>
<Version>3.0.2</Version>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers">
<Version>1.0.2</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.4.0</Version>
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio">
<Version>2.4.0</Version>
<Version>2.4.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
22 changes: 22 additions & 0 deletions src/Cake.Issues.DocFx.Tests/DocFxProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,28 @@ public void Should_Read_Line_Zero_Correct()
"Invalid file link:(~/foo.md).");
}

[Fact]
public void Should_Read_Suggestions_Correct()
{
// Given
var fixture = new DocFxProviderFixture("entry-of-level-suggestion.json", @"/");

// When
var issues = fixture.ReadIssues().ToList();

// Then
issues.Count.ShouldBe(1);
CheckIssue(
issues[0],
@"bar.md",
45,
"Build Document.LinkPhaseHandler.ConceptualDocumentProcessor.Save",
null,
200,
"Suggestion",
"Invalid file link:(~/foo.md).");
}

private static void CheckIssue(
IIssue issue,
string affectedFileRelativePath,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"message":"Invalid file link:(~/foo.md).","source":"Build Document.LinkPhaseHandler.ConceptualDocumentProcessor.Save","file":"bar.md","line":"45","date_time":"2017-05-17T08:11:07.7019631Z","message_severity":"suggestion"}
2 changes: 1 addition & 1 deletion src/Cake.Issues.DocFx/Cake.Issues.DocFx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Version>0.6.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<Version>2.6.1</Version>
<Version>2.6.3</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
60 changes: 40 additions & 20 deletions src/Cake.Issues.DocFx/DocFxIssuesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,56 @@ protected override IEnumerable<IIssue> InternalReadIssues(IssueCommentFormat for
return
from logEntry in logFileEntries
let file = this.TryGetFile(logEntry.file, docRootPath)
let line = this.TryGetLine(logEntry.line)
let line = TryGetLine(logEntry.line)
where
logEntry.message_severity == "warning" &&
(logEntry.message_severity == "warning" || logEntry.message_severity == "suggestion") &&
!string.IsNullOrWhiteSpace(logEntry.message)
select
IssueBuilder
.NewIssue(logEntry.message, this)
.InFile(file, line)
.OfRule(logEntry.source)
.WithPriority(IssuePriority.Warning)
.WithPriority(GetPriority(logEntry.message_severity))
.Create();
}

/// <summary>
/// Converts the severity to a priority.
/// </summary>
/// <param name="severity">Severity as reported by DocFX.</param>
/// <returns>Priority</returns>
private static IssuePriority GetPriority(string severity)
{
switch (severity.ToLower())
{
case "warning":
return IssuePriority.Warning;

case "suggestion":
return IssuePriority.Suggestion;

default:
return IssuePriority.Undefined;
}
}

/// <summary>
/// Reads the affected line from a issue logged in a DocFx log file.
/// </summary>
/// <param name="line">The line in the current log entry.</param>
/// <returns>The line of the issue.</returns>
private static int? TryGetLine(
int? line)
{
// Convert negative line numbers or line number 0 to null
if (line.HasValue && line.Value <= 0)
{
return null;
}

return line;
}

/// <summary>
/// Reads the affected file path from a issue logged in a DocFx log file.
/// </summary>
Expand Down Expand Up @@ -98,22 +135,5 @@ private string TryGetFile(

return fileName;
}

/// <summary>
/// Reads the affected line from a issue logged in a DocFx log file.
/// </summary>
/// <param name="line">The line in the current log entry.</param>
/// <returns>The line of the issue.</returns>
private int? TryGetLine(
int? line)
{
// Convert negative line numbers or line number 0 to null
if (line.HasValue && line.Value <= 0)
{
return null;
}

return line;
}
}
}
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.30.0" />
<package id="Cake" version="0.32.0" />
</packages>

0 comments on commit 98dc869

Please sign in to comment.