diff --git a/.appveyor.yml b/.appveyor.yml index 2dde0f9b3..1dbceb116 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -27,5 +27,4 @@ branches: # Build Cache # #---------------------------------# cache: -- src\packages -> src\**\packages.config - tools -> setup.cake diff --git a/cake.config b/cake.config new file mode 100644 index 000000000..8615723e8 --- /dev/null +++ b/cake.config @@ -0,0 +1,3 @@ +[Nuget] +; Use the new InProcess client, because some packages have long file paths. +UseInProcessClient=true \ No newline at end of file diff --git a/nuspec/nuget/Cake.Issues.Testing.nuspec b/nuspec/nuget/Cake.Issues.Testing.nuspec index e78d9cdbe..7e2d46a55 100644 --- a/nuspec/nuget/Cake.Issues.Testing.nuspec +++ b/nuspec/nuget/Cake.Issues.Testing.nuspec @@ -14,13 +14,13 @@ Common helpers for testing add-ins based on Cake.Issues http://cake-contrib.github.io/Cake.Issues.Website/ https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png false - Copyright © 2017 BBT Software AG and contributors + Copyright © BBT Software AG and contributors Cake Script Cake-Issues Issues Testing - https://github.com/cake-contrib/Cake.Issues/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues/releases/tag/0.2.0 - - - + + + \ No newline at end of file diff --git a/nuspec/nuget/Cake.Issues.nuspec b/nuspec/nuget/Cake.Issues.nuspec index 083a9597b..505d2d2f2 100644 --- a/nuspec/nuget/Cake.Issues.nuspec +++ b/nuspec/nuget/Cake.Issues.nuspec @@ -21,13 +21,13 @@ See the Project Site for an overview of the whole ecosystem of addins for workin http://cake-contrib.github.io/Cake.Issues.Website/ https://cdn.rawgit.com/cake-contrib/graphics/a5cf0f881c390650144b2243ae551d5b9f836196/png/cake-contrib-medium.png false - Copyright © 2017 BBT Software AG and contributors + Copyright © BBT Software AG and contributors Cake Script Cake-Issues CodeAnalysis Linting Issues - https://github.com/cake-contrib/Cake.Issues/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues/releases/tag/0.2.0 - - - + + + \ No newline at end of file diff --git a/setup.cake b/setup.cake index 2634e7ee7..24d61f30f 100644 --- a/setup.cake +++ b/setup.cake @@ -9,15 +9,16 @@ BuildParameters.SetParameters( title: "Cake.Issues", repositoryOwner: "cake-contrib", repositoryName: "Cake.Issues", - appVeyorAccountName: "cakecontrib"); + appVeyorAccountName: "cakecontrib", + shouldRunCodecov: false); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings( context: Context, - dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Tests/*.cs" }, + dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.Tests/*.cs", BuildParameters.RootDirectoryPath + "/src/Cake.Issues*/**/*.AssemblyInfo.cs" }, testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ", testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs"); -Build.Run(); +Build.RunDotNetCore(); diff --git a/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj b/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj index 217864679..267e309db 100644 --- a/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj +++ b/src/Cake.Issues.Testing/Cake.Issues.Testing.csproj @@ -1,81 +1,37 @@ - - - + + - Debug - AnyCPU - {95CB4393-DCAE-4E92-960F-98C4236D703E} - Library - Properties - Cake.Issues.Testing - Cake.Issues.Testing - v4.6 - 512 - - - + netstandard2.0 + Common helpers for testing addins based on Cake.Issues + BBT Software AG + BBT Software AG + Copyright © BBT Software AG and contributors + Cake.Issues - - true + + full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - bin\Debug\Cake.Issues.Testing.xml + true ..\Cake.Issues.ruleset - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Cake.Issues.Testing.xml - ..\Cake.Issues.ruleset + + + bin\Debug\netstandard2.0\Cake.Issues.Testing.xml + + + bin\Release\netstandard2.0\Cake.Issues.Testing.xml + + - - ..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll - - - - - - - - - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - - - - - - - - - - - {956ee163-6e8b-44a9-ae58-50185de4f878} - Cake.Issues - - - - + + + + + - - - - - - + - - \ No newline at end of file + + diff --git a/src/Cake.Issues.Testing/Properties/AssemblyInfo.cs b/src/Cake.Issues.Testing/Properties/AssemblyInfo.cs index 35c320168..7ca23649b 100644 --- a/src/Cake.Issues.Testing/Properties/AssemblyInfo.cs +++ b/src/Cake.Issues.Testing/Properties/AssemblyInfo.cs @@ -3,18 +3,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Cake.Issues.Testing")] -[assembly: AssemblyDescription("Common helpers for testing addins based on Cake.Issues")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BBT Software AG")] -[assembly: AssemblyProduct("Cake.Issues")] -[assembly: AssemblyCopyright("Copyright © 2017 BBT Software AG and contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -23,18 +11,5 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("95cb4393-dcae-4e92-960f-98c4236d703e")] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("Cake.Issues.Tests")] \ No newline at end of file diff --git a/src/Cake.Issues.Testing/packages.config b/src/Cake.Issues.Testing/packages.config deleted file mode 100644 index c3ea7ae7e..000000000 --- a/src/Cake.Issues.Testing/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj b/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj index afd962474..68c8829cd 100644 --- a/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj +++ b/src/Cake.Issues.Tests/Cake.Issues.Tests.csproj @@ -1,110 +1,37 @@ - - - - + + - Debug - AnyCPU - {6602FB4A-353A-40B5-8469-69502F189113} - Library - Properties - Cake.Issues.Tests - Cake.Issues.Tests - v4.6 - 512 - - - + netcoreapp2.0 + false + Cake.Issues + Copyright © BBT Software AG and contributors + Tests for the Cake.Issues addin + BBT Software AG + BBT Software AG - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - ..\Cake.Issues.Tests.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + ..\Cake.Issues.Tests.ruleset + - - ..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll - - - ..\packages\Cake.Testing.0.22.0\lib\net46\Cake.Testing.dll - - - ..\packages\Shouldly.2.8.3\lib\net451\Shouldly.dll - - - - - - - - - - - ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll - - - ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll - - - ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll - - - ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll - - - - - - - - - - - - - - - - - - - {95cb4393-dcae-4e92-960f-98c4236d703e} - Cake.Issues.Testing - - - {956ee163-6e8b-44a9-ae58-50185de4f878} - Cake.Issues - - - - - - - + + + + + + + + + + + + + - - + + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file + + diff --git a/src/Cake.Issues.Tests/IssueOfTTests.cs b/src/Cake.Issues.Tests/IssueOfTTests.cs index a612eb1ae..93f1badc7 100644 --- a/src/Cake.Issues.Tests/IssueOfTTests.cs +++ b/src/Cake.Issues.Tests/IssueOfTTests.cs @@ -10,7 +10,7 @@ public class IssueOfTTests public sealed class TheCtor { [Theory] - [InlineData(@"foo - new Issue(@"src\foo.cs", 100, "foo", 1, null)); + var result = Record.Exception(() => new Issue(@"src\foo.cs", 100, "foo", 1, "foo", " ")); // Then - result.IsArgumentNullException("rule"); + result.IsArgumentOutOfRangeException("providerType"); + } + + [Fact] + public void Should_Handle_Projects_Which_Are_Null() + { + // Given / When + var issue = new Issue(null, @"src\foo.cs", null, "Foo", 1, "Bar"); + + // Then + issue.Project.ShouldBe(null); + } + + [Fact] + public void Should_Handle_Projects_Which_Are_WhiteSpace() + { + // Given / When + var issue = new Issue(" ", @"src\foo.cs", null, "Foo", 1, "Bar"); + + // Then + issue.Project.ShouldBe(" "); + } + + [Fact] + public void Should_Handle_Projects_Which_Are_Empty() + { + // Given / When + var issue = new Issue(string.Empty, @"src\foo.cs", null, "Foo", 1, "Bar"); + + // Then + issue.Project.ShouldBe(string.Empty); + } + + [Theory] + [InlineData("project")] + public void Should_Set_Project(string project) + { + // Given / When + var issue = new Issue(project, @"src\foo.cs", null, "Foo", 1, "Bar"); + + // Then + issue.Project.ShouldBe(project); } [Fact] @@ -196,6 +235,8 @@ public void Should_Set_Message(string message) } [Theory] + [InlineData(null)] + [InlineData("")] [InlineData("rule")] public void Should_Set_Rule(string rule) { @@ -220,7 +261,7 @@ public void Should_Set_ProviderType() public sealed class TheIssueOfTCtorWithRuleId { [Theory] - [InlineData(@"foo - new Issue(@"src\foo.cs", 100, "foo", 1, null, new Uri("https://google.com"))); - - // Then - result.IsArgumentNullException("rule"); - } - [Fact] public void Should_Handle_File_Paths_Which_Are_Null() { @@ -406,6 +435,8 @@ public void Should_Set_Message(string message) } [Theory] + [InlineData(null)] + [InlineData("")] [InlineData("rule")] public void Should_Set_Rule(string rule) { diff --git a/src/Cake.Issues.Tests/IssueTests.cs b/src/Cake.Issues.Tests/IssueTests.cs index 7ab3e89ee..71ebd0db1 100644 --- a/src/Cake.Issues.Tests/IssueTests.cs +++ b/src/Cake.Issues.Tests/IssueTests.cs @@ -10,7 +10,7 @@ public sealed class IssueTests public sealed class TheCtor { [Theory] - [InlineData(@"foo new Issue(@"src\foo.cs", 100, "foo", 1, null, "foo")); - - // Then - result.IsArgumentNullException("rule"); - } - [Fact] public void Should_Throw_If_Provider_Type_Is_Null() { @@ -133,6 +123,47 @@ public void Should_Throw_If_Provider_Type_Is_WhiteSpace() result.IsArgumentOutOfRangeException("providerType"); } + [Fact] + public void Should_Handle_Projects_Which_Are_Null() + { + // Given / When + var issue = new Issue(null, @"src\foo.cs", null, "Foo", 1, "Bar", "foo"); + + // Then + issue.Project.ShouldBe(null); + } + + [Fact] + public void Should_Handle_Projects_Which_Are_WhiteSpace() + { + // Given / When + var issue = new Issue(" ", @"src\foo.cs", null, "Foo", 1, "Bar", "foo"); + + // Then + issue.Project.ShouldBe(" "); + } + + [Fact] + public void Should_Handle_Projects_Which_Are_Empty() + { + // Given / When + var issue = new Issue(string.Empty, @"src\foo.cs", null, "Foo", 1, "Bar", "foo"); + + // Then + issue.Project.ShouldBe(string.Empty); + } + + [Theory] + [InlineData("project")] + public void Should_Set_Project(string project) + { + // Given / When + var issue = new Issue(project, @"src\foo.cs", null, "Foo", 1, "Bar", "foo"); + + // Then + issue.Project.ShouldBe(project); + } + [Fact] public void Should_Handle_File_Paths_Which_Are_Null() { @@ -208,6 +239,8 @@ public void Should_Set_Message(string message) } [Theory] + [InlineData(null)] + [InlineData("")] [InlineData("rule")] public void Should_Set_Rule(string rule) { diff --git a/src/Cake.Issues.Tests/Properties/AssemblyInfo.cs b/src/Cake.Issues.Tests/Properties/AssemblyInfo.cs index e7fc5f385..cab692263 100644 --- a/src/Cake.Issues.Tests/Properties/AssemblyInfo.cs +++ b/src/Cake.Issues.Tests/Properties/AssemblyInfo.cs @@ -1,17 +1,8 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Cake.Issues.Tests")] -[assembly: AssemblyDescription("Tests for the Cake.Issues addin")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BBT Software AG")] -[assembly: AssemblyProduct("Cake.Issues")] -[assembly: AssemblyCopyright("Copyright © 2017 BBT Software AG and contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -20,16 +11,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6602fb4a-353a-40b5-8469-69502f189113")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Cake.Issues.Tests/StringPathExtensionsTests.cs b/src/Cake.Issues.Tests/StringPathExtensionsTests.cs index 19da1237c..c84feaa8f 100644 --- a/src/Cake.Issues.Tests/StringPathExtensionsTests.cs +++ b/src/Cake.Issues.Tests/StringPathExtensionsTests.cs @@ -49,7 +49,7 @@ public void Should_Throw_If_Path_Is_WhiteSpace() [InlineData(@"c:\foo\")] [InlineData(@"c:\foo\bar")] [InlineData(@"/foo")] - [InlineData(@"/foo")] + [InlineData(@"/foo/")] [InlineData(@"/foo/bar")] public void Should_Return_True_If_Valid_Path(string path) { @@ -61,7 +61,7 @@ public void Should_Return_True_If_Valid_Path(string path) } [Theory] - [InlineData(@"foo @"c:\foo "c:\\foo\tbar".IsFullPath()); // Then result.IsArgumentException("path"); @@ -135,7 +135,7 @@ public void Should_Return_True_If_Full_Path(string path) [InlineData(@"\foo\")] [InlineData(@"\foo\bar")] [InlineData(@"/foo")] - [InlineData(@"/foo")] + [InlineData(@"/foo/")] [InlineData(@"/foo/bar")] public void Should_Return_False_If_Not_Full_Path(string path) { @@ -183,7 +183,7 @@ public void Should_Throw_If_Path_Is_WhiteSpace() public void Should_Throw_If_Path_Is_Invalid() { // Given / When - var result = Record.Exception(() => @"c:\foo "c:\\foo\tbar".IsSubpathOf(@"c:\foo")); // Then result.IsArgumentException("path"); @@ -223,7 +223,7 @@ public void Should_Throw_If_BaseDirPath_Is_WhiteSpace() public void Should_Throw_If_BaseDirPath_Is_Invalid() { // Given / When - var result = Record.Exception(() => @"c:\foo\bar".IsSubpathOf(@"c:\f @"c:\foo\bar".IsSubpathOf("c:\\f\to")); // Then result.IsArgumentException("baseDirPath"); @@ -250,7 +250,7 @@ public void Should_Return_True_If_SubPath(string path, string baseDir) [InlineData(@"c:\foobar\a.txt", @"c:\foo")] [InlineData(@"c:\foobar\a.txt", @"c:\foo\")] [InlineData(@"c:\foo\a.txt", @"c:\foobar")] - [InlineData(@"c:\foo\a.txt", @"c:\foobar")] + [InlineData(@"c:\foo\a.txt", @"c:\foobar\")] public void Should_Return_False_If_Not_SubPath(string path, string baseDir) { // Given / When @@ -361,7 +361,7 @@ public void Should_Throw_If_Path_Is_WhiteSpace() public void Should_Throw_If_Path_Is_Invalid() { // Given / When - var result = Record.Exception(() => @"c:\foo "c:\\foo\tbar".NormalizePath()); // Then result.IsArgumentException("path"); diff --git a/src/Cake.Issues.Tests/packages.config b/src/Cake.Issues.Tests/packages.config deleted file mode 100644 index 999de422a..000000000 --- a/src/Cake.Issues.Tests/packages.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.Issues/Aliases.cs b/src/Cake.Issues/Aliases.cs index 11f2cf697..3867af454 100644 --- a/src/Cake.Issues/Aliases.cs +++ b/src/Cake.Issues/Aliases.cs @@ -26,7 +26,7 @@ public static class Aliases /// MsBuildIssuesFromFilePath( /// @"C:\build\msbuild.log", /// MsBuildXmlFileLoggerFormat), - /// new DirectoryPath("c:\repo"))); + /// @"c:\repo")); /// ]]> /// /// @@ -68,7 +68,7 @@ public static IEnumerable ReadIssues( /// @"C:\build\inspectcode.log", /// MsBuildXmlFileLoggerFormat) /// }, - /// new DirectoryPath("c:\repo"))); + /// @"c:\repo")); /// ]]> /// /// @@ -104,7 +104,7 @@ public static IEnumerable ReadIssues( /// /// ReadIssues( /// /// - - + + - Debug - AnyCPU - {956EE163-6E8B-44A9-AE58-50185DE4F878} - Library - Properties - Cake.Issues - Cake.Issues - v4.6 - 512 - - - + netstandard2.0 + Addin for reading code analyzer or linter issues for the Cake build automation system + BBT Software AG + BBT Software AG + Copyright © BBT Software AG and contributors - - true + + full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 + true ..\Cake.Issues.ruleset - bin\Debug\Cake.Issues.xml - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Cake.Issues.xml - ..\Cake.Issues.ruleset + + + bin\Debug\netstandard2.0\Cake.Issues.xml + + + bin\Release\netstandard2.0\Cake.Issues.xml + + - - ..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - \ No newline at end of file + + diff --git a/src/Cake.Issues/IIssue.cs b/src/Cake.Issues/IIssue.cs index d10e1d8b6..954723119 100644 --- a/src/Cake.Issues/IIssue.cs +++ b/src/Cake.Issues/IIssue.cs @@ -8,6 +8,12 @@ /// public interface IIssue { + /// + /// Gets the name of the project to which the file affected by the issue belongs. + /// Can be null or if issue is not related to a project. + /// + string Project { get; } + /// /// Gets the path to the file affacted by the issue. /// The path is relative to the repository root. @@ -17,7 +23,7 @@ public interface IIssue /// /// Gets the line in the file where the issues has occurred. - /// Nothing if the issue affects the whole file or an asssembly. + /// null if the issue affects the whole file or an asssembly. /// int? Line { get; } @@ -33,6 +39,7 @@ public interface IIssue /// /// Gets the rule of the issue. + /// Can be null or if the issue provider provides no rule. /// string Rule { get; } diff --git a/src/Cake.Issues/Issue.cs b/src/Cake.Issues/Issue.cs index f49f45d0f..1bf9e8902 100644 --- a/src/Cake.Issues/Issue.cs +++ b/src/Cake.Issues/Issue.cs @@ -15,10 +15,11 @@ public class Issue : IIssue /// The path needs to be relative to the repository root. /// null or if issue is not related to a change in a file. /// The line in the file where the issues has occurred. - /// Nothing if the issue affects the whole file or an asssembly. + /// null if the issue affects the whole file or an asssembly. /// The message of the issue. /// The priority of the message. - /// The rule of the issue. + /// The rule of the issue. + /// null or if issue has no specific rule ID. /// The type of the issue provider. public Issue( string filePath, @@ -38,11 +39,13 @@ public Issue( /// The path needs to be relative to the repository root. /// null or if issue is not related to a change in a file. /// The line in the file where the issues has occurred. - /// Nothing if the issue affects the whole file or an asssembly. + /// null if the issue affects the whole file or an asssembly. /// The message of the issue. /// The priority of the message. - /// The rule of the issue. - /// The URL containing information about the failing rule. + /// 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. /// The type of the issue provider. public Issue( string filePath, @@ -52,10 +55,66 @@ public Issue( string rule, Uri ruleUrl, string providerType) + : this(null, filePath, line, message, priority, rule, ruleUrl, providerType) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Name of the project to which the file affected by the issue belongs. + /// null or if issue is not related to a project. + /// The path to the file affacted by the issue. + /// The path needs to be relative to the repository root. + /// null or if issue is not related to a change in a file. + /// The line in the file where the issues has occurred. + /// null if the issue affects the whole file or an asssembly. + /// The message of the issue. + /// The priority of the message. + /// The rule of the issue. + /// null or if issue has no specific rule ID. + /// The type of the issue provider. + public Issue( + string project, + string filePath, + int? line, + string message, + int priority, + string rule, + string providerType) + : this(project, filePath, line, message, priority, rule, null, providerType) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Name of the project to which the file affected by the issue belongs. + /// null or if issue is not related to a project. + /// The path to the file affacted by the issue. + /// The path needs to be relative to the repository root. + /// null or if issue is not related to a change in a file. + /// The line in the file where the issues has occurred. + /// null if the issue affects the whole file or an asssembly. + /// The message of the issue. + /// The priority of the message. + /// 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. + /// The type of the issue provider. + public Issue( + string project, + string filePath, + int? line, + string message, + int priority, + string rule, + Uri ruleUrl, + string providerType) { line?.NotNegativeOrZero(nameof(line)); message.NotNullOrWhiteSpace(nameof(message)); - rule.NotNull(nameof(rule)); providerType.NotNullOrWhiteSpace(nameof(providerType)); // File path needs to be relative to the repository root. @@ -79,6 +138,7 @@ public Issue( throw new ArgumentOutOfRangeException(nameof(line), "Cannot specify a line while not specifying a file."); } + this.Project = project; this.Line = line; this.Message = message; this.Priority = priority; @@ -87,6 +147,9 @@ public Issue( this.ProviderType = providerType; } + /// + public string Project { get; } + /// public FilePath AffectedFileRelativePath { get; } diff --git a/src/Cake.Issues/Issue{T}.cs b/src/Cake.Issues/Issue{T}.cs index d976aef8e..a30944791 100644 --- a/src/Cake.Issues/Issue{T}.cs +++ b/src/Cake.Issues/Issue{T}.cs @@ -16,10 +16,11 @@ public class Issue : Issue /// The path needs to be relative to the repository root. /// null or if issue is not related to a change in a file. /// The line in the file where the issues has occurred. - /// Nothing if the issue affects the whole file or an asssembly. + /// null if the issue affects the whole file or an asssembly. /// The message of the issue. /// The priority of the message. - /// The rule of the issue. + /// The rule of the issue. + /// null or if issue has no specific rule ID. public Issue( string filePath, int? line, @@ -37,11 +38,13 @@ public Issue( /// The path needs to be relative to the repository root. /// null or if issue is not related to a change in a file. /// The line in the file where the issues has occurred. - /// Nothing if the issue affects the whole file or an asssembly. + /// null if the issue affects the whole file or an asssembly. /// The message of the issue. /// The priority of the message. - /// The rule of the issue. - /// The URL containing information about the failing rule. + /// 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. public Issue( string filePath, int? line, @@ -53,6 +56,59 @@ public Issue( { } + /// + /// Initializes a new instance of the class. + /// + /// Name of the project to which the file affected by the issue belongs. + /// null or if issue is not related to a project. + /// The path to the file affacted by the issue. + /// The path needs to be relative to the repository root. + /// null or if issue is not related to a change in a file. + /// The line in the file where the issues has occurred. + /// null if the issue affects the whole file or an asssembly. + /// The message of the issue. + /// The priority of the message. + /// The rule of the issue. + /// null or if issue has no specific rule ID. + public Issue( + string project, + string filePath, + int? line, + string message, + int priority, + string rule) + : base(project, filePath, line, message, priority, rule, null, GetProviderTypeName()) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// Name of the project to which the file affected by the issue belongs. + /// null or if issue is not related to a project. + /// The path to the file affacted by the issue. + /// The path needs to be relative to the repository root. + /// null or if issue is not related to a change in a file. + /// The line in the file where the issues has occurred. + /// null if the issue affects the whole file or an asssembly. + /// The message of the issue. + /// The priority of the message. + /// 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. + public Issue( + string project, + string filePath, + int? line, + string message, + int priority, + string rule, + Uri ruleUrl) + : base(project, filePath, line, message, priority, rule, ruleUrl, GetProviderTypeName()) + { + } + /// /// Gets the name of the issue provider as it will be set to in the property. /// diff --git a/src/Cake.Issues/Properties/AssemblyInfo.cs b/src/Cake.Issues/Properties/AssemblyInfo.cs index 0e3638e9b..4f059550c 100644 --- a/src/Cake.Issues/Properties/AssemblyInfo.cs +++ b/src/Cake.Issues/Properties/AssemblyInfo.cs @@ -1,20 +1,7 @@ using System; -using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Cake.Issues")] -[assembly: AssemblyDescription("Addin for reading code analyzer or linter issues for the Cake build automation system")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("BBT Software AG")] -[assembly: AssemblyProduct("Cake.Issues")] -[assembly: AssemblyCopyright("Copyright © 2017 BBT Software AG and contributors")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. @@ -23,18 +10,5 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("956ee163-6e8b-44a9-ae58-50185de4f878")] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("Cake.Issues.Tests")] \ No newline at end of file diff --git a/src/Cake.Issues/packages.config b/src/Cake.Issues/packages.config deleted file mode 100644 index a9329ce58..000000000 --- a/src/Cake.Issues/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config index ea7b9500f..af3212e12 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + \ No newline at end of file