diff --git a/.appveyor.yml b/.appveyor.yml
index 5528bc03c..c687c0ff6 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -6,7 +6,7 @@ environment:
#---------------------------------#
# Build Image #
#---------------------------------#
-image: Visual Studio 2019
+image: Visual Studio 2022
#---------------------------------#
# Build Script #
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 000000000..39aed68a9
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,15 @@
+version: 2
+updates:
+- package-ecosystem: nuget
+ directory: "/src"
+ schedule:
+ interval: daily
+ time: "04:00"
+ open-pull-requests-limit: 10
+ ignore:
+ - dependency-name: Cake.Core
+ versions:
+ - "> 1.0.0, < 2"
+ - dependency-name: Cake.Testing
+ versions:
+ - "> 1.0.0, < 2"
\ No newline at end of file
diff --git a/README.md b/README.md
index a8574d888..c372090d3 100644
--- a/README.md
+++ b/README.md
@@ -29,11 +29,11 @@ and for general information about the Cake build automation system see the [Cake
- [Documentation](https://cakeissues.net)
-## Chat Room
+## Discussion
-Come join in the conversation about this addin in our Gitter Chat Room.
+For questions and to discuss ideas & feature requests, use the [GitHub discussions on the Cake GitHub repository](https://github.com/cake-build/cake/discussions), under the [Extension Q&A](https://github.com/cake-build/cake/discussions/categories/extension-q-a) category.
-[![Join the chat at https://gitter.im/cake-contrib/Lobby](https://badges.gitter.im/cake-contrib/Lobby.svg)](https://gitter.im/cake-contrib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Join in the discussion on the Cake repository](https://img.shields.io/badge/GitHub-Discussions-green?logo=github)](https://github.com/cake-build/cake/discussions)
## Contributing
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index d7198be65..c2b96e385 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -12,7 +12,7 @@ pr:
jobs:
- job: Windows
pool:
- vmImage: 'vs2017-win2016'
+ vmImage: 'windows-2022'
steps:
- powershell: ./build.ps1
displayName: 'Cake Build'
\ No newline at end of file
diff --git a/nuspec/nuget/Cake.Issues.PullRequests.nuspec b/nuspec/nuget/Cake.Issues.PullRequests.nuspec
index a34650de0..6b6820425 100644
--- a/nuspec/nuget/Cake.Issues.PullRequests.nuspec
+++ b/nuspec/nuget/Cake.Issues.PullRequests.nuspec
@@ -22,12 +22,18 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
Copyright © BBT Software AG and contributors
Cake Script Cake-Issues CodeAnalysis Linting Issues Pull-Requests
- https://github.com/cake-contrib/Cake.Issues/releases/tag/1.0.0
+ https://github.com/cake-contrib/Cake.Issues/releases/tag/2.0.0
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nuspec/nuget/Cake.Issues.Reporting.nuspec b/nuspec/nuget/Cake.Issues.Reporting.nuspec
index e44e12106..c66820bed 100644
--- a/nuspec/nuget/Cake.Issues.Reporting.nuspec
+++ b/nuspec/nuget/Cake.Issues.Reporting.nuspec
@@ -22,12 +22,18 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
Copyright © BBT Software AG and contributors
Cake Script Cake-Issues CodeAnalysis Linting Issues Reporting
- https://github.com/cake-contrib/Cake.Issues/releases/tag/1.0.0
+ https://github.com/cake-contrib/Cake.Issues/releases/tag/2.0.0
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nuspec/nuget/Cake.Issues.Testing.nuspec b/nuspec/nuget/Cake.Issues.Testing.nuspec
index 9d1b17285..b4adcc064 100644
--- a/nuspec/nuget/Cake.Issues.Testing.nuspec
+++ b/nuspec/nuget/Cake.Issues.Testing.nuspec
@@ -17,12 +17,18 @@ Common helpers for testing add-ins based on Cake.Issues
Copyright © BBT Software AG and contributors
Cake Script Cake-Issues Issues Testing
- https://github.com/cake-contrib/Cake.Issues/releases/tag/1.0.0
+ https://github.com/cake-contrib/Cake.Issues/releases/tag/2.0.0
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nuspec/nuget/Cake.Issues.nuspec b/nuspec/nuget/Cake.Issues.nuspec
index aff4253a5..9d107551d 100644
--- a/nuspec/nuget/Cake.Issues.nuspec
+++ b/nuspec/nuget/Cake.Issues.nuspec
@@ -24,12 +24,18 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
Copyright © BBT Software AG and contributors
cake cake-addin cake-issues code-analysis linting issues
- https://github.com/cake-contrib/Cake.Issues/releases/tag/1.0.0
+ https://github.com/cake-contrib/Cake.Issues/releases/tag/2.0.0
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/recipe.cake b/recipe.cake
index 3e218f0ca..e107e5d9c 100644
--- a/recipe.cake
+++ b/recipe.cake
@@ -1,4 +1,4 @@
-#load nuget:?package=Cake.Recipe&version=2.0.1
+#load nuget:?package=Cake.Recipe&version=2.2.1
Environment.SetVariableNames();
@@ -27,4 +27,8 @@ ToolSettings.SetToolSettings(
testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*",
testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");
+// Workaround until https://github.com/cake-contrib/Cake.Recipe/issues/862 has been fixed in Cake.Recipe
+ToolSettings.SetToolPreprocessorDirectives(
+ reSharperTools: "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2021.2.0");
+
Build.RunDotNetCore();
diff --git a/src/Cake.Issues.PullRequests.Tests/BaseDiscussionThreadsCapabilityTests.cs b/src/Cake.Issues.PullRequests.Tests/BaseDiscussionThreadsCapabilityTests.cs
index b0628042f..4f2aeaa8e 100644
--- a/src/Cake.Issues.PullRequests.Tests/BaseDiscussionThreadsCapabilityTests.cs
+++ b/src/Cake.Issues.PullRequests.Tests/BaseDiscussionThreadsCapabilityTests.cs
@@ -116,13 +116,13 @@ public void Should_Call_InternalFetchDiscussionThreads()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = settings.CommentSource,
- }
+ },
};
var capability = new FakeDiscussionThreadsCapability(log, pullRequestSystem, discussionThreads);
@@ -172,8 +172,8 @@ public void Should_Call_InternalResolveDiscussionThreads()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
@@ -189,8 +189,8 @@ public void Should_Call_InternalResolveDiscussionThreads()
new PullRequestDiscussionComment()
{
Content = "Message Bar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Bar",
@@ -199,7 +199,8 @@ public void Should_Call_InternalResolveDiscussionThreads()
var discussionThreads =
new List
{
- discussionThread1, discussionThread2
+ discussionThread1,
+ discussionThread2,
};
var capability = new FakeDiscussionThreadsCapability(log, pullRequestSystem, discussionThreads);
@@ -208,7 +209,7 @@ public void Should_Call_InternalResolveDiscussionThreads()
capability.ResolveDiscussionThreads(
new List
{
- discussionThread1
+ discussionThread1,
});
// Then
@@ -253,8 +254,8 @@ public void Should_Call_InternalReopenDiscussionThreads()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
@@ -270,8 +271,8 @@ public void Should_Call_InternalReopenDiscussionThreads()
new PullRequestDiscussionComment()
{
Content = "Message Bar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentSource = settings.CommentSource,
@@ -279,7 +280,8 @@ public void Should_Call_InternalReopenDiscussionThreads()
var discussionThreads =
new List
{
- discussionThread1, discussionThread2
+ discussionThread1,
+ discussionThread2,
};
var capability = new FakeDiscussionThreadsCapability(log, pullRequestSystem, discussionThreads);
@@ -288,7 +290,7 @@ public void Should_Call_InternalReopenDiscussionThreads()
capability.ReopenDiscussionThreads(
new List
{
- discussionThread1
+ discussionThread1,
});
// Then
diff --git a/src/Cake.Issues.PullRequests.Tests/Cake.Issues.PullRequests.Tests.csproj b/src/Cake.Issues.PullRequests.Tests/Cake.Issues.PullRequests.Tests.csproj
index 1b03b83ac..3a0777938 100644
--- a/src/Cake.Issues.PullRequests.Tests/Cake.Issues.PullRequests.Tests.csproj
+++ b/src/Cake.Issues.PullRequests.Tests/Cake.Issues.PullRequests.Tests.csproj
@@ -1,6 +1,6 @@
- netcoreapp2.1
+ netcoreapp3.1
false
Cake.Issues
Copyright © BBT Software AG and contributors
@@ -10,9 +10,9 @@
..\Cake.Issues.Tests.ruleset
-
-
-
+
+
+
diff --git a/src/Cake.Issues.PullRequests.Tests/FakeDiscussionThreadsCapability.cs b/src/Cake.Issues.PullRequests.Tests/FakeDiscussionThreadsCapability.cs
index 3488a5774..c3eed71ca 100644
--- a/src/Cake.Issues.PullRequests.Tests/FakeDiscussionThreadsCapability.cs
+++ b/src/Cake.Issues.PullRequests.Tests/FakeDiscussionThreadsCapability.cs
@@ -8,9 +8,9 @@
///
public class FakeDiscussionThreadsCapability : BaseDiscussionThreadsCapability
{
- private readonly List discussionThreads = new List();
- private readonly List resolvedThreads = new List();
- private readonly List reopenedThreads = new List();
+ private readonly List discussionThreads = new ();
+ private readonly List resolvedThreads = new ();
+ private readonly List reopenedThreads = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests.Tests/FakeFilteringByModifiedFilesCapability.cs b/src/Cake.Issues.PullRequests.Tests/FakeFilteringByModifiedFilesCapability.cs
index 819502503..fbe8f418c 100644
--- a/src/Cake.Issues.PullRequests.Tests/FakeFilteringByModifiedFilesCapability.cs
+++ b/src/Cake.Issues.PullRequests.Tests/FakeFilteringByModifiedFilesCapability.cs
@@ -9,7 +9,7 @@
///
public class FakeFilteringByModifiedFilesCapability : BaseFilteringByModifiedFilesCapability
{
- private readonly List modifiedFiles = new List();
+ private readonly List modifiedFiles = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystem.cs b/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystem.cs
index f6fb8494f..7b8bf891e 100644
--- a/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystem.cs
+++ b/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystem.cs
@@ -8,7 +8,7 @@
///
public class FakePullRequestSystem : BasePullRequestSystem
{
- private readonly List postedIssues = new List();
+ private readonly List postedIssues = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystemBuilder.cs b/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystemBuilder.cs
index 737becf72..cbb94d205 100644
--- a/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystemBuilder.cs
+++ b/src/Cake.Issues.PullRequests.Tests/FakePullRequestSystemBuilder.cs
@@ -11,8 +11,8 @@
public class FakePullRequestSystemBuilder
{
private readonly ICakeLog log;
- private readonly List discussionThreads = new List();
- private readonly List modifiedFiles = new List();
+ private readonly List discussionThreads = new ();
+ private readonly List modifiedFiles = new ();
private bool withCheckingCommitIdCapability;
private bool withDiscussionThreadsCapability;
private bool withFilteringByModifiedFilesCapability;
diff --git a/src/Cake.Issues.PullRequests.Tests/IssueFiltererTests.cs b/src/Cake.Issues.PullRequests.Tests/IssueFiltererTests.cs
index ec75b66ad..4345b2990 100644
--- a/src/Cake.Issues.PullRequests.Tests/IssueFiltererTests.cs
+++ b/src/Cake.Issues.PullRequests.Tests/IssueFiltererTests.cs
@@ -17,7 +17,7 @@ public void Should_Throw_If_Log_Is_Null()
// Given
var fixture = new IssueFiltererFixture
{
- Log = null
+ Log = null,
};
// When
@@ -33,7 +33,7 @@ public void Should_Throw_If_Pull_Request_System_Is_Null()
// Given
var fixture = new IssueFiltererFixture
{
- PullRequestSystem = null
+ PullRequestSystem = null,
};
// When
@@ -49,7 +49,7 @@ public void Should_Throw_If_Settings_Are_Null()
// Given
var fixture = new IssueFiltererFixture
{
- Settings = null
+ Settings = null,
};
// When
@@ -93,7 +93,7 @@ public void Should_Apply_Custom_Filters()
// Given
var fixture =
new IssueFiltererFixture();
- fixture.Settings.IssueFilters.Add(x => x.Where(issue => issue.Rule != "Bar"));
+ fixture.Settings.IssueFilters.Add(x => x.Where(issue => issue.RuleId != "Bar"));
var issue1 =
IssueBuilder
@@ -115,7 +115,8 @@ public void Should_Apply_Custom_Filters()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1,
+ issue2,
},
new Dictionary());
@@ -136,7 +137,7 @@ public void Should_Throw_If_Modified_Files_Contain_Absolute_Path()
.WithFilteringByModifiedFilesCapability(
new List
{
- new FilePath(@"c:\FakeIssueProvider.cs")
+ new FilePath(@"c:\FakeIssueProvider.cs"),
}));
// When
@@ -144,12 +145,12 @@ public void Should_Throw_If_Modified_Files_Contain_Absolute_Path()
fixture.FilterIssues(
new List
{
- IssueBuilder
- .NewIssue("Message", "ProviderType", "ProviderName")
- .InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
- .OfRule("Rule")
- .WithPriority(IssuePriority.Warning)
- .Create()
+ IssueBuilder
+ .NewIssue("Message", "ProviderType", "ProviderName")
+ .InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
+ .OfRule("Rule")
+ .WithPriority(IssuePriority.Warning)
+ .Create(),
},
new Dictionary()));
@@ -167,7 +168,7 @@ public void Should_Filter_Issues_If_File_Is_Not_Modified()
.WithFilteringByModifiedFilesCapability(
new List
{
- new FilePath(@"src\Cake.Issues.Tests\FakeIssueProvider.cs")
+ new FilePath(@"src\Cake.Issues.Tests\FakeIssueProvider.cs"),
}));
var issue1 =
@@ -190,7 +191,8 @@ public void Should_Filter_Issues_If_File_Is_Not_Modified()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1,
+ issue2,
},
new Dictionary());
@@ -229,7 +231,8 @@ public void Should_Filter_Issues_With_Existing_Active_Comment()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1,
+ issue2,
},
new Dictionary
{
@@ -241,12 +244,12 @@ public void Should_Filter_Issues_With_Existing_Active_Comment()
new PullRequestDiscussionComment
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
},
new List(),
new List())
- }
+ },
});
// Then
@@ -280,7 +283,7 @@ public void Should_Filter_Issues_With_Existing_WontFix_Comment()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary
{
@@ -293,11 +296,11 @@ public void Should_Filter_Issues_With_Existing_WontFix_Comment()
new PullRequestDiscussionComment
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
},
new List())
- }
+ },
});
// Then
@@ -331,7 +334,7 @@ public void Should_Filter_Issues_With_Existing_Resolved_Comment()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary
{
@@ -345,10 +348,10 @@ public void Should_Filter_Issues_With_Existing_Resolved_Comment()
new PullRequestDiscussionComment
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
- }
+ },
});
// Then
@@ -388,7 +391,7 @@ public void Should_Limit_Messages_To_Maximum()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary());
@@ -425,7 +428,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary());
@@ -461,7 +464,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary());
@@ -481,7 +484,7 @@ public void Should_Limit_Messages_To_Maximum()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
var newIssue1 =
IssueBuilder
@@ -504,7 +507,7 @@ public void Should_Limit_Messages_To_Maximum()
fixture.FilterIssues(
new List
{
- newIssue1, newIssue2
+ newIssue1, newIssue2,
},
new Dictionary(),
new List
@@ -518,11 +521,11 @@ public void Should_Limit_Messages_To_Maximum()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
+ ProviderType = "ProviderType Foo",
},
new PullRequestDiscussionThread(
1,
@@ -533,12 +536,12 @@ public void Should_Limit_Messages_To_Maximum()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
});
// Then
@@ -554,7 +557,7 @@ public void Should_Limit_Messages_To_Zero()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 0));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 0));
var newIssue1 =
IssueBuilder
@@ -577,7 +580,7 @@ public void Should_Limit_Messages_To_Zero()
fixture.FilterIssues(
new List
{
- newIssue1, newIssue2
+ newIssue1, newIssue2,
},
new Dictionary(),
new List
@@ -591,11 +594,11 @@ public void Should_Limit_Messages_To_Zero()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
+ ProviderType = "ProviderType Foo",
},
new PullRequestDiscussionThread(
1,
@@ -606,12 +609,12 @@ public void Should_Limit_Messages_To_Zero()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
});
// Then
@@ -627,7 +630,7 @@ public void Should_Ignore_Limit_When_Negative()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: -3));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: -3));
var newIssue1 =
IssueBuilder
@@ -650,7 +653,7 @@ public void Should_Ignore_Limit_When_Negative()
fixture.FilterIssues(
new List
{
- newIssue1, newIssue2
+ newIssue1, newIssue2,
},
new Dictionary(),
new List
@@ -664,11 +667,11 @@ public void Should_Ignore_Limit_When_Negative()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
+ ProviderType = "ProviderType Foo",
},
new PullRequestDiscussionThread(
1,
@@ -679,12 +682,12 @@ public void Should_Ignore_Limit_When_Negative()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
});
// Then
@@ -700,7 +703,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
var issue1 =
IssueBuilder
@@ -730,7 +733,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3
+ issue1, issue2, issue3,
},
new Dictionary(),
new List
@@ -744,12 +747,12 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
});
// Then
@@ -766,7 +769,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
var issue1 =
IssueBuilder
@@ -804,7 +807,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary(),
new List
@@ -818,12 +821,12 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
});
// Then
@@ -843,10 +846,10 @@ public void Should_Limit_Messages_To_Maximum()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
var issue1 =
IssueBuilder
@@ -882,7 +885,7 @@ public void Should_Limit_Messages_To_Maximum()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -902,10 +905,10 @@ public void Should_Limit_Messages_To_Zero()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 0));
+ new ProviderIssueLimits(maxIssuesToPost: 0));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 0));
+ new ProviderIssueLimits(maxIssuesToPost: 0));
var issue1 =
IssueBuilder
@@ -941,7 +944,7 @@ public void Should_Limit_Messages_To_Zero()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -959,10 +962,10 @@ public void Should_Ignore_Limit_When_Negative()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: -3));
+ new ProviderIssueLimits(maxIssuesToPost: -3));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: -1));
+ new ProviderIssueLimits(maxIssuesToPost: -1));
var issue1 =
IssueBuilder
@@ -998,7 +1001,7 @@ public void Should_Ignore_Limit_When_Negative()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -1017,10 +1020,10 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
var issue1 =
IssueBuilder
@@ -1056,7 +1059,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -1075,10 +1078,10 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
var issue1 =
IssueBuilder
@@ -1112,7 +1115,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -1131,10 +1134,10 @@ public void Should_Limit_Messages_To_Maximum_With_Different_Maximum_Limits()
var fixture = new IssueFiltererFixture();
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 3));
+ new ProviderIssueLimits(maxIssuesToPost: 3));
var issue1 =
IssueBuilder
@@ -1205,7 +1208,7 @@ public void Should_Limit_Messages_To_Maximum_With_Different_Maximum_Limits()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4, issue5, issue6, issue7, issue8, issue9
+ issue1, issue2, issue3, issue4, issue5, issue6, issue7, issue8, issue9,
},
new Dictionary());
@@ -1246,7 +1249,7 @@ public void Should_Limit_Messages_To_Maximum()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary(),
new List
@@ -1260,9 +1263,9 @@ public void Should_Limit_Messages_To_Maximum()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
- })
+ IsDeleted = false,
+ },
+ }),
});
// Then
@@ -1298,7 +1301,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary(),
new List
@@ -1312,9 +1315,9 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
- })
+ IsDeleted = false,
+ },
+ }),
});
// Then
@@ -1349,7 +1352,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
fixture.FilterIssues(
new List
{
- issue1, issue2
+ issue1, issue2,
},
new Dictionary(),
new List
@@ -1363,9 +1366,9 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
- })
+ IsDeleted = false,
+ },
+ }),
});
// Then
@@ -1418,7 +1421,7 @@ public void Should_Limit_Messages_To_Maximum()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -1471,7 +1474,7 @@ public void Should_Limit_Messages_To_Maximum_By_Priority()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
@@ -1522,7 +1525,7 @@ public void Should_Limit_Messages_To_Maximum_By_FilePath()
fixture.FilterIssues(
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
},
new Dictionary());
diff --git a/src/Cake.Issues.PullRequests.Tests/OrchestratorTests.cs b/src/Cake.Issues.PullRequests.Tests/OrchestratorTests.cs
index 971e4354d..2873cfacc 100644
--- a/src/Cake.Issues.PullRequests.Tests/OrchestratorTests.cs
+++ b/src/Cake.Issues.PullRequests.Tests/OrchestratorTests.cs
@@ -17,7 +17,7 @@ public void Should_Throw_If_Log_Is_Null()
// Given
var fixture = new OrchestratorForIssuesFixture()
{
- Log = null
+ Log = null,
};
var issues = new List();
@@ -62,7 +62,7 @@ public void Should_Throw_If_Pull_Request_System_Is_Null()
// Given
var fixture = new OrchestratorForIssuesFixture
{
- PullRequestSystem = null
+ PullRequestSystem = null,
};
var issues = new List();
@@ -79,7 +79,7 @@ public void Should_Throw_If_Settings_Are_Null()
// Given
var fixture = new OrchestratorForIssuesFixture
{
- Settings = null
+ Settings = null,
};
var issues = new List();
@@ -128,7 +128,7 @@ public void Should_Throw_If_Log_Is_Null()
// Given
var fixture = new OrchestratorForIssueProvidersFixture()
{
- Log = null
+ Log = null,
};
// When
@@ -144,7 +144,7 @@ public void Should_Throw_If_Issue_Provider_List_Is_Null()
// Given
var fixture = new OrchestratorForIssueProvidersFixture
{
- IssueProviders = null
+ IssueProviders = null,
};
// When
@@ -189,7 +189,7 @@ public void Should_Throw_If_Pull_Request_System_Is_Null()
// Given
var fixture = new OrchestratorForIssueProvidersFixture
{
- PullRequestSystem = null
+ PullRequestSystem = null,
};
// When
@@ -205,7 +205,7 @@ public void Should_Throw_If_Settings_Are_Null()
// Given
var fixture = new OrchestratorForIssueProvidersFixture
{
- Settings = null
+ Settings = null,
};
// When
@@ -251,7 +251,7 @@ public void Should_Post_Issue()
fixture.Log,
new List
{
- issueToPost
+ issueToPost,
}));
// When
@@ -262,7 +262,7 @@ public void Should_Post_Issue()
fixture.Log.Entries.ShouldContain(
x =>
x.Message ==
- $"Posting 1 issue(s):\n Rule: {issueToPost.Rule} Line: {issueToPost.Line} File: {issueToPost.AffectedFileRelativePath}");
+ $"Posting 1 issue(s):\n Rule: {issueToPost.RuleId} Line: {issueToPost.Line} File: {issueToPost.AffectedFileRelativePath}");
}
[Fact]
@@ -284,7 +284,7 @@ public void Should_Post_Issue_Not_Related_To_A_File()
fixture.Log,
new List
{
- issueToPost
+ issueToPost,
}));
// When
@@ -295,7 +295,7 @@ public void Should_Post_Issue_Not_Related_To_A_File()
fixture.Log.Entries.ShouldContain(
x =>
x.Message ==
- $"Posting 1 issue(s):\n Rule: {issueToPost.Rule} Line: {issueToPost.Line} File: {issueToPost.AffectedFileRelativePath}");
+ $"Posting 1 issue(s):\n Rule: {issueToPost.RuleId} Line: {issueToPost.Line} File: {issueToPost.AffectedFileRelativePath}");
}
[Fact]
@@ -325,7 +325,7 @@ public void Should_Return_Correct_Values()
fixture.Log,
new List
{
- postedIssue, reportedIssue
+ postedIssue, reportedIssue,
}));
fixture.Settings.MaxIssuesToPost = 1;
@@ -369,7 +369,7 @@ public void Should_Return_Reported_Issues_If_PullRequestSystem_Could_Not_Be_Init
fixture.Log,
new List
{
- firstIssue, secondIssue
+ firstIssue, secondIssue,
}));
fixture.Settings.MaxIssuesToPost = 1;
@@ -411,7 +411,7 @@ public void Should_Limit_Messages_To_Global_Maximum()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPost = 1;
@@ -454,7 +454,7 @@ public void Should_Limit_Messages_To_Global_Maximum_By_Priority()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPost = 1;
@@ -496,7 +496,7 @@ public void Should_Limit_Messages_To_Global_Maximum_By_FilePath()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPost = 1;
@@ -553,7 +553,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider()
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.MaxIssuesToPostForEachIssueProvider = 1;
@@ -612,7 +612,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_Priority()
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.MaxIssuesToPostForEachIssueProvider = 1;
@@ -669,7 +669,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath()
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.MaxIssuesToPostForEachIssueProvider = 1;
@@ -688,7 +688,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath()
}
[Fact]
- public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_ProviderIssueIssueLimits()
+ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_ProviderIssueLimits()
{
// Given
var issue1 =
@@ -728,15 +728,15 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_ProviderIssueIss
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
// When
var result = fixture.RunOrchestrator();
@@ -752,7 +752,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_ProviderIssueIss
}
[Fact]
- public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_Priority_ProviderIssueIssueLimits()
+ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_Priority_ProviderIssueLimits()
{
// Given
var issue1 =
@@ -792,15 +792,15 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_Priority_Prov
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
// When
var result = fixture.RunOrchestrator();
@@ -816,7 +816,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_Priority_Prov
}
[Fact]
- public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath_ProviderIssueIssueLimits()
+ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath_ProviderIssueLimits()
{
// Given
var issue1 =
@@ -854,15 +854,15 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath_Prov
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4
+ issue1, issue2, issue3, issue4,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
// When
var result = fixture.RunOrchestrator();
@@ -878,7 +878,7 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_By_FilePath_Prov
}
[Fact]
- public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_With_Different_Limits_For_Each_ProviderProviderIssueIssueLimits()
+ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_With_Different_Limits_For_Each_ProviderIssueLimits()
{
// Given
var issue1 =
@@ -953,15 +953,15 @@ public void Should_Limit_Messages_To_Maximum_Per_Issue_Provider_With_Different_L
fixture.Log,
new List
{
- issue1, issue2, issue3, issue4, issue5, issue6, issue7, issue8, issue9
+ issue1, issue2, issue3, issue4, issue5, issue6, issue7, issue8, issue9,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeA",
- new ProviderIssueIssueLimits(maxIssuesToPost: 1));
+ new ProviderIssueLimits(maxIssuesToPost: 1));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderTypeB",
- new ProviderIssueIssueLimits(maxIssuesToPost: 3));
+ new ProviderIssueLimits(maxIssuesToPost: 3));
// When
var result = fixture.RunOrchestrator();
@@ -1001,7 +1001,7 @@ public void Should_Skip_Posting_If_Commit_Is_Outdate()
fixture.Log,
new List
{
- issueToPost
+ issueToPost,
}));
fixture.PullRequestSystem.CheckingCommitIdCapability.LastSourceCommitId =
@@ -1051,7 +1051,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 1;
@@ -1098,7 +1098,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_By_Priority()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 1;
@@ -1145,7 +1145,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_By_FilePath()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 1;
@@ -1203,11 +1203,11 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Unresolved_Issues_
new PullRequestDiscussionComment
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- CommentIdentifier = "Message Foo"
+ CommentIdentifier = "Message Foo",
},
new PullRequestDiscussionThread(
2,
@@ -1218,12 +1218,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Unresolved_Issues_
new PullRequestDiscussionComment
{
Content = "Message Bar",
- IsDeleted = false
+ IsDeleted = false,
},
})
{
- CommentIdentifier = "Message Bar"
- }
+ CommentIdentifier = "Message Bar",
+ },
}));
fixture.IssueProviders.Clear();
@@ -1232,7 +1232,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Unresolved_Issues_
fixture.Log,
new List
{
- issue1, issue2, issue3
+ issue1, issue2, issue3,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 2;
@@ -1282,14 +1282,14 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Unresolved_Issues_
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
+ IsDeleted = false,
},
new PullRequestDiscussionComment
{
Content = "Additional comment",
- IsDeleted = false
- }
- })
+ IsDeleted = false,
+ },
+ }),
}));
fixture.IssueProviders.Clear();
@@ -1298,7 +1298,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Unresolved_Issues_
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 2;
@@ -1349,9 +1349,9 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Resolved_Issues_Fr
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
- })
+ IsDeleted = false,
+ },
+ }),
}));
fixture.IssueProviders.Clear();
@@ -1360,7 +1360,7 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_With_Resolved_Issues_Fr
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.MaxIssuesToPostAcrossRuns = 2;
@@ -1417,12 +1417,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2, issue3
+ issue1, issue2, issue3,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 1));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 1));
// When
var result = fixture.RunOrchestrator();
@@ -1466,12 +1466,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 1));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 1));
// When
var result = fixture.RunOrchestrator();
@@ -1523,12 +1523,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2, issue3
+ issue1, issue2, issue3,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 1));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 1));
// When
var result = fixture.RunOrchestrator();
@@ -1583,12 +1583,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
new PullRequestDiscussionComment
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
- ProviderType = "ProviderType Foo"
+ ProviderType = "ProviderType Foo",
},
new PullRequestDiscussionThread(
2,
@@ -1599,13 +1599,13 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
new PullRequestDiscussionComment
{
Content = "Message Bar",
- IsDeleted = false
+ IsDeleted = false,
},
})
{
CommentIdentifier = "Message Bar",
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
}));
fixture.IssueProviders.Clear();
@@ -1614,12 +1614,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2, issue3
+ issue1, issue2, issue3,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
// When
var result = fixture.RunOrchestrator();
@@ -1666,17 +1666,17 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
+ IsDeleted = false,
},
new PullRequestDiscussionComment
{
Content = "Additional comment",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
}));
fixture.IssueProviders.Clear();
@@ -1685,12 +1685,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
// When
var result = fixture.RunOrchestrator();
@@ -1738,12 +1738,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
new PullRequestDiscussionComment
{
Content = "Message FooBar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- ProviderType = "ProviderType Foo"
- }
+ ProviderType = "ProviderType Foo",
+ },
}));
fixture.IssueProviders.Clear();
@@ -1752,12 +1752,12 @@ public void Should_Limit_Messages_To_Maximum_Across_Runs_For_A_Specific_Provider
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
fixture.Settings.ProviderIssueLimits.Add(
"ProviderType Foo",
- new ProviderIssueIssueLimits(maxIssuesToPostAcrossRuns: 2));
+ new ProviderIssueLimits(maxIssuesToPostAcrossRuns: 2));
// When
var result = fixture.RunOrchestrator();
@@ -1805,13 +1805,13 @@ public void Should_Ignore_Issues_Already_Present_In_Active_Comment()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = settings.CommentSource,
- }
+ },
}));
fixture.IssueProviders.Clear();
@@ -1820,7 +1820,7 @@ public void Should_Ignore_Issues_Already_Present_In_Active_Comment()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
// When
@@ -1876,14 +1876,14 @@ public void Should_Ignore_Issues_Already_Present_In_WontFix_Comment()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = settings.CommentSource,
- Resolution = PullRequestDiscussionResolution.WontFix
- }
+ Resolution = PullRequestDiscussionResolution.WontFix,
+ },
}));
fixture.IssueProviders.Clear();
@@ -1892,7 +1892,7 @@ public void Should_Ignore_Issues_Already_Present_In_WontFix_Comment()
fixture.Log,
new List
{
- issue1, issue2
+ issue1, issue2,
}));
// When
@@ -1946,13 +1946,13 @@ public void Should_Ignore_Issues_Already_Present_Not_Related_To_A_File()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = settings.CommentSource,
- }
+ },
}));
fixture.IssueProviders.Clear();
@@ -1962,7 +1962,7 @@ public void Should_Ignore_Issues_Already_Present_Not_Related_To_A_File()
new List
{
issue1,
- issue2
+ issue2,
}));
// When
@@ -2011,13 +2011,13 @@ public void Should_Only_Ignore_Issues_With_Same_Comment_Source()
new PullRequestDiscussionComment()
{
Content = "Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Foo",
CommentSource = "DifferentCommentSource",
- }
+ },
}));
fixture.IssueProviders.Clear();
@@ -2026,7 +2026,7 @@ public void Should_Only_Ignore_Issues_With_Same_Comment_Source()
fixture.Log,
new List
{
- issue
+ issue,
}));
// When
@@ -2066,13 +2066,13 @@ public void Should_Resolve_Closed_Issues()
new PullRequestDiscussionComment()
{
Content = "Bar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Bar",
- CommentSource = settings.CommentSource
- }
+ CommentSource = settings.CommentSource,
+ },
}));
var threadToResolve =
@@ -2089,7 +2089,7 @@ public void Should_Resolve_Closed_Issues()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2119,13 +2119,13 @@ public void Should_Only_Resolve_Issues_From_Same_Comment_Source()
new PullRequestDiscussionComment()
{
Content = "Bar",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Bar",
- CommentSource = "DifferentCommentSource"
- }
+ CommentSource = "DifferentCommentSource",
+ },
}));
var threadToResolve =
@@ -2142,7 +2142,7 @@ public void Should_Only_Resolve_Issues_From_Same_Comment_Source()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2171,14 +2171,14 @@ public void Should_Reopen_Still_Active_Issues()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = settings.CommentSource,
- Resolution = PullRequestDiscussionResolution.Resolved
- }
+ Resolution = PullRequestDiscussionResolution.Resolved,
+ },
}));
var threadToReopen =
@@ -2195,7 +2195,7 @@ public void Should_Reopen_Still_Active_Issues()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2225,14 +2225,14 @@ public void Should_Only_Reopen_Still_Active_Issues_From_Same_Comment_Source()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
CommentIdentifier = "Message Foo",
CommentSource = "DifferentCommentSource",
- Resolution = PullRequestDiscussionResolution.Resolved
- }
+ Resolution = PullRequestDiscussionResolution.Resolved,
+ },
}));
var threadToReopen =
@@ -2249,7 +2249,7 @@ public void Should_Only_Reopen_Still_Active_Issues_From_Same_Comment_Source()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2280,7 +2280,7 @@ public void Should_Not_Throw_If_No_Existing_Threads()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2310,12 +2310,12 @@ public void Should_Output_A_Warning_If_Unknown_Thread_Status()
new PullRequestDiscussionComment()
{
Content = "Message Foo",
- IsDeleted = false
- }
+ IsDeleted = false,
+ },
})
{
- CommentIdentifier = "Message Foo"
- }
+ CommentIdentifier = "Message Foo",
+ },
}));
var threadToReopen =
@@ -2332,7 +2332,7 @@ public void Should_Output_A_Warning_If_Unknown_Thread_Status()
.InFile(@"src\Cake.Issues.Tests\FakeIssueProvider.cs", 10)
.OfRule("Rule Foo")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
@@ -2370,7 +2370,7 @@ public void Should_Ignore_Issues_If_File_Is_Not_Modified()
.WithFilteringByModifiedFilesCapability(
new List
{
- new FilePath(@"src\Cake.Issues.Tests\FakeIssueProvider.cs")
+ new FilePath(@"src\Cake.Issues.Tests\FakeIssueProvider.cs"),
}));
fixture.IssueProviders.Clear();
@@ -2380,7 +2380,7 @@ public void Should_Ignore_Issues_If_File_Is_Not_Modified()
new List
{
issue1,
- issue2
+ issue2,
}));
// When
@@ -2427,7 +2427,7 @@ public void Should_Log_Message_If_All_Issues_Are_Filtered()
.InFile(@"src\Cake.Issues.Tests\NotModified.cs", 10)
.OfRule("Rule Bar")
.WithPriority(IssuePriority.Warning)
- .Create()
+ .Create(),
}));
// When
diff --git a/src/Cake.Issues.PullRequests.Tests/PullRequestDiscussionThreadTests.cs b/src/Cake.Issues.PullRequests.Tests/PullRequestDiscussionThreadTests.cs
index 0aa817695..06343acf0 100644
--- a/src/Cake.Issues.PullRequests.Tests/PullRequestDiscussionThreadTests.cs
+++ b/src/Cake.Issues.PullRequests.Tests/PullRequestDiscussionThreadTests.cs
@@ -94,16 +94,16 @@ public void Should_Set_Comments()
var comments =
new List
{
- new PullRequestDiscussionComment
- {
- Content = "Foo",
- IsDeleted = false
- },
- new PullRequestDiscussionComment
- {
- Content = "Bar",
- IsDeleted = true
- }
+ new PullRequestDiscussionComment
+ {
+ Content = "Foo",
+ IsDeleted = false,
+ },
+ new PullRequestDiscussionComment
+ {
+ Content = "Bar",
+ IsDeleted = true,
+ },
};
// When
diff --git a/src/Cake.Issues.PullRequests/BasePullRequestSystem.cs b/src/Cake.Issues.PullRequests/BasePullRequestSystem.cs
index 2935a6b7f..dc9f8d369 100644
--- a/src/Cake.Issues.PullRequests/BasePullRequestSystem.cs
+++ b/src/Cake.Issues.PullRequests/BasePullRequestSystem.cs
@@ -10,7 +10,7 @@
public abstract class BasePullRequestSystem
: BaseIssueComponent, IPullRequestSystem
{
- private readonly List capabilities = new List();
+ private readonly List capabilities = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests/Cake.Issues.PullRequests.csproj b/src/Cake.Issues.PullRequests/Cake.Issues.PullRequests.csproj
index ecd399abf..992b6027d 100644
--- a/src/Cake.Issues.PullRequests/Cake.Issues.PullRequests.csproj
+++ b/src/Cake.Issues.PullRequests/Cake.Issues.PullRequests.csproj
@@ -1,6 +1,6 @@
- netstandard2.0
+ netcoreapp3.1;net5.0;net6.0
false
Cake.Issues
Copyright © BBT Software AG and contributors
@@ -10,24 +10,16 @@
+ bin\$(Configuration)\$(TargetFramework)\Cake.Issues.PullRequests.xml
full
true
AllEnabledByDefault
..\Cake.Issues.ruleset
-
- bin\Debug\netstandard2.0\Cake.Issues.PullRequests.xml
- latest
-
-
-
- bin\Release\netstandard2.0\Cake.Issues.PullRequests.xml
-
-
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Cake.Issues.PullRequests/ISupportFilteringByModifiedFiles.cs b/src/Cake.Issues.PullRequests/ISupportFilteringByModifiedFiles.cs
index 7a439b997..e3850289f 100644
--- a/src/Cake.Issues.PullRequests/ISupportFilteringByModifiedFiles.cs
+++ b/src/Cake.Issues.PullRequests/ISupportFilteringByModifiedFiles.cs
@@ -14,10 +14,6 @@ public interface ISupportFilteringByModifiedFiles
/// Returns a list of all files modified in a pull request.
///
/// List of all files modified in a pull request.
- [SuppressMessage(
- "Microsoft.Design",
- "CA1024:UsePropertiesWhereAppropriate",
- Justification = "Most probably will make a remote call")]
IEnumerable GetModifiedFilesInPullRequest();
}
}
diff --git a/src/Cake.Issues.PullRequests/IssueFilterer.cs b/src/Cake.Issues.PullRequests/IssueFilterer.cs
index c537c50ce..4e5121d2a 100644
--- a/src/Cake.Issues.PullRequests/IssueFilterer.cs
+++ b/src/Cake.Issues.PullRequests/IssueFilterer.cs
@@ -252,14 +252,29 @@ private IList FilterIssuesByNumber(
// Apply issue limits per provider for this run
foreach (var currentProviderLimitPair in this.settings.ProviderIssueLimits)
{
+ var currentProviderType = currentProviderLimitPair.Key;
+
+ this.log.Verbose(
+ "Applying filter for issue provider '{0}' for this run...",
+ currentProviderType);
+
var currentProviderTypeMaxLimit = currentProviderLimitPair.Value?.MaxIssuesToPost;
- if (!currentProviderTypeMaxLimit.HasValue ||
- currentProviderTypeMaxLimit < 0)
+ if (!currentProviderTypeMaxLimit.HasValue)
{
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' for this run since `MaxIssuesToPost` is not set",
+ currentProviderType);
continue;
}
- var currentProviderType = currentProviderLimitPair.Key;
+ if (currentProviderTypeMaxLimit < 0)
+ {
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' for this run since `MaxIssuesToPost` is set to '{1}'",
+ currentProviderType,
+ currentProviderTypeMaxLimit);
+ continue;
+ }
var newIssuesForProviderType =
result.Where(p => p.ProviderType == currentProviderType)
@@ -267,6 +282,11 @@ private IList FilterIssuesByNumber(
.ToArray();
if (newIssuesForProviderType.Length <= currentProviderTypeMaxLimit)
{
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' for this run since number of issues of this type is '{1}' which is less or equal to the value '{2}' configured in `MaxIssuesToPost`",
+ currentProviderType,
+ newIssuesForProviderType.Length,
+ currentProviderTypeMaxLimit);
continue;
}
@@ -304,14 +324,29 @@ private IList FilterIssuesByNumber(
// Apply issue limits per provider across mulitple runs
foreach (var currentProviderLimitPair in this.settings.ProviderIssueLimits)
{
+ var currentProviderType = currentProviderLimitPair.Key;
+
+ this.log.Verbose(
+ "Applying filter for issue provider '{0}' across mulitple runs...",
+ currentProviderType);
+
var currentProviderTypeMaxLimit = currentProviderLimitPair.Value?.MaxIssuesToPostAcrossRuns;
- if (!currentProviderTypeMaxLimit.HasValue ||
- currentProviderTypeMaxLimit < 0)
+ if (!currentProviderTypeMaxLimit.HasValue)
{
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' across mulitple runs since `MaxIssuesToPostAcrossRuns` is not set",
+ currentProviderType);
+ continue;
+ }
+
+ if (currentProviderTypeMaxLimit < 0)
+ {
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' across mulitple runs since `MaxIssuesToPostAcrossRuns` is not set",
+ currentProviderType);
continue;
}
- var currentProviderType = currentProviderLimitPair.Key;
var existingThreadCountForProvider =
existingThreads.Count(p => p.ProviderType == currentProviderType);
@@ -328,6 +363,11 @@ private IList FilterIssuesByNumber(
.ToArray();
if (newIssuesForProviderType.Length <= maxIssuesLeftToTakeForProviderType)
{
+ this.log.Verbose(
+ "No issues filtered for issue provider '{0}' across mulitple runs since number of issues of this type is '{1}' which is less or equal to the value '{2}' configured in `MaxIssuesToPostAcrossRuns`",
+ currentProviderType,
+ newIssuesForProviderType.Length,
+ maxIssuesLeftToTakeForProviderType);
continue;
}
diff --git a/src/Cake.Issues.PullRequests/Orchestrator.cs b/src/Cake.Issues.PullRequests/Orchestrator.cs
index 99d5d13cf..a46cbd08f 100644
--- a/src/Cake.Issues.PullRequests/Orchestrator.cs
+++ b/src/Cake.Issues.PullRequests/Orchestrator.cs
@@ -210,7 +210,7 @@ from issue in remainingIssues
string.Format(
CultureInfo.InvariantCulture,
" Rule: {0} Line: {1} File: {2}",
- issue.Rule,
+ issue.RuleId,
issue.Line,
issue.AffectedFileRelativePath);
diff --git a/src/Cake.Issues.PullRequests/ProviderIssueIssueLimits.cs b/src/Cake.Issues.PullRequests/ProviderIssueLimits.cs
similarity index 85%
rename from src/Cake.Issues.PullRequests/ProviderIssueIssueLimits.cs
rename to src/Cake.Issues.PullRequests/ProviderIssueLimits.cs
index d127a9a39..1d101ed50 100644
--- a/src/Cake.Issues.PullRequests/ProviderIssueIssueLimits.cs
+++ b/src/Cake.Issues.PullRequests/ProviderIssueLimits.cs
@@ -1,14 +1,14 @@
namespace Cake.Issues.PullRequests
{
///
- public class ProviderIssueIssueLimits : IProviderIssueLimits
+ public class ProviderIssueLimits : IProviderIssueLimits
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
/// Maximum amount of issues to be posted in a single run.
/// Maximum amount of issues to be posted across all runs.
- public ProviderIssueIssueLimits(
+ public ProviderIssueLimits(
int? maxIssuesToPost = null,
int? maxIssuesToPostAcrossRuns = null)
{
diff --git a/src/Cake.Issues.PullRequests/PullRequestDiscussionResolution.cs b/src/Cake.Issues.PullRequests/PullRequestDiscussionResolution.cs
index 1c6abeb27..8bf4cc411 100644
--- a/src/Cake.Issues.PullRequests/PullRequestDiscussionResolution.cs
+++ b/src/Cake.Issues.PullRequests/PullRequestDiscussionResolution.cs
@@ -18,6 +18,6 @@ public enum PullRequestDiscussionResolution
///
/// Discussion is marked as won't fix.
///
- WontFix
+ WontFix,
}
}
diff --git a/src/Cake.Issues.PullRequests/PullRequestDiscussionStatus.cs b/src/Cake.Issues.PullRequests/PullRequestDiscussionStatus.cs
index 310b1fe23..98d97fdbf 100644
--- a/src/Cake.Issues.PullRequests/PullRequestDiscussionStatus.cs
+++ b/src/Cake.Issues.PullRequests/PullRequestDiscussionStatus.cs
@@ -18,6 +18,6 @@ public enum PullRequestDiscussionStatus
///
/// Discussion is resolved.
///
- Resolved
+ Resolved,
}
}
diff --git a/src/Cake.Issues.PullRequests/PullRequestDiscussionThread.cs b/src/Cake.Issues.PullRequests/PullRequestDiscussionThread.cs
index d7f9d8d57..4dc8f8665 100644
--- a/src/Cake.Issues.PullRequests/PullRequestDiscussionThread.cs
+++ b/src/Cake.Issues.PullRequests/PullRequestDiscussionThread.cs
@@ -9,7 +9,7 @@
///
public class PullRequestDiscussionThread : IPullRequestDiscussionThread
{
- private readonly List comments = new List();
+ private readonly List comments = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests/PullRequestIssueResult.cs b/src/Cake.Issues.PullRequests/PullRequestIssueResult.cs
index ee2df96b8..15d6ce1d8 100644
--- a/src/Cake.Issues.PullRequests/PullRequestIssueResult.cs
+++ b/src/Cake.Issues.PullRequests/PullRequestIssueResult.cs
@@ -7,8 +7,8 @@
///
public class PullRequestIssueResult
{
- private readonly List reportedIssues = new List();
- private readonly List postedIssues = new List();
+ private readonly List reportedIssues = new ();
+ private readonly List postedIssues = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestFromIssueProviderSettings.cs b/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestFromIssueProviderSettings.cs
index 198be6c24..7142849c8 100644
--- a/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestFromIssueProviderSettings.cs
+++ b/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestFromIssueProviderSettings.cs
@@ -12,8 +12,7 @@ public class ReportIssuesToPullRequestFromIssueProviderSettings : ReadIssuesSett
#pragma warning disable SA1124 // Do not use regions
#region DupFinder Exclusion
#pragma warning restore SA1124 // Do not use regions
- private readonly List, IEnumerable>> issueFilters =
- new List, IEnumerable>>();
+ private readonly List, IEnumerable>> issueFilters = new ();
#endregion
///
diff --git a/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestSettings.cs b/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestSettings.cs
index 2377518a2..89829cfe3 100644
--- a/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestSettings.cs
+++ b/src/Cake.Issues.PullRequests/ReportIssuesToPullRequestSettings.cs
@@ -12,8 +12,7 @@ public class ReportIssuesToPullRequestSettings : RepositorySettings, IReportIssu
#pragma warning disable SA1124 // Do not use regions
#region DupFinder Exclusion
#pragma warning restore SA1124 // Do not use regions
- private readonly List, IEnumerable>> issueFilters =
- new List, IEnumerable>>();
+ private readonly List, IEnumerable>> issueFilters = new ();
#endregion
///
diff --git a/src/Cake.Issues.Reporting.Tests/Cake.Issues.Reporting.Tests.csproj b/src/Cake.Issues.Reporting.Tests/Cake.Issues.Reporting.Tests.csproj
index f31657cbb..77f507ab6 100644
--- a/src/Cake.Issues.Reporting.Tests/Cake.Issues.Reporting.Tests.csproj
+++ b/src/Cake.Issues.Reporting.Tests/Cake.Issues.Reporting.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1
false
Copyright © BBT Software AG and contributors
Tests for the Cake.Issues.Reporting addin
@@ -14,9 +14,9 @@
-
-
-
+
+
+
diff --git a/src/Cake.Issues.Reporting/Cake.Issues.Reporting.csproj b/src/Cake.Issues.Reporting/Cake.Issues.Reporting.csproj
index a102b2464..de1daf659 100644
--- a/src/Cake.Issues.Reporting/Cake.Issues.Reporting.csproj
+++ b/src/Cake.Issues.Reporting/Cake.Issues.Reporting.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ netcoreapp3.1;net5.0;net6.0
Addin for the Cake build automation system for creating reports for issues from any code analyzer or linter
BBT Software AG and contributors
BBT Software AG and contributors
@@ -10,6 +10,7 @@
+ bin\$(Configuration)\$(TargetFramework)\Cake.Issues.Reporting.xml
full
true
AllEnabledByDefault
@@ -17,17 +18,9 @@
true
-
- bin\Debug\netstandard2.0\Cake.Issues.Reporting.xml
-
-
-
- bin\Release\netstandard2.0\Cake.Issues.Reporting.xml
-
-
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj b/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj
index 1547586aa..1184f85d6 100644
--- a/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj
+++ b/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ netcoreapp3.1;net5.0;net6.0
Common helpers for testing addins based on Cake.Issues
BBT Software AG
BBT Software AG
@@ -10,24 +10,17 @@
+ bin\$(Configuration)\$(TargetFramework)\Cake.Issues.Testing.xml
full
true
AllEnabledByDefault
..\Cake.Issues.ruleset
-
- bin\Debug\netstandard2.0\Cake.Issues.Testing.xml
-
-
-
- bin\Release\netstandard2.0\Cake.Issues.Testing.xml
-
-
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Cake.Issues.Testing/ExceptionAssertExtensions.cs b/src/Cake.Issues.Testing/ExceptionAssertExtensions.cs
index 1b6a9c2e9..cf1713d37 100644
--- a/src/Cake.Issues.Testing/ExceptionAssertExtensions.cs
+++ b/src/Cake.Issues.Testing/ExceptionAssertExtensions.cs
@@ -81,7 +81,7 @@ private static T CheckExceptionType(this Exception exception)
throw new Exception($"Expected exception of type '{typeof(T)}' but no exception was thrown.");
}
- if (!(exception is T typedException))
+ if (exception is not T typedException)
{
throw new Exception($"Expected exception of type '{typeof(T)}' but was '{exception.GetType()}'.");
}
diff --git a/src/Cake.Issues.Testing/FakeConfigurableIssueProvider.cs b/src/Cake.Issues.Testing/FakeConfigurableIssueProvider.cs
index 4330764da..7662c7803 100644
--- a/src/Cake.Issues.Testing/FakeConfigurableIssueProvider.cs
+++ b/src/Cake.Issues.Testing/FakeConfigurableIssueProvider.cs
@@ -9,7 +9,7 @@
public class FakeConfigurableIssueProvider
: BaseConfigurableIssueProvider
{
- private readonly List issues = new List();
+ private readonly List issues = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.Testing/FakeIssueProvider.cs b/src/Cake.Issues.Testing/FakeIssueProvider.cs
index ae83e6481..ccba214f7 100644
--- a/src/Cake.Issues.Testing/FakeIssueProvider.cs
+++ b/src/Cake.Issues.Testing/FakeIssueProvider.cs
@@ -8,7 +8,7 @@
///
public class FakeIssueProvider : BaseIssueProvider
{
- private readonly List issues = new List();
+ private readonly List issues = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.Testing/FakeLogFileFormat.cs b/src/Cake.Issues.Testing/FakeLogFileFormat.cs
index 6d1dbfc90..8b69b7e7c 100644
--- a/src/Cake.Issues.Testing/FakeLogFileFormat.cs
+++ b/src/Cake.Issues.Testing/FakeLogFileFormat.cs
@@ -8,7 +8,7 @@
///
public class FakeLogFileFormat : BaseLogFileFormat
{
- private readonly List issues = new List();
+ private readonly List issues = new ();
///
/// Initializes a new instance of the class.
diff --git a/src/Cake.Issues.Testing/FakeRuleUrlResolver.cs b/src/Cake.Issues.Testing/FakeRuleUrlResolver.cs
index 692e2739d..ef02d7ceb 100644
--- a/src/Cake.Issues.Testing/FakeRuleUrlResolver.cs
+++ b/src/Cake.Issues.Testing/FakeRuleUrlResolver.cs
@@ -8,7 +8,6 @@ public class FakeRuleUrlResolver : BaseRuleUrlResolver
///
protected override bool TryGetRuleDescription(string rule, FakeRuleDescription ruleDescription)
{
- ruleDescription = new FakeRuleDescription { Rule = rule };
return true;
}
}
diff --git a/src/Cake.Issues.Testing/IssueChecker.cs b/src/Cake.Issues.Testing/IssueChecker.cs
index 474c06209..c9e7b5dd5 100644
--- a/src/Cake.Issues.Testing/IssueChecker.cs
+++ b/src/Cake.Issues.Testing/IssueChecker.cs
@@ -58,7 +58,8 @@ public static void Check(
expectedIssue.MessageMarkdown,
expectedIssue.Priority,
expectedIssue.PriorityName,
- expectedIssue.Rule,
+ expectedIssue.RuleId,
+ expectedIssue.RuleName,
expectedIssue.RuleUrl,
expectedIssue.AdditionalInformation);
}
@@ -94,8 +95,10 @@ public static void Check(
/// null if no priority is expected.
/// Expected priority name.
/// null or if no priority is expected.
- /// Expected rule identifier.
+ /// Expected rule identifier.
/// null or if no rule identifier is expected.
+ /// Expected name of the rule.
+ /// null or if no rule is expected.
/// Expected URL containing information about the failing rule.
/// null if no rule Url is expected.
/// Custom information regarding the issue.
@@ -118,7 +121,8 @@ public static void Check(
string messageMarkdown,
int? priority,
string priorityName,
- string rule,
+ string ruleId,
+ string ruleName,
Uri ruleUrl,
IReadOnlyDictionary additionalInformation)
{
@@ -260,10 +264,16 @@ public static void Check(
$"Expected issue.PriorityName to be '{priorityName}' but was '{issue.PriorityName}'.");
}
- if (issue.Rule != rule)
+ if (issue.RuleId != ruleId)
{
throw new Exception(
- $"Expected issue.Rule to be '{rule}' but was '{issue.Rule}'.");
+ $"Expected issue.RuleId to be '{ruleId}' but was '{issue.RuleId}'.");
+ }
+
+ if (issue.RuleName != ruleName)
+ {
+ throw new Exception(
+ $"Expected issue.RuleName to be '{ruleName}' but was '{issue.RuleName}'.");
}
if (issue.RuleUrl?.ToString() != ruleUrl?.ToString())
diff --git a/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj b/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj
index 299740320..94090792d 100644
--- a/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj
+++ b/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.1
+ netcoreapp3.1
false
Cake.Issues
Copyright © BBT Software AG and contributors
@@ -25,9 +25,9 @@
-
-
-
+
+
+
all
diff --git a/src/Cake.Issues.Tests/IIssueExtensionsTests.cs b/src/Cake.Issues.Tests/IIssueExtensionsTests.cs
index 29f448efd..faf1af023 100644
--- a/src/Cake.Issues.Tests/IIssueExtensionsTests.cs
+++ b/src/Cake.Issues.Tests/IIssueExtensionsTests.cs
@@ -349,6 +349,62 @@ public void Should_Return_Null_If_File_Is_Not_Set()
}
}
+ public sealed class TheRuleExtension
+ {
+ [Fact]
+ public void Should_Throw_If_Issue_Is_Null()
+ {
+ // Given
+ IIssue issue = null;
+
+ // When
+ var result = Record.Exception(() => issue.Rule());
+
+ // Then
+ result.IsArgumentNullException("issue");
+ }
+
+ [Fact]
+ public void Should_Return_RuleName_If_Set()
+ {
+ // Given
+ var ruleId = "RuleId";
+ var ruleName = "RuleName";
+ var issue =
+ IssueBuilder
+ .NewIssue("Message Foo", "ProviderType Foo", "ProviderName Foo")
+ .OfRule(ruleId, ruleName)
+ .Create();
+
+ // When
+ var result = issue.Rule();
+
+ // Then
+ result.ShouldBe(ruleName);
+ }
+
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData(" ")]
+ public void Should_Return_RuleId_If_RuleName_Not_Set(string ruleName)
+ {
+ // Given
+ var ruleId = "RuleId";
+ var issue =
+ IssueBuilder
+ .NewIssue("Message Foo", "ProviderType Foo", "ProviderName Foo")
+ .OfRule(ruleId, ruleName)
+ .Create();
+
+ // When
+ var result = issue.Rule();
+
+ // Then
+ result.ShouldBe(ruleId);
+ }
+ }
+
public sealed class TheReplaceIssuePatternExtension
{
[Fact]
@@ -404,7 +460,7 @@ public void Should_Throw_If_Issue_Is_Null()
[InlineData("foo {Column} bar", "foo 23 bar")]
[InlineData("foo {EndColumn} bar", "foo 230 bar")]
[InlineData("foo {FileLink} bar", "foo https://github.com/myorg/myrepo/blob/develop/src/foo.cs#L10-L12 bar")]
- [InlineData("foo {Rule} bar", "foo Rule Foo bar")]
+ [InlineData("foo {RuleId} bar", "foo Rule Foo bar")]
[InlineData("foo {RuleUrl} bar", "foo https://google.com/ bar")]
[InlineData("foo {MessageText} bar", "foo MessageText Foo bar")]
[InlineData("foo {MessageHtml} bar", "foo MessageHtml Foo bar")]
diff --git a/src/Cake.Issues.Tests/IssueBuilderTests.cs b/src/Cake.Issues.Tests/IssueBuilderTests.cs
index a09fb03b0..03586055e 100644
--- a/src/Cake.Issues.Tests/IssueBuilderTests.cs
+++ b/src/Cake.Issues.Tests/IssueBuilderTests.cs
@@ -1809,107 +1809,224 @@ public void Should_Set_Priority(IssuePriority issuePriority, int expectedPriorit
}
}
- public sealed class TheOfRuleMethod
+ public sealed class TheOfRuleWithRuleIdMethod
{
[Fact]
- public void Should_Handle_Rules_Which_Are_Null()
+ public void Should_Handle_RulesIds_Which_Are_Null()
{
// Given
var fixture = new IssueBuilderFixture();
- string rule = null;
+ string ruleId = null;
// When
- var issue = fixture.IssueBuilder.OfRule(rule).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId).Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
[Fact]
- public void Should_Handle_Rules_Which_Are_Empty()
+ public void Should_Handle_RulesIds_Which_Are_Empty()
{
// Given
var fixture = new IssueBuilderFixture();
- var rule = string.Empty;
+ var ruleId = string.Empty;
// When
- var issue = fixture.IssueBuilder.OfRule(rule).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId).Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
[Fact]
- public void Should_Handle_Rules_Which_Are_WhiteSpace()
+ public void Should_Handle_RulesIds_Which_Are_WhiteSpace()
{
// Given
var fixture = new IssueBuilderFixture();
- var rule = " ";
+ var ruleId = " ";
// When
- var issue = fixture.IssueBuilder.OfRule(rule).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId).Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
[Theory]
[InlineData("rule")]
- public void Should_Set_Rule(string rule)
+ public void Should_Set_RuleId(string ruleId)
{
// Given
var fixture = new IssueBuilderFixture();
// When
- var issue = fixture.IssueBuilder.OfRule(rule).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId).Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
}
- public sealed class TheOfRuleWithUriMethod
+ public sealed class TheOfRuleWithRuleIdAndNameMethod
{
[Fact]
- public void Should_Handle_Names_Which_Are_Null()
+ public void Should_Handle_RuleIds_Which_Are_Null()
{
// Given
var fixture = new IssueBuilderFixture();
- string rule = null;
+ string ruleId = null;
// When
- var issue = fixture.IssueBuilder.OfRule(rule, new Uri("https://google.com")).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule").Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
[Fact]
- public void Should_Handle_Name_Which_Are_Empty()
+ public void Should_Handle_RuleIds_Which_Are_Empty()
{
// Given
var fixture = new IssueBuilderFixture();
- var rule = string.Empty;
+ var ruleId = string.Empty;
// When
- var issue = fixture.IssueBuilder.OfRule(rule, new Uri("https://google.com")).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule").Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
}
[Fact]
- public void Should_Handle_Names_Which_Are_WhiteSpace()
+ public void Should_Handle_RuleIds_Which_Are_WhiteSpace()
{
// Given
var fixture = new IssueBuilderFixture();
- var rule = " ";
+ var ruleId = " ";
// When
- var issue = fixture.IssueBuilder.OfRule(rule, new Uri("https://google.com")).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule").Create();
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_Null()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ string ruleName = null;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_Empty()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = string.Empty;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_WhiteSpace()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = " ";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+
+ [Theory]
+ [InlineData("ruleId")]
+ public void Should_Set_Rule(string ruleId)
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = "Some Rule";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, ruleName).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Theory]
+ [InlineData("Rule Name")]
+ public void Should_Set_RuleName(string ruleName)
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("Rule", ruleName).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+ }
+
+ public sealed class TheOfRuleWithRuleIdAndUriMethod
+ {
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_Null()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ string ruleId = null;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_Empty()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleIds = string.Empty;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleIds, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleIds);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_WhiteSpace()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleIds = " ";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleIds, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleIds);
}
[Fact]
@@ -1919,25 +2036,25 @@ public void Should_Handle_Rule_Uri_Which_Are_Null()
var fixture = new IssueBuilderFixture();
// When
- var issue = fixture.IssueBuilder.OfRule("Rule", null).Create();
+ var issue = fixture.IssueBuilder.OfRule("Rule", (Uri)null).Create();
// Then
issue.RuleUrl.ShouldBe(null);
}
[Theory]
- [InlineData("rule")]
- public void Should_Set_Rule(string rule)
+ [InlineData("ruleId")]
+ public void Should_Set_Rule(string ruleId)
{
// Given
var fixture = new IssueBuilderFixture();
var ruleUri = "https://google.com/";
// When
- var issue = fixture.IssueBuilder.OfRule(rule, new Uri(ruleUri)).Create();
+ var issue = fixture.IssueBuilder.OfRule(ruleId, new Uri(ruleUri)).Create();
// Then
- issue.RuleUrl.ToString().ShouldBe(ruleUri);
+ issue.RuleId.ToString().ShouldBe(ruleId);
}
[Theory]
@@ -1955,6 +2072,150 @@ public void Should_Set_RuleUrl(string ruleUri)
}
}
+ public sealed class TheOfRuleWithRuleIdAndNameAndUriMethod
+ {
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_Null()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ string ruleId = null;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule", new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_Empty()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleId = string.Empty;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule", new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleIds_Which_Are_WhiteSpace()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleId = " ";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, "Some Rule", new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_Null()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ string ruleName = null;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_Empty()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = string.Empty;
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Fact]
+ public void Should_Handle_RuleNames_Which_Are_WhiteSpace()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = " ";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", ruleName, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Fact]
+ public void Should_Handle_Rule_Uri_Which_Are_Null()
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("RuleId", "RuleName", (Uri)null).Create();
+
+ // Then
+ issue.RuleUrl.ShouldBe(null);
+ }
+
+ [Theory]
+ [InlineData("ruleId")]
+ public void Should_Set_Rule(string ruleId)
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = "Some Rule";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule(ruleId, ruleName, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+
+ [Theory]
+ [InlineData("Rule Name")]
+ public void Should_Set_RuleName(string ruleName)
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("Rule", ruleName, new Uri("https://google.com")).Create();
+
+ // Then
+ issue.RuleName.ShouldBe(ruleName);
+ }
+
+ [Theory]
+ [InlineData("https://google.com/")]
+ public void Should_Set_RuleUrl(string ruleUri)
+ {
+ // Given
+ var fixture = new IssueBuilderFixture();
+ var ruleName = "Some Rule";
+
+ // When
+ var issue = fixture.IssueBuilder.OfRule("Rule", ruleName, new Uri(ruleUri)).Create();
+
+ // Then
+ issue.RuleUrl.ToString().ShouldBe(ruleUri);
+ }
+ }
+
public sealed class TheForRunMethod
{
[Fact]
diff --git a/src/Cake.Issues.Tests/IssueTests.cs b/src/Cake.Issues.Tests/IssueTests.cs
index 71daf648d..2cf951504 100644
--- a/src/Cake.Issues.Tests/IssueTests.cs
+++ b/src/Cake.Issues.Tests/IssueTests.cs
@@ -31,6 +31,7 @@ public void Should_Throw_If_Identifier_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -55,6 +56,7 @@ public void Should_Throw_If_Identifier_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -84,6 +86,7 @@ public void Should_Throw_If_Identifier_Is_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -108,6 +111,7 @@ public void Should_Throw_If_Identifier_Is_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -137,6 +141,7 @@ public void Should_Throw_If_Identifier_Is_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -161,6 +166,7 @@ public void Should_Throw_If_Identifier_Is_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -190,6 +196,7 @@ public void Should_Set_Identifier(string identifier)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -214,6 +221,7 @@ public void Should_Set_Identifier(string identifier)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -246,6 +254,7 @@ public void Should_Throw_If_Project_Path_Is_Invalid(string projectPath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -270,6 +279,7 @@ public void Should_Throw_If_Project_Path_Is_Invalid(string projectPath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -301,6 +311,7 @@ public void Should_Throw_If_File_Path_Is_Absolute(string projectPath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -325,6 +336,7 @@ public void Should_Throw_If_File_Path_Is_Absolute(string projectPath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -354,6 +366,7 @@ public void Should_Handle_Project_Paths_Which_Are_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -378,6 +391,7 @@ public void Should_Handle_Project_Paths_Which_Are_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -407,6 +421,7 @@ public void Should_Handle_Project_Paths_Which_Are_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -431,6 +446,7 @@ public void Should_Handle_Project_Paths_Which_Are_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -460,6 +476,7 @@ public void Should_Handle_Project_Paths_Which_Are_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -484,6 +501,7 @@ public void Should_Handle_Project_Paths_Which_Are_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -513,6 +531,7 @@ public void Should_Set_ProjectFileRelativePath(string projectPath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -537,6 +556,7 @@ public void Should_Set_ProjectFileRelativePath(string projectPath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -569,6 +589,7 @@ public void Should_Handle_Projects_Which_Are_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -593,6 +614,7 @@ public void Should_Handle_Projects_Which_Are_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -622,6 +644,7 @@ public void Should_Handle_Projects_Which_Are_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -646,6 +669,7 @@ public void Should_Handle_Projects_Which_Are_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -675,6 +699,7 @@ public void Should_Handle_Projects_Which_Are_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -699,6 +724,7 @@ public void Should_Handle_Projects_Which_Are_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -728,6 +754,7 @@ public void Should_Set_ProjectName(string projectName)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -752,6 +779,7 @@ public void Should_Set_ProjectName(string projectName)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -784,6 +812,7 @@ public void Should_Throw_If_File_Path_Is_Invalid(string filePath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -808,6 +837,7 @@ public void Should_Throw_If_File_Path_Is_Invalid(string filePath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -839,6 +869,7 @@ public void Should_Throw_If_File_Path_Is_Absolute(string filePath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -863,6 +894,7 @@ public void Should_Throw_If_File_Path_Is_Absolute(string filePath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -892,6 +924,7 @@ public void Should_Handle_File_Paths_Which_Are_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -916,6 +949,7 @@ public void Should_Handle_File_Paths_Which_Are_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -945,6 +979,7 @@ public void Should_Handle_File_Paths_Which_Are_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -969,6 +1004,7 @@ public void Should_Handle_File_Paths_Which_Are_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -998,6 +1034,7 @@ public void Should_Handle_File_Paths_Which_Are_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1022,6 +1059,7 @@ public void Should_Handle_File_Paths_Which_Are_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1059,6 +1097,7 @@ public void Should_Set_File_Path(string filePath, string expectedFilePath)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1083,6 +1122,7 @@ public void Should_Set_File_Path(string filePath, string expectedFilePath)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1116,6 +1156,7 @@ public void Should_Throw_If_Line_Is_Negative()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1140,6 +1181,7 @@ public void Should_Throw_If_Line_Is_Negative()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1169,6 +1211,7 @@ public void Should_Throw_If_Line_Is_Zero()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1193,6 +1236,7 @@ public void Should_Throw_If_Line_Is_Zero()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1222,6 +1266,7 @@ public void Should_Throw_If_Line_Is_Set_But_No_File()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1246,6 +1291,7 @@ public void Should_Throw_If_Line_Is_Set_But_No_File()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1275,6 +1321,7 @@ public void Should_Handle_Line_Which_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1299,6 +1346,7 @@ public void Should_Handle_Line_Which_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1329,6 +1377,7 @@ public void Should_Set_Line(int line)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1353,6 +1402,7 @@ public void Should_Set_Line(int line)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1385,6 +1435,7 @@ public void Should_Throw_If_EndLine_Is_Negative()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1409,6 +1460,7 @@ public void Should_Throw_If_EndLine_Is_Negative()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1438,6 +1490,7 @@ public void Should_Throw_If_EndLine_Is_Zero()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1462,6 +1515,7 @@ public void Should_Throw_If_EndLine_Is_Zero()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1491,6 +1545,7 @@ public void Should_Throw_If_EndLine_Is_Set_But_No_Line()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1515,6 +1570,7 @@ public void Should_Throw_If_EndLine_Is_Set_But_No_Line()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1544,6 +1600,7 @@ public void Should_Throw_If_EndLine_Is_Smaller_Line()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1568,6 +1625,7 @@ public void Should_Throw_If_EndLine_Is_Smaller_Line()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1597,6 +1655,7 @@ public void Should_Handle_EndLine_Which_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1621,6 +1680,7 @@ public void Should_Handle_EndLine_Which_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1650,6 +1710,7 @@ public void Should_Handle_EndLine_Which_Is_Equals_Line()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1674,6 +1735,7 @@ public void Should_Handle_EndLine_Which_Is_Equals_Line()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1704,6 +1766,7 @@ public void Should_Set_EndLine(int endLine)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1728,6 +1791,7 @@ public void Should_Set_EndLine(int endLine)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1760,6 +1824,7 @@ public void Should_Throw_If_Column_Is_Negative()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1784,6 +1849,7 @@ public void Should_Throw_If_Column_Is_Negative()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1813,6 +1879,7 @@ public void Should_Throw_If_Column_Is_Zero()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1837,6 +1904,7 @@ public void Should_Throw_If_Column_Is_Zero()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1866,6 +1934,7 @@ public void Should_Throw_If_Column_Is_Set_But_No_Line()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1890,6 +1959,7 @@ public void Should_Throw_If_Column_Is_Set_But_No_Line()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1919,6 +1989,7 @@ public void Should_Handle_Column_Which_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1943,6 +2014,7 @@ public void Should_Handle_Column_Which_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -1974,6 +2046,7 @@ public void Should_Set_Column(int? column)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -1998,6 +2071,7 @@ public void Should_Set_Column(int? column)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2030,6 +2104,7 @@ public void Should_Throw_If_EndColumn_Is_Negative()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2054,6 +2129,7 @@ public void Should_Throw_If_EndColumn_Is_Negative()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2083,6 +2159,7 @@ public void Should_Throw_If_EndColumn_Is_Zero()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2107,6 +2184,7 @@ public void Should_Throw_If_EndColumn_Is_Zero()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2136,6 +2214,7 @@ public void Should_Throw_If_EndColumn_Is_Set_But_No_Column()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2160,6 +2239,7 @@ public void Should_Throw_If_EndColumn_Is_Set_But_No_Column()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2189,6 +2269,7 @@ public void Should_Throw_If_EndColumn_Is_Smaller_Column()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2213,6 +2294,7 @@ public void Should_Throw_If_EndColumn_Is_Smaller_Column()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2242,6 +2324,7 @@ public void Should_Handle_EndColumn_Which_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2266,6 +2349,7 @@ public void Should_Handle_EndColumn_Which_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2295,6 +2379,7 @@ public void Should_Handle_EndColumn_Which_Is_Equals_Column()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2319,6 +2404,7 @@ public void Should_Handle_EndColumn_Which_Is_Equals_Column()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2350,6 +2436,7 @@ public void Should_Set_EndColumn(int? endColumn)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2374,6 +2461,7 @@ public void Should_Set_EndColumn(int? endColumn)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2406,6 +2494,7 @@ public void Should_Set_FileLink()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2430,6 +2519,7 @@ public void Should_Set_FileLink()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2459,6 +2549,7 @@ public void Should_Set_FileLink_If_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2483,6 +2574,7 @@ public void Should_Set_FileLink_If_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2515,6 +2607,7 @@ public void Should_Throw_If_MessageText_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2539,6 +2632,7 @@ public void Should_Throw_If_MessageText_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2568,6 +2662,7 @@ public void Should_Throw_If_MessageText_Is_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2592,6 +2687,7 @@ public void Should_Throw_If_MessageText_Is_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2621,6 +2717,7 @@ public void Should_Throw_If_MessageText_Is_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2645,6 +2742,7 @@ public void Should_Throw_If_MessageText_Is_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2674,6 +2772,7 @@ public void Should_Set_MessageText(string messageText)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2698,6 +2797,7 @@ public void Should_Set_MessageText(string messageText)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2733,6 +2833,7 @@ public void Should_Set_MessageHtml(string messageHtml)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2757,6 +2858,7 @@ public void Should_Set_MessageHtml(string messageHtml)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2792,6 +2894,7 @@ public void Should_Set_MessageHtml(string messageMarkdown)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2816,6 +2919,7 @@ public void Should_Set_MessageHtml(string messageMarkdown)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2853,6 +2957,7 @@ public void Should_Set_Priority(int? priority)
var messageMarkdown = "MessageMarkdown";
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2877,6 +2982,7 @@ public void Should_Set_Priority(int? priority)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2909,6 +3015,7 @@ public void Should_Handle_PriorityNames_Which_Are_Null()
var priority = 1;
string priorityName = null;
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2933,6 +3040,7 @@ public void Should_Handle_PriorityNames_Which_Are_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -2962,6 +3070,7 @@ public void Should_Handle_PriorityNames_Which_Are_Empty()
var priority = 1;
var priorityName = string.Empty;
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -2986,6 +3095,7 @@ public void Should_Handle_PriorityNames_Which_Are_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3015,6 +3125,7 @@ public void Should_Handle_PriorityNames_Which_Are_WhiteSpace()
var priority = 1;
var priorityName = " ";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3039,6 +3150,7 @@ public void Should_Handle_PriorityNames_Which_Are_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3068,6 +3180,7 @@ public void Should_Set_Priority_Name(string priorityName)
var messageMarkdown = "MessageMarkdown";
var priority = 1;
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3092,6 +3205,7 @@ public void Should_Set_Priority_Name(string priorityName)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3103,13 +3217,13 @@ public void Should_Set_Priority_Name(string priorityName)
}
}
- public sealed class TheRuleArgument
+ public sealed class TheRuleIdArgument
{
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("rule")]
- public void Should_Set_Rule(string rule)
+ public void Should_Set_RuleId(string ruleId)
{
// Given
var identifier = "identifier";
@@ -3126,6 +3240,7 @@ public void Should_Set_Rule(string rule)
var messageMarkdown = "MessageMarkdown";
var priority = 1;
var priorityName = "Warning";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3149,7 +3264,68 @@ public void Should_Set_Rule(string rule)
messageMarkdown,
priority,
priorityName,
- rule,
+ ruleId,
+ ruleName,
+ ruleUri,
+ run,
+ providerType,
+ providerName,
+ additionalInformation);
+
+ // Then
+ issue.RuleId.ShouldBe(ruleId);
+ }
+ }
+
+ public sealed class TheRuleNameArgument
+ {
+ [Theory]
+ [InlineData(null)]
+ [InlineData("")]
+ [InlineData("ruleName")]
+ public void Should_Set_RuleName(string ruleName)
+ {
+ // Given
+ var identifier = "identifier";
+ var projectPath = @"src\foo.csproj";
+ var projectName = "foo";
+ var filePath = @"src\foo.cs";
+ var line = 10;
+ var endLine = 12;
+ var column = 50;
+ var endColumn = 55;
+ var fileLink = new Uri("https://github.com/myorg/myrepo/blob/develop/src/foo.cs#L10-L12");
+ var messageText = "MessageText";
+ var messageHtml = "MessageHtml";
+ var messageMarkdown = "MessageMarkdown";
+ var priority = 1;
+ var priorityName = "Warning";
+ var ruleId = "Rule";
+ var ruleUri = new Uri("https://google.com");
+ var providerType = "ProviderType";
+ var providerName = "ProviderName";
+ var run = "Run";
+ var additionalInformation = new Dictionary();
+
+ // When
+ var issue =
+ new Issue(
+ identifier,
+ projectPath,
+ projectName,
+ filePath,
+ line,
+ endLine,
+ column,
+ endColumn,
+ fileLink,
+ messageText,
+ messageHtml,
+ messageMarkdown,
+ priority,
+ priorityName,
+ ruleId,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3157,7 +3333,7 @@ public void Should_Set_Rule(string rule)
additionalInformation);
// Then
- issue.Rule.ShouldBe(rule);
+ issue.RuleName.ShouldBe(ruleName);
}
}
@@ -3182,6 +3358,7 @@ public void Should_Set_Rule_Url()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3206,6 +3383,7 @@ public void Should_Set_Rule_Url()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3235,6 +3413,7 @@ public void Should_Set_Rule_Url_If_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
Uri ruleUri = null;
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3259,6 +3438,7 @@ public void Should_Set_Rule_Url_If_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3294,6 +3474,7 @@ public void Should_Set_Run(string run)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3317,6 +3498,7 @@ public void Should_Set_Run(string run)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3349,6 +3531,7 @@ public void Should_Throw_If_Provider_Type_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
string providerType = null;
var providerName = "ProviderName";
@@ -3373,6 +3556,7 @@ public void Should_Throw_If_Provider_Type_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3402,6 +3586,7 @@ public void Should_Throw_If_Provider_Type_Is_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = string.Empty;
var providerName = "ProviderName";
@@ -3426,6 +3611,7 @@ public void Should_Throw_If_Provider_Type_Is_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3455,6 +3641,7 @@ public void Should_Throw_If_Provider_Type_Is_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = " ";
var providerName = "ProviderName";
@@ -3479,6 +3666,7 @@ public void Should_Throw_If_Provider_Type_Is_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3509,6 +3697,7 @@ public void Should_Set_ProviderType(string providerType)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerName = "ProviderName";
var run = "Run";
@@ -3532,6 +3721,7 @@ public void Should_Set_ProviderType(string providerType)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3564,6 +3754,7 @@ public void Should_Throw_If_Provider_Name_Is_Null()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
string providerName = null;
@@ -3588,6 +3779,7 @@ public void Should_Throw_If_Provider_Name_Is_Null()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3617,6 +3809,7 @@ public void Should_Throw_If_Provider_Name_Is_Empty()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = string.Empty;
@@ -3641,6 +3834,7 @@ public void Should_Throw_If_Provider_Name_Is_Empty()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3670,6 +3864,7 @@ public void Should_Throw_If_Provider_Name_Is_WhiteSpace()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = " ";
@@ -3694,6 +3889,7 @@ public void Should_Throw_If_Provider_Name_Is_WhiteSpace()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3724,6 +3920,7 @@ public void Should_Set_ProviderName(string providerName)
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var run = "Run";
@@ -3747,6 +3944,7 @@ public void Should_Set_ProviderName(string providerName)
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3779,6 +3977,7 @@ public void Should_Set_AdditionalInformation()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3813,6 +4012,7 @@ public void Should_Set_AdditionalInformation()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
@@ -3843,6 +4043,7 @@ public void Should_Set_AdditionalInformation_To_Empty_Dictionary()
var priority = 1;
var priorityName = "Warning";
var rule = "Rule";
+ var ruleName = "Rule Name";
var ruleUri = new Uri("https://google.com");
var providerType = "ProviderType";
var providerName = "ProviderName";
@@ -3866,6 +4067,7 @@ public void Should_Set_AdditionalInformation_To_Empty_Dictionary()
priority,
priorityName,
rule,
+ ruleName,
ruleUri,
run,
providerType,
diff --git a/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs b/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs
index 213b7d68b..8fb49e190 100644
--- a/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs
+++ b/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs
@@ -329,21 +329,39 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip()
}
[Fact]
- public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
+ public void Should_Give_Correct_Result_For_RuleId_After_Roundtrip()
{
// Given
- var rule = "rule";
+ var ruleId = "rule";
var issue =
IssueBuilder
.NewIssue("message", "providerType", "providerName")
- .OfRule(rule)
+ .OfRule(ruleId)
.Create();
// When
var result = issue.SerializeToJsonString().DeserializeToIssue();
// Then
- result.Rule.ShouldBe(rule);
+ result.RuleId.ShouldBe(ruleId);
+ }
+
+ [Fact]
+ public void Should_Give_Correct_Result_For_RuleName_After_Roundtrip()
+ {
+ // Given
+ var ruleName = "Rule Name";
+ var issue =
+ IssueBuilder
+ .NewIssue("message", "providerType", "providerName")
+ .OfRule("rule", ruleName)
+ .Create();
+
+ // When
+ var result = issue.SerializeToJsonString().DeserializeToIssue();
+
+ // Then
+ result.RuleName.ShouldBe(ruleName);
}
[Fact]
@@ -849,21 +867,21 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip()
}
[Fact]
- public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
+ public void Should_Give_Correct_Result_For_RuleId_After_Roundtrip()
{
// Given
- var rule1 = "rule1";
- var rule2 = "rule2";
+ var ruleId1 = "rule1";
+ var ruleId2 = "rule2";
var issues =
new List
{
IssueBuilder
.NewIssue("message1", "providerType1", "providerName1")
- .OfRule(rule1)
+ .OfRule(ruleId1)
.Create(),
IssueBuilder
.NewIssue("message2", "providerType2", "providerName2")
- .OfRule(rule2)
+ .OfRule(ruleId2)
.Create(),
};
@@ -872,8 +890,36 @@ public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
// Then
result.Count().ShouldBe(2);
- result.First().Rule.ShouldBe(rule1);
- result.Last().Rule.ShouldBe(rule2);
+ result.First().RuleId.ShouldBe(ruleId1);
+ result.Last().RuleId.ShouldBe(ruleId2);
+ }
+
+ [Fact]
+ public void Should_Give_Correct_Result_For_RuleName_After_Roundtrip()
+ {
+ // Given
+ var ruleName1 = "Rule Name 1";
+ var ruleName2 = "Rule Name 2";
+ var issues =
+ new List
+ {
+ IssueBuilder
+ .NewIssue("message1", "providerType1", "providerName1")
+ .OfRule("rule", ruleName1)
+ .Create(),
+ IssueBuilder
+ .NewIssue("message2", "providerType2", "providerName2")
+ .OfRule("rule", ruleName2)
+ .Create(),
+ };
+
+ // When
+ var result = issues.SerializeToJsonString().DeserializeToIssues();
+
+ // Then
+ result.Count().ShouldBe(2);
+ result.First().RuleName.ShouldBe(ruleName1);
+ result.Last().RuleName.ShouldBe(ruleName2);
}
[Fact]
@@ -1475,14 +1521,44 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip()
}
[Fact]
- public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
+ public void Should_Give_Correct_Result_For_RuleId_After_Roundtrip()
+ {
+ // Given
+ var ruleId = "rule";
+ var issue =
+ IssueBuilder
+ .NewIssue("message", "providerType", "providerName")
+ .OfRule(ruleId)
+ .Create();
+ var filePath = new FilePath(System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".json");
+
+ try
+ {
+ // When
+ issue.SerializeToJsonFile(filePath);
+ var result = filePath.DeserializeToIssue();
+
+ // Then
+ result.RuleId.ShouldBe(ruleId);
+ }
+ finally
+ {
+ if (System.IO.File.Exists(filePath.FullPath))
+ {
+ System.IO.File.Delete(filePath.FullPath);
+ }
+ }
+ }
+
+ [Fact]
+ public void Should_Give_Correct_Result_For_RuleName_After_Roundtrip()
{
// Given
- var rule = "rule";
+ var ruleName = "Rule Name";
var issue =
IssueBuilder
.NewIssue("message", "providerType", "providerName")
- .OfRule(rule)
+ .OfRule("rule", ruleName)
.Create();
var filePath = new FilePath(System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".json");
@@ -1493,7 +1569,7 @@ public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
var result = filePath.DeserializeToIssue();
// Then
- result.Rule.ShouldBe(rule);
+ result.RuleName.ShouldBe(ruleName);
}
finally
{
@@ -2238,21 +2314,61 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip()
}
[Fact]
- public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
+ public void Should_Give_Correct_Result_For_RuleId_After_Roundtrip()
+ {
+ // Given
+ var ruleId1 = "rule1";
+ var ruleId2 = "rule2";
+ var issues =
+ new List
+ {
+ IssueBuilder
+ .NewIssue("message1", "providerType1", "providerName1")
+ .OfRule(ruleId1)
+ .Create(),
+ IssueBuilder
+ .NewIssue("message2", "providerType2", "providerName2")
+ .OfRule(ruleId2)
+ .Create(),
+ };
+ var filePath = new FilePath(System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".json");
+
+ try
+ {
+ // When
+ issues.SerializeToJsonFile(filePath);
+ var result = filePath.DeserializeToIssues();
+
+ // Then
+ result.Count().ShouldBe(2);
+ result.First().RuleId.ShouldBe(ruleId1);
+ result.Last().RuleId.ShouldBe(ruleId2);
+ }
+ finally
+ {
+ if (System.IO.File.Exists(filePath.FullPath))
+ {
+ System.IO.File.Delete(filePath.FullPath);
+ }
+ }
+ }
+
+ [Fact]
+ public void Should_Give_Correct_Result_For_RuleName_After_Roundtrip()
{
// Given
- var rule1 = "rule1";
- var rule2 = "rule2";
+ var ruleName1 = "Rule Name 1";
+ var ruleName2 = "Rule Name 2";
var issues =
new List
{
IssueBuilder
.NewIssue("message1", "providerType1", "providerName1")
- .OfRule(rule1)
+ .OfRule("rule", ruleName1)
.Create(),
IssueBuilder
.NewIssue("message2", "providerType2", "providerName2")
- .OfRule(rule2)
+ .OfRule("rule", ruleName2)
.Create(),
};
var filePath = new FilePath(System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".json");
@@ -2265,8 +2381,8 @@ public void Should_Give_Correct_Result_For_Rule_After_Roundtrip()
// Then
result.Count().ShouldBe(2);
- result.First().Rule.ShouldBe(rule1);
- result.Last().Rule.ShouldBe(rule2);
+ result.First().RuleName.ToString().ShouldBe(ruleName1);
+ result.Last().RuleName.ToString().ShouldBe(ruleName2);
}
finally
{
diff --git a/src/Cake.Issues.Tests/StringPathExtensionsTests.cs b/src/Cake.Issues.Tests/StringPathExtensionsTests.cs
index d6e6aeb43..d84cd11eb 100644
--- a/src/Cake.Issues.Tests/StringPathExtensionsTests.cs
+++ b/src/Cake.Issues.Tests/StringPathExtensionsTests.cs
@@ -403,5 +403,349 @@ public void Should_Handle_Trailing_Slashes(string path, string expectedResult)
result.ShouldBe(expectedResult);
}
}
+
+ public sealed class TheIsValideRepositoryFilePathExtension
+ {
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ ((string)null).IsValideRepositoryFilePath(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentNullException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Empty()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ string.Empty.IsValideRepositoryFilePath(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_WhiteSpace()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ " ".IsValideRepositoryFilePath(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_RepositorySettings_Are_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ @"C:\repo".IsValideRepositoryFilePath(null));
+
+ // Then
+ result.IsArgumentNullException("repositorySettings");
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\repo\foo")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\bar")]
+ [InlineData("/repo", "/repo/foo")]
+ [InlineData("/repo", "/repo/foo/")]
+ [InlineData("/repo", "/repo/foo/bar")]
+ public void Should_Return_True_If_File_Is_Valid_Repository_FilePath(string repoRoot, string filePath)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var (valid, _) = filePath.IsValideRepositoryFilePath(repositorySettings);
+
+ // Then
+ valid.ShouldBeTrue();
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\r\foo")]
+ [InlineData(@"C:\repo", @"C:\r\foo\")]
+ [InlineData(@"C:\repo", @"C:\r\foo\bar")]
+ [InlineData("/repo", "/r/foo")]
+ [InlineData("/repo", "/r/foo/")]
+ [InlineData("/repo", "/r/foo/bar")]
+ public void Should_Return_False_If_File_Is_Outside_Repository(string repoRoot, string filePath)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var (valid, _) = filePath.IsValideRepositoryFilePath(repositorySettings);
+
+ // Then
+ valid.ShouldBeFalse();
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\repo\foo", @"foo")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\", @"foo\")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\bar", @"foo\bar")]
+ [InlineData("/repo", "/repo/foo", "foo")]
+ [InlineData("/repo", "/repo/foo/", "foo/")]
+ [InlineData("/repo", "/repo/foo/bar", "foo/bar")]
+ [InlineData(@"C:\repo", @"C:\r\foo", "")]
+ public void Should_Return_Correct_FilePath(string repoRoot, string filePath, string expectedResult)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var (_, filePathResult) = filePath.IsValideRepositoryFilePath(repositorySettings);
+
+ // Then
+ filePathResult.ShouldBe(expectedResult);
+ }
+ }
+
+ public sealed class TheIsInRepositoryExtension
+ {
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ ((string)null).IsInRepository(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentNullException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Empty()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ string.Empty.IsInRepository(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_WhiteSpace()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ " ".IsInRepository(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_RepositorySettings_Are_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ @"C:\repo".IsInRepository(null));
+
+ // Then
+ result.IsArgumentNullException("repositorySettings");
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\repo\foo")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\bar")]
+ [InlineData("/repo", "/repo/foo")]
+ [InlineData("/repo", "/repo/foo/")]
+ [InlineData("/repo", "/repo/foo/bar")]
+ public void Should_Return_True_If_File_Is_In_Repository(string repoRoot, string filePath)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var result = filePath.IsInRepository(repositorySettings);
+
+ // Then
+ result.ShouldBeTrue();
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\r\foo")]
+ [InlineData(@"C:\repo", @"C:\r\foo\")]
+ [InlineData(@"C:\repo", @"C:\r\foo\bar")]
+ [InlineData("/repo", "/r/foo")]
+ [InlineData("/repo", "/r/foo/")]
+ [InlineData("/repo", "/r/foo/bar")]
+ public void Should_Return_False_If_File_Is_Outside_Repository(string repoRoot, string filePath)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var result = filePath.IsInRepository(repositorySettings);
+
+ // Then
+ result.ShouldBeFalse();
+ }
+ }
+
+ public sealed class TheMakeFilePathRelativeToRepositoryRootExtension
+ {
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ ((string)null).MakeFilePathRelativeToRepositoryRoot(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentNullException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Empty()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ string.Empty.MakeFilePathRelativeToRepositoryRoot(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_WhiteSpace()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ " ".MakeFilePathRelativeToRepositoryRoot(new RepositorySettings(@"C:\repo")));
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_RepositorySettings_Are_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ @"C:\repo".MakeFilePathRelativeToRepositoryRoot(null));
+
+ // Then
+ result.IsArgumentNullException("repositorySettings");
+ }
+
+ [Theory]
+ [InlineData(@"C:\repo", @"C:\repo\foo", @"foo")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\", @"foo\")]
+ [InlineData(@"C:\repo", @"C:\repo\foo\bar", @"foo\bar")]
+ [InlineData("/repo", "/repo/foo", "foo")]
+ [InlineData("/repo", "/repo/foo/", "foo/")]
+ [InlineData("/repo", "/repo/foo/bar", "foo/bar")]
+ public void Should_Make_FilePath_Relative_To_Repository_Root(string repoRoot, string filePath, string expectedResult)
+ {
+ // Given
+ var repositorySettings = new RepositorySettings(repoRoot);
+
+ // When
+ var result = filePath.MakeFilePathRelativeToRepositoryRoot(repositorySettings);
+
+ // Then
+ result.ShouldBe(expectedResult);
+ }
+ }
+
+ public sealed class TheRemoveLeadingDirectorySeparatorExtension
+ {
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Null()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ ((string)null).RemoveLeadingDirectorySeparator());
+
+ // Then
+ result.IsArgumentNullException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_Empty()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ string.Empty.RemoveLeadingDirectorySeparator());
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Fact]
+ public void Should_Throw_If_FilePath_Is_WhiteSpace()
+ {
+ // Given / When
+ var result =
+ Record.Exception(
+ () =>
+ " ".RemoveLeadingDirectorySeparator());
+
+ // Then
+ result.IsArgumentOutOfRangeException("filePath");
+ }
+
+ [Theory]
+ [InlineData("foo", "foo")]
+ [InlineData(@"foo\", @"foo\")]
+ [InlineData(@"foo\bar", @"foo\bar")]
+ [InlineData(@"\foo", @"foo")]
+ [InlineData(@"\foo\", @"foo\")]
+ [InlineData(@"\foo\bar", @"foo\bar")]
+ [InlineData(@"c:\foo", @"c:\foo")]
+ [InlineData(@"c:\foo\", @"c:\foo\")]
+ [InlineData(@"c:\foo\bar", @"c:\foo\bar")]
+ [InlineData("/foo", "foo")]
+ [InlineData("/foo/", "foo/")]
+ [InlineData("/foo/bar", "foo/bar")]
+ public void Should_Remove_Leading_Directory_Separators(string filePath, string expectedResult)
+ {
+ // Given / When
+ var result = filePath.RemoveLeadingDirectorySeparator();
+
+ // Then
+ result.ShouldBe(expectedResult);
+ }
+ }
}
}
diff --git a/src/Cake.Issues.Tests/Testing/IssueCheckerFixture.cs b/src/Cake.Issues.Tests/Testing/IssueCheckerFixture.cs
index 1e090765a..776151024 100644
--- a/src/Cake.Issues.Tests/Testing/IssueCheckerFixture.cs
+++ b/src/Cake.Issues.Tests/Testing/IssueCheckerFixture.cs
@@ -31,6 +31,7 @@ public IssueCheckerFixture(string identifier, string messageText, string provide
this.Priority = 100;
this.PriorityName = "PriorityName";
this.Rule = "Rule";
+ this.RuleName = "RuleName";
this.RuleUrl = new Uri("https://google.com");
this.AdditionalInformation = new Dictionary();
@@ -41,7 +42,7 @@ public IssueCheckerFixture(string identifier, string messageText, string provide
.InProject(this.ProjectFileRelativePath, this.ProjectName)
.InFile(this.AffectedFileRelativePath, this.Line, this.EndLine, this.Column, this.EndColumn)
.WithFileLink(this.FileLink)
- .OfRule(this.Rule, this.RuleUrl)
+ .OfRule(this.Rule, this.RuleName, this.RuleUrl)
.WithPriority(this.Priority, this.PriorityName)
.WithAdditionalInformation(this.AdditionalInformation);
@@ -87,6 +88,8 @@ public IssueCheckerFixture(string identifier, string messageText, string provide
public string Rule { get; private set; }
+ public string RuleName { get; private set; }
+
public Uri RuleUrl { get; private set; }
public Dictionary AdditionalInformation { get; private set; }
diff --git a/src/Cake.Issues.Tests/Testing/IssueCheckerTests.cs b/src/Cake.Issues.Tests/Testing/IssueCheckerTests.cs
index 5912622f9..02f273d17 100644
--- a/src/Cake.Issues.Tests/Testing/IssueCheckerTests.cs
+++ b/src/Cake.Issues.Tests/Testing/IssueCheckerTests.cs
@@ -161,6 +161,7 @@ public void Should_Throw_If_Issue_Is_Null()
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -195,6 +196,7 @@ public void Should_Not_Throw_If_All_Values_Are_The_Same()
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation);
@@ -233,6 +235,7 @@ public void Should_Throw_If_ProviderType_Is_Different(string expectedValue, stri
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -273,6 +276,7 @@ public void Should_Throw_If_ProviderName_Is_Different(string expectedValue, stri
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -317,6 +321,7 @@ public void Should_Throw_If_Run_Is_Different(string expectedValue, string actual
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -357,6 +362,7 @@ public void Should_Throw_If_Identifier_Is_Different(string expectedValue, string
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -398,6 +404,7 @@ public void Should_Throw_If_ProjectFileRelativePath_Is_Different(string expected
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -442,6 +449,7 @@ public void Should_Throw_If_ProjectName_Is_Different(string expectedValue, strin
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -483,6 +491,7 @@ public void Should_Throw_If_AffectedFileRelativePath_Is_Different(string expecte
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -526,6 +535,7 @@ public void Should_Throw_If_Line_Is_Different(int? expectedValue, int? actualVal
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -569,6 +579,7 @@ public void Should_Throw_If_EndLine_Is_Different(int? expectedValue, int? actual
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -612,6 +623,7 @@ public void Should_Throw_If_Column_Is_Different(int? expectedValue, int? actualV
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -655,6 +667,7 @@ public void Should_Throw_If_EndColumn_Is_Different(int? expectedValue, int? actu
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -697,6 +710,7 @@ public void Should_Throw_If_FileLink_Is_Different(string expectedValue, string a
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -737,6 +751,7 @@ public void Should_Throw_If_MessageText_Is_Different(string expectedValue, strin
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -781,6 +796,7 @@ public void Should_Throw_If_MessageHtml_Is_Different(string expectedValue, strin
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -825,6 +841,7 @@ public void Should_Throw_If_MessageMarkdown_Is_Different(string expectedValue, s
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -866,6 +883,7 @@ public void Should_Throw_If_Priority_Is_Different(IssuePriority expectedValue, I
(int)expectedValue,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -910,6 +928,7 @@ public void Should_Throw_If_PriorityName_Is_Different(string expectedValue, stri
fixture.Priority,
expectedValue,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -954,6 +973,7 @@ public void Should_Throw_If_Rule_Is_Different(string expectedValue, string actua
fixture.Priority,
fixture.PriorityName,
expectedValue,
+ fixture.RuleName,
fixture.RuleUrl,
fixture.AdditionalInformation));
@@ -962,6 +982,51 @@ public void Should_Throw_If_Rule_Is_Different(string expectedValue, string actua
result.Message.ShouldStartWith("Expected issue.Rule");
}
+ [Theory]
+ [InlineData("Rule", "Foo")]
+ [InlineData(null, "Foo")]
+ [InlineData("", "Foo")]
+ [InlineData(" ", "Foo")]
+ public void Should_Throw_If_RuleName_Is_Different(string expectedValue, string actualValue)
+ {
+ // Given
+ var fixture = new IssueCheckerFixture();
+ var issue =
+ fixture.IssueBuilder
+ .OfRule(fixture.Rule, actualValue)
+ .Create();
+
+ // When
+ var result = Record.Exception(() =>
+ IssueChecker.Check(
+ issue,
+ fixture.ProviderType,
+ fixture.ProviderName,
+ fixture.Run,
+ fixture.Identifier,
+ fixture.ProjectFileRelativePath,
+ fixture.ProjectName,
+ fixture.AffectedFileRelativePath,
+ fixture.Line,
+ fixture.EndLine,
+ fixture.Column,
+ fixture.EndColumn,
+ fixture.FileLink,
+ fixture.MessageText,
+ fixture.MessageHtml,
+ fixture.MessageMarkdown,
+ fixture.Priority,
+ fixture.PriorityName,
+ fixture.Rule,
+ expectedValue,
+ fixture.RuleUrl,
+ fixture.AdditionalInformation));
+
+ // Then
+ result.ShouldBeOfType();
+ result.Message.ShouldStartWith("Expected issue.RuleName");
+ }
+
[Theory]
[InlineData("https://google.com", "https://foo.bar")]
public void Should_Throw_If_RuleUrl_Is_Different(string expectedValue, string actualValue)
@@ -995,6 +1060,7 @@ public void Should_Throw_If_RuleUrl_Is_Different(string expectedValue, string ac
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
new Uri(expectedValue),
fixture.AdditionalInformation));
@@ -1036,6 +1102,7 @@ public void Should_Throw_If_AdditionalInformation_Is_Different(string expectedKe
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
new Dictionary
{
@@ -1099,6 +1166,7 @@ public void Should_Throw_If_AdditionalInformation_Has_Other_Items_Than_Expected(
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
expected));
@@ -1159,6 +1227,7 @@ public void Should_Throw_If_AdditionalInformation_Lacks_An_Item()
fixture.Priority,
fixture.PriorityName,
fixture.Rule,
+ fixture.RuleName,
fixture.RuleUrl,
expected));
diff --git a/src/Cake.Issues/Cake.Issues.csproj b/src/Cake.Issues/Cake.Issues.csproj
index 7eeef46eb..89607bb82 100644
--- a/src/Cake.Issues/Cake.Issues.csproj
+++ b/src/Cake.Issues/Cake.Issues.csproj
@@ -1,7 +1,7 @@
- netstandard2.0
+ netcoreapp3.1;net5.0;net6.0
Addin for reading code analyzer or linter issues for the Cake build automation system
BBT Software AG
BBT Software AG
@@ -9,23 +9,16 @@
+ bin\$(Configuration)\$(TargetFramework)\Cake.Issues.xml
full
true
AllEnabledByDefault
..\Cake.Issues.ruleset
-
- bin\Debug\netstandard2.0\Cake.Issues.xml
-
-
-
- bin\Release\netstandard2.0\Cake.Issues.xml
-
-
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Cake.Issues/IIssue.cs b/src/Cake.Issues/IIssue.cs
index 95ef6dc68..97b9b0ab2 100644
--- a/src/Cake.Issues/IIssue.cs
+++ b/src/Cake.Issues/IIssue.cs
@@ -93,10 +93,16 @@ public interface IIssue
string PriorityName { get; }
///
- /// Gets the rule of the issue.
+ /// Gets the id of the rule of the issue.
/// Can be null or if the issue provider provides no rule.
///
- string Rule { get; }
+ string RuleId { get; }
+
+ ///
+ /// Gets the name of the rule of the issue.
+ /// Can be null or if the issue provider provides no rule.
+ ///
+ string RuleName { get; }
///
/// Gets the URL containing information about the failing rule.
diff --git a/src/Cake.Issues/IIssueComparer.cs b/src/Cake.Issues/IIssueComparer.cs
index 53c9422b3..b5589c1ec 100644
--- a/src/Cake.Issues/IIssueComparer.cs
+++ b/src/Cake.Issues/IIssueComparer.cs
@@ -86,7 +86,8 @@ public bool Equals(IIssue x, IIssue y)
(x.MessageMarkdown == y.MessageMarkdown) &&
(x.Priority == y.Priority) &&
(x.PriorityName == y.PriorityName) &&
- (x.Rule == y.Rule) &&
+ (x.RuleId == y.RuleId) &&
+ (x.RuleName == y.RuleName) &&
(x.RuleUrl?.ToString() == y.RuleUrl?.ToString()) &&
(x.Run == y.Run) &&
(x.ProviderType == y.ProviderType) &&
@@ -113,7 +114,8 @@ public int GetHashCode(IIssue obj)
obj.MessageMarkdown,
obj.Priority,
obj.PriorityName,
- obj.Rule,
+ obj.RuleId,
+ obj.RuleName,
obj.RuleUrl,
obj.Run,
obj.ProviderType,
@@ -139,7 +141,8 @@ public int GetHashCode(IIssue obj)
obj.MessageMarkdown,
obj.Priority,
obj.PriorityName,
- obj.Rule,
+ obj.RuleId,
+ obj.RuleName,
obj.RuleUrl,
obj.Run,
obj.ProviderType,
diff --git a/src/Cake.Issues/IIssueExtensions.cs b/src/Cake.Issues/IIssueExtensions.cs
index acf4f20c7..1486c2e45 100644
--- a/src/Cake.Issues/IIssueExtensions.cs
+++ b/src/Cake.Issues/IIssueExtensions.cs
@@ -137,6 +137,18 @@ public static string FileName(this IIssue issue)
return issue.AffectedFileRelativePath?.GetFilename().ToString();
}
+ ///
+ /// Returns the name or id of the rule.
+ ///
+ /// Issue for which the rule should be returned.
+ /// Returns if it is set, otherwise .
+ public static string Rule(this IIssue issue)
+ {
+ issue.NotNull(nameof(issue));
+
+ return !string.IsNullOrWhiteSpace(issue.RuleName) ? issue.RuleName : issue.RuleId;
+ }
+
///
/// Returns a string with all patterns replaced by the values of .
///
@@ -212,8 +224,12 @@ public static string FileName(this IIssue issue)
/// The value of .
///
/// -
- /// {Rule}
- /// The value of .
+ /// {RuleId}
+ /// The value of .
+ ///
+ /// -
+ /// {RuleName}
+ /// The value of .
///
/// -
/// {RuleUrl}
@@ -271,7 +287,8 @@ public static string ReplaceIssuePattern(this string pattern, IIssue issue)
.Replace("{Column}", issue.Column?.ToString())
.Replace("{EndColumn}", issue.EndColumn?.ToString())
.Replace("{FileLink}", issue.FileLink?.ToString())
- .Replace("{Rule}", issue.Rule)
+ .Replace("{RuleId}", issue.RuleId)
+ .Replace("{RuleName}", issue.RuleName)
.Replace("{RuleUrl}", issue.RuleUrl?.ToString())
.Replace("{Run}", issue.Run)
.Replace("{MessageText}", issue.Message(IssueCommentFormat.PlainText))
diff --git a/src/Cake.Issues/Issue.cs b/src/Cake.Issues/Issue.cs
index a4a6f216a..4560db6cd 100644
--- a/src/Cake.Issues/Issue.cs
+++ b/src/Cake.Issues/Issue.cs
@@ -39,8 +39,10 @@ public class Issue : IIssue
/// null if no priority was assigned.
/// The human friendly name of the priority.
/// null or if no priority was assigned.
- /// The rule of the issue.
- /// null or if issue has no specific rule ID.
+ /// The ID of the rule of the issue.
+ /// null or if issue has no specific rule.
+ /// The name of the rule of the issue.
+ /// null or if issue has no specific rule.
/// The URL containing information about the failing rule.
/// null if no URL is available.
/// Gets the description of the run.
@@ -62,7 +64,8 @@ public Issue(
string messageMarkdown,
int? priority,
string priorityName,
- string rule,
+ string ruleId,
+ string ruleName,
Uri ruleUrl,
string run,
string providerType,
@@ -156,7 +159,8 @@ public Issue(
this.MessageMarkdown = messageMarkdown;
this.Priority = priority;
this.PriorityName = priorityName;
- this.Rule = rule;
+ this.RuleId = ruleId;
+ this.RuleName = ruleName;
this.RuleUrl = ruleUrl;
this.Run = run;
this.ProviderType = providerType;
@@ -207,7 +211,10 @@ public Issue(
public string PriorityName { get; }
///
- public string Rule { get; }
+ public string RuleId { get; }
+
+ ///
+ public string RuleName { get; }
///
public Uri RuleUrl { get; }
diff --git a/src/Cake.Issues/IssueBuilder.cs b/src/Cake.Issues/IssueBuilder.cs
index 71e151c79..a4ad60ae8 100644
--- a/src/Cake.Issues/IssueBuilder.cs
+++ b/src/Cake.Issues/IssueBuilder.cs
@@ -25,6 +25,7 @@ public class IssueBuilder
private int? priority;
private string priorityName;
private string rule;
+ private string ruleName;
private Uri ruleUrl;
private string run;
private FileLinkSettings fileLinkSettings;
@@ -397,12 +398,12 @@ public IssueBuilder WithPriority(int? value, string name)
///
/// Sets the rule of the issue.
///
- /// The rule of the issue.
+ /// The ID of the rule of the issue.
/// null or if issue has no specific rule ID.
/// Issue Builder instance.
- public IssueBuilder OfRule(string name)
+ public IssueBuilder OfRule(string id)
{
- this.rule = name;
+ this.rule = id;
return this;
}
@@ -410,14 +411,49 @@ public IssueBuilder OfRule(string name)
///
/// Sets the rule of the issue.
///
- /// The rule of the issue.
+ /// The ID of the rule of the issue.
/// null or if issue has no specific rule ID.
+ /// The name of the rule of the issue.
+ /// null or if issue has no specific rule name.
+ /// Issue Builder instance.
+ public IssueBuilder OfRule(string id, string name)
+ {
+ this.rule = id;
+ this.ruleName = name;
+
+ return this;
+ }
+
+ ///
+ /// Sets the rule of the issue.
+ ///
+ /// The ID of the rule of the issue.
+ /// null or if issue has no specific rule ID.
+ /// The URL containing information about the failing rule.
+ /// null if no URL is available.
+ /// Issue Builder instance.
+ public IssueBuilder OfRule(string id, Uri uri)
+ {
+ this.rule = id;
+ this.ruleUrl = uri;
+
+ return this;
+ }
+
+ ///
+ /// Sets the rule of the issue.
+ ///
+ /// The ID of the rule of the issue.
+ /// null or if issue has no specific rule ID.
+ /// The name of the rule of the issue.
+ /// null or if issue has no specific rule name.
/// The URL containing information about the failing rule.
/// null if no URL is available.
/// Issue Builder instance.
- public IssueBuilder OfRule(string name, Uri uri)
+ public IssueBuilder OfRule(string id, string name, Uri uri)
{
- this.rule = name;
+ this.rule = id;
+ this.ruleName = name;
this.ruleUrl = uri;
return this;
@@ -472,6 +508,7 @@ private Issue CreateIssue(Uri fileLink)
this.priority,
this.priorityName,
this.rule,
+ this.ruleName,
this.ruleUrl,
this.run,
this.providerType,
diff --git a/src/Cake.Issues/Serialization/IssueDeserializationExtensions.cs b/src/Cake.Issues/Serialization/IssueDeserializationExtensions.cs
index df6323c36..d1f037f2d 100644
--- a/src/Cake.Issues/Serialization/IssueDeserializationExtensions.cs
+++ b/src/Cake.Issues/Serialization/IssueDeserializationExtensions.cs
@@ -128,6 +128,7 @@ private static Issue DeserializeJsonDataToIssue(JsonData data)
2 => JsonMapper.ToObject(data.ToJson()).ToIssue(),
3 => JsonMapper.ToObject(data.ToJson()).ToIssue(),
4 => JsonMapper.ToObject(data.ToJson()).ToIssue(),
+ 5 => JsonMapper.ToObject(data.ToJson()).ToIssue(),
_ => throw new Exception($"Not supported issue serialization format {version}"),
};
}
diff --git a/src/Cake.Issues/Serialization/IssueSerializationExtensions.cs b/src/Cake.Issues/Serialization/IssueSerializationExtensions.cs
index 0247a0dd5..38c7bb207 100644
--- a/src/Cake.Issues/Serialization/IssueSerializationExtensions.cs
+++ b/src/Cake.Issues/Serialization/IssueSerializationExtensions.cs
@@ -74,11 +74,11 @@ public static void SerializeToJsonFile(this IEnumerable issues, FilePath
///
/// Issue which should be converted.
/// Converted issue.
- internal static SerializableIssueV4 ToSerializableIssue(this IIssue issue)
+ internal static SerializableIssueV5 ToSerializableIssue(this IIssue issue)
{
issue.NotNull(nameof(issue));
- return new SerializableIssueV4
+ return new SerializableIssueV5
{
Identifier = issue.Identifier,
ProjectFileRelativePath = issue.ProjectFileRelativePath?.FullPath,
@@ -94,7 +94,8 @@ internal static SerializableIssueV4 ToSerializableIssue(this IIssue issue)
MessageHtml = issue.MessageHtml,
Priority = issue.Priority,
PriorityName = issue.PriorityName,
- Rule = issue.Rule,
+ RuleId = issue.RuleId,
+ RuleName = issue.RuleName,
RuleUrl = issue.RuleUrl?.ToString(),
Run = issue.Run,
ProviderType = issue.ProviderType,
diff --git a/src/Cake.Issues/Serialization/SerializableIssue.cs b/src/Cake.Issues/Serialization/SerializableIssue.cs
index 86579bd1d..01ea06764 100644
--- a/src/Cake.Issues/Serialization/SerializableIssue.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssue.cs
@@ -26,7 +26,7 @@ internal class SerializableIssue
///
public string PriorityName { get; set; }
- ///
+ ///
public string Rule { get; set; }
///
diff --git a/src/Cake.Issues/Serialization/SerializableIssueExtensions.cs b/src/Cake.Issues/Serialization/SerializableIssueExtensions.cs
index 2a9fb5f3a..5d31d46b7 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueExtensions.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueExtensions.cs
@@ -43,6 +43,7 @@ internal static Issue ToIssue(this SerializableIssue serializableIssue)
serializableIssue.Priority,
serializableIssue.PriorityName,
serializableIssue.Rule,
+ null,
ruleUrl,
null,
serializableIssue.ProviderType,
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV2.cs b/src/Cake.Issues/Serialization/SerializableIssueV2.cs
index 9afe5e54c..bc1ad2959 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV2.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV2.cs
@@ -56,7 +56,7 @@ public int Version
[DataMember]
public string PriorityName { get; set; }
- ///
+ ///
[DataMember]
public string Rule { get; set; }
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV2Extensions.cs b/src/Cake.Issues/Serialization/SerializableIssueV2Extensions.cs
index e0d63c4a4..b8d90b746 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV2Extensions.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV2Extensions.cs
@@ -43,6 +43,7 @@ internal static Issue ToIssue(this SerializableIssueV2 serializableIssue)
serializableIssue.Priority,
serializableIssue.PriorityName,
serializableIssue.Rule,
+ null,
ruleUrl,
null,
serializableIssue.ProviderType,
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV3.cs b/src/Cake.Issues/Serialization/SerializableIssueV3.cs
index 5c9ac648a..408171b1f 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV3.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV3.cs
@@ -76,7 +76,7 @@ public int Version
[DataMember]
public string PriorityName { get; set; }
- ///
+ ///
[DataMember]
public string Rule { get; set; }
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV3Extensions.cs b/src/Cake.Issues/Serialization/SerializableIssueV3Extensions.cs
index 540a095cd..37cb78727 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV3Extensions.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV3Extensions.cs
@@ -49,6 +49,7 @@ internal static Issue ToIssue(this SerializableIssueV3 serializableIssue)
serializableIssue.Priority,
serializableIssue.PriorityName,
serializableIssue.Rule,
+ null,
ruleUrl,
serializableIssue.Run,
serializableIssue.ProviderType,
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV4.cs b/src/Cake.Issues/Serialization/SerializableIssueV4.cs
index 7c042bb77..d7aa9d637 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV4.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV4.cs
@@ -77,7 +77,7 @@ public int Version
[DataMember]
public string PriorityName { get; set; }
- ///
+ ///
[DataMember]
public string Rule { get; set; }
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV4Extensions.cs b/src/Cake.Issues/Serialization/SerializableIssueV4Extensions.cs
index b636181e1..ac9408153 100644
--- a/src/Cake.Issues/Serialization/SerializableIssueV4Extensions.cs
+++ b/src/Cake.Issues/Serialization/SerializableIssueV4Extensions.cs
@@ -48,6 +48,7 @@ internal static Issue ToIssue(this SerializableIssueV4 serializableIssue)
serializableIssue.Priority,
serializableIssue.PriorityName,
serializableIssue.Rule,
+ null,
ruleUrl,
serializableIssue.Run,
serializableIssue.ProviderType,
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV5.cs b/src/Cake.Issues/Serialization/SerializableIssueV5.cs
new file mode 100644
index 000000000..51b7ea449
--- /dev/null
+++ b/src/Cake.Issues/Serialization/SerializableIssueV5.cs
@@ -0,0 +1,108 @@
+namespace Cake.Issues.Serialization
+{
+ using System.Collections.Generic;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Class for serializing and deserializing an instance.
+ ///
+ [DataContract]
+ internal class SerializableIssueV5
+ {
+ ///
+ /// Gets the version of the serialization format.
+ ///
+ [DataMember]
+ public int Version
+ {
+ get
+ {
+ return 5;
+ }
+ }
+
+ ///
+ [DataMember]
+ public string Identifier { get; set; }
+
+ ///
+ [DataMember]
+ public string ProjectFileRelativePath { get; set; }
+
+ ///
+ [DataMember]
+ public string ProjectName { get; set; }
+
+ ///
+ [DataMember]
+ public string AffectedFileRelativePath { get; set; }
+
+ ///
+ [DataMember]
+ public int? Line { get; set; }
+
+ ///
+ [DataMember]
+ public int? EndLine { get; set; }
+
+ ///
+ [DataMember]
+ public int? Column { get; set; }
+
+ ///
+ [DataMember]
+ public int? EndColumn { get; set; }
+
+ ///
+ [DataMember]
+ public string FileLink { get; set; }
+
+ ///
+ [DataMember]
+ public string MessageText { get; set; }
+
+ ///
+ [DataMember]
+ public string MessageMarkdown { get; set; }
+
+ ///
+ [DataMember]
+ public string MessageHtml { get; set; }
+
+ ///
+ [DataMember]
+ public int? Priority { get; set; }
+
+ ///
+ [DataMember]
+ public string PriorityName { get; set; }
+
+ ///
+ [DataMember]
+ public string RuleId { get; set; }
+
+ ///
+ [DataMember]
+ public string RuleName { get; set; }
+
+ ///
+ [DataMember]
+ public string RuleUrl { get; set; }
+
+ ///
+ [DataMember]
+ public string ProviderType { get; set; }
+
+ ///
+ [DataMember]
+ public string ProviderName { get; set; }
+
+ ///
+ [DataMember]
+ public string Run { get; set; }
+
+ ///
+ [DataMember]
+ public Dictionary AdditionalInformation { get; set; }
+ }
+}
diff --git a/src/Cake.Issues/Serialization/SerializableIssueV5Extensions.cs b/src/Cake.Issues/Serialization/SerializableIssueV5Extensions.cs
new file mode 100644
index 000000000..11b68d4a3
--- /dev/null
+++ b/src/Cake.Issues/Serialization/SerializableIssueV5Extensions.cs
@@ -0,0 +1,61 @@
+namespace Cake.Issues.Serialization
+{
+ using System;
+
+ ///
+ /// Extensions for .
+ ///
+ internal static class SerializableIssueV5Extensions
+ {
+ ///
+ /// Converts a to an .
+ ///
+ /// Issue which should be converted.
+ /// Converted issue.
+ internal static Issue ToIssue(this SerializableIssueV5 serializableIssue)
+ {
+#pragma warning disable SA1123 // Do not place regions within elements
+ #region DupFinder Exclusion
+#pragma warning restore SA1123 // Do not place regions within elements
+
+ serializableIssue.NotNull(nameof(serializableIssue));
+
+ Uri ruleUrl = null;
+ if (!string.IsNullOrWhiteSpace(serializableIssue.RuleUrl))
+ {
+ ruleUrl = new Uri(serializableIssue.RuleUrl);
+ }
+
+ Uri fileLink = null;
+ if (!string.IsNullOrWhiteSpace(serializableIssue.FileLink))
+ {
+ fileLink = new Uri(serializableIssue.FileLink);
+ }
+
+ return new Issue(
+ serializableIssue.Identifier,
+ serializableIssue.ProjectFileRelativePath,
+ serializableIssue.ProjectName,
+ serializableIssue.AffectedFileRelativePath,
+ serializableIssue.Line,
+ serializableIssue.EndLine,
+ serializableIssue.Column,
+ serializableIssue.EndColumn,
+ fileLink,
+ serializableIssue.MessageText,
+ serializableIssue.MessageHtml,
+ serializableIssue.MessageMarkdown,
+ serializableIssue.Priority,
+ serializableIssue.PriorityName,
+ serializableIssue.RuleId,
+ serializableIssue.RuleName,
+ ruleUrl,
+ serializableIssue.Run,
+ serializableIssue.ProviderType,
+ serializableIssue.ProviderName,
+ serializableIssue.AdditionalInformation);
+
+ #endregion
+ }
+ }
+}
diff --git a/src/Cake.Issues/StringPathExtensions.cs b/src/Cake.Issues/StringPathExtensions.cs
index 07ea8ff20..142726f51 100644
--- a/src/Cake.Issues/StringPathExtensions.cs
+++ b/src/Cake.Issues/StringPathExtensions.cs
@@ -1,6 +1,4 @@
-// Based on http://stackoverflow.com/a/31941159/566901
-
-namespace Cake.Issues
+namespace Cake.Issues
{
using System;
using System.IO;
@@ -54,6 +52,7 @@ public static bool IsFullPath(this string path)
/// Returns true if starts with the path .
public static bool IsSubpathOf(this string path, string baseDirPath)
{
+ // Based on http://stackoverflow.com/a/31941159/566901
path.NotNullOrWhiteSpace(nameof(path));
baseDirPath.NotNullOrWhiteSpace(nameof(baseDirPath));
@@ -127,6 +126,79 @@ public static string WithEnding(this string value, string ending)
return result;
}
+ ///
+ /// Validates if a file path is a valid path below .
+ ///
+ /// Full file path.
+ /// Repository settings.
+ /// Tuple containing a value if validation was successful,
+ /// and file path relative to .
+ public static (bool Valid, string FilePath) IsValideRepositoryFilePath(this string filePath, IRepositorySettings repositorySettings)
+ {
+ filePath.NotNullOrWhiteSpace(nameof(filePath));
+ repositorySettings.NotNull(nameof(repositorySettings));
+
+ // Ignore files from outside the repository.
+ if (!filePath.IsInRepository(repositorySettings))
+ {
+ return (false, string.Empty);
+ }
+
+ // Make path relative to repository root.
+ filePath = filePath.MakeFilePathRelativeToRepositoryRoot(repositorySettings);
+
+ return (true, filePath);
+ }
+
+ ///
+ /// Checks if a file is part of the repository.
+ ///
+ /// Full file path.
+ /// Repository settings.
+ /// True if file is in repository, false otherwise.
+ public static bool IsInRepository(this string filePath, IRepositorySettings repositorySettings)
+ {
+ filePath.NotNullOrWhiteSpace(nameof(filePath));
+ repositorySettings.NotNull(nameof(repositorySettings));
+
+ return filePath.IsSubpathOf(repositorySettings.RepositoryRoot.FullPath);
+ }
+
+ ///
+ /// Make path relative to repository root.
+ ///
+ /// Full file path.
+ /// Repository settings.
+ /// File path relative to the repository root.
+ public static string MakeFilePathRelativeToRepositoryRoot(this string filePath, IRepositorySettings repositorySettings)
+ {
+ filePath.NotNullOrWhiteSpace(nameof(filePath));
+ repositorySettings.NotNull(nameof(repositorySettings));
+
+ filePath = filePath[repositorySettings.RepositoryRoot.FullPath.Length..];
+
+ // Remove leading directory separator.
+ return filePath.RemoveLeadingDirectorySeparator();
+ }
+
+ ///
+ /// Remove the leading directory separator from a file path.
+ ///
+ /// Full file path.
+ /// File path without leading directory separator.
+ public static string RemoveLeadingDirectorySeparator(this string filePath)
+ {
+ filePath.NotNullOrWhiteSpace(nameof(filePath));
+
+ if (filePath.StartsWith("\\", StringComparison.Ordinal) ||
+ filePath.StartsWith("/", StringComparison.Ordinal))
+ {
+ return filePath[1..];
+ }
+
+ return filePath;
+ }
+
/// Gets the rightmost characters from a string.
/// The string to retrieve the substring from.
/// The number of characters to retrieve.