diff --git a/.appveyor.yml b/.appveyor.yml index bd21071..2b5f541 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -27,5 +27,4 @@ branches: # Build Cache # #---------------------------------# cache: -- src\packages -> src\**\packages.config - tools -> setup.cake \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f39b267 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.cs] +indent_style = space +indent_size = 4 diff --git a/cake.config b/cake.config new file mode 100644 index 0000000..8615723 --- /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.EsLint.nuspec b/nuspec/nuget/Cake.Issues.EsLint.nuspec index b94e840..705ba19 100644 --- a/nuspec/nuget/Cake.Issues.EsLint.nuspec +++ b/nuspec/nuget/Cake.Issues.EsLint.nuspec @@ -21,13 +21,13 @@ See the Project Site for an overview of the whole ecosystem of addins for workin https://github.com/cake-contrib/Cake.Issues.EsLint 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 Cake-IssueProvider CodeAnalysis JavaScript Linting ESLint - https://github.com/cake-contrib/Cake.Issues.ESLint/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues.ESLint/releases/tag/0.2.0 - - - + + + \ No newline at end of file diff --git a/setup.cake b/setup.cake index 1408ad8..6544a1f 100644 --- a/setup.cake +++ b/setup.cake @@ -9,15 +9,16 @@ BuildParameters.SetParameters( title: "Cake.Issues.EsLint", repositoryOwner: "cake-contrib", repositoryName: "Cake.Issues.EsLint", - appVeyorAccountName: "cakecontrib"); + appVeyorAccountName: "cakecontrib", + shouldRunCodecov: false); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings( context: Context, - dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.EsLint.Tests/*.cs" }, + dupFinderExcludePattern: new string[] { BuildParameters.RootDirectoryPath + "/src/Cake.Issues.EsLint.Tests/*.cs", BuildParameters.RootDirectoryPath + "/src/Cake.Issues.EsLint*/**/*.AssemblyInfo.cs" }, testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* -[Cake.Issues]* -[Cake.Issues.Testing]*", testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs"); -Build.Run(); +Build.RunDotNetCore(); diff --git a/src/Cake.Issues.EsLint.Tests/Cake.Issues.EsLint.Tests.csproj b/src/Cake.Issues.EsLint.Tests/Cake.Issues.EsLint.Tests.csproj index 98228e6..7a600da 100644 --- a/src/Cake.Issues.EsLint.Tests/Cake.Issues.EsLint.Tests.csproj +++ b/src/Cake.Issues.EsLint.Tests/Cake.Issues.EsLint.Tests.csproj @@ -1,110 +1,50 @@ - - - - + + - Debug - AnyCPU - {4A657D7C-B66B-49C8-B1E2-544EFF8525F6} - Library - Properties - Cake.Issues.EsLint.Tests - Cake.Issues.EsLint.Tests - v4.6 - 512 - - - + netcoreapp2.0 + false + Cake.Issues + Copyright © BBT Software AG and contributors + Tests for the Cake.Issues.EsLint addin + BBT Software AG + BBT Software AG - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - ..\Cake.Issues.EsLint.Tests.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + + + ..\Cake.Issues.EsLint.Tests.ruleset + + - - ..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll - - - ..\packages\Cake.Issues.0.1.0\lib\net45\Cake.Issues.dll - - - ..\packages\Cake.Issues.Testing.0.1.0\lib\net45\Cake.Issues.Testing.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 - - - - - - - - - - - - - - {eac1d76a-a763-4ea8-8b9d-7b2f71b7ea8b} - Cake.Issues.EsLint - + + + + - - - - + + + + + + + + + + + + + + + + - - + - - - - 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.EsLint.Tests/Properties/AssemblyInfo.cs b/src/Cake.Issues.EsLint.Tests/Properties/AssemblyInfo.cs index b415e75..6043c72 100644 --- a/src/Cake.Issues.EsLint.Tests/Properties/AssemblyInfo.cs +++ b/src/Cake.Issues.EsLint.Tests/Properties/AssemblyInfo.cs @@ -1,18 +1,6 @@ using System.Reflection; 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.EsLint.Tests")] -[assembly: AssemblyDescription("Tests for the Cake.Issues.EsLint 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 // COM, set the ComVisible attribute to true on that type. @@ -20,16 +8,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4a657d7c-b66b-49c8-b1e2-544eff8525f6")] - -// 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.EsLint.Tests/packages.config b/src/Cake.Issues.EsLint.Tests/packages.config deleted file mode 100644 index 14de413..0000000 --- a/src/Cake.Issues.EsLint.Tests/packages.config +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Cake.Issues.EsLint/Cake.Issues.EsLint.csproj b/src/Cake.Issues.EsLint/Cake.Issues.EsLint.csproj index 6ed31bb..145e25d 100644 --- a/src/Cake.Issues.EsLint/Cake.Issues.EsLint.csproj +++ b/src/Cake.Issues.EsLint/Cake.Issues.EsLint.csproj @@ -1,94 +1,34 @@ - - - + + - Debug - AnyCPU - {EAC1D76A-A763-4EA8-8B9D-7B2F71B7EA8B} - Library - Properties - Cake.Issues.EsLint - Cake.Issues.EsLint - v4.6 - 512 - - - + netstandard2.0 + EsLint support for the Cake.Issues Addin for Cake Build Automation System + 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.EsLint.xml + true ..\Cake.Issues.EsLint.ruleset - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Cake.Issues.EsLint.xml - ..\Cake.Issues.EsLint.ruleset + + + bin\Debug\netstandard1.6\Cake.Issues.EsLint.xml + + + bin\Release\netstandard1.6\Cake.Issues.EsLint.xml + + - - ..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll - - - ..\packages\Cake.Issues.0.1.0\lib\net45\Cake.Issues.dll - - - ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll - False - - - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - 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.EsLint/EsLintDataContracts.cs b/src/Cake.Issues.EsLint/EsLintDataContracts.cs new file mode 100644 index 0000000..7ae7c50 --- /dev/null +++ b/src/Cake.Issues.EsLint/EsLintDataContracts.cs @@ -0,0 +1,50 @@ +namespace Cake.Issues.EsLint +{ + using System.Runtime.Serialization; + +#pragma warning disable SA1401 // Fields must be private +#pragma warning disable SA1307 // Accessible fields must begin with upper-case letter +#pragma warning disable SA1402 // File may only contain a single class +#pragma warning disable SA1600 // Elements must be documented +#pragma warning disable SA1649 // File name must match first type name + + [DataContract] + internal class LogFile + { + [DataMember] + public string filePath; + + [DataMember] + public Message[] messages; + } + + [DataContract] + internal class Message + { + [DataMember] + public string ruleId; + + [DataMember] + public int severity; + + [DataMember] + public string message; + + [DataMember] + public int line; + + [DataMember] + public int column; + + [DataMember] + public string nodeType; + + [DataMember] + public string source; + } +#pragma warning restore SA1401 // Fields must be private +#pragma warning restore SA1307 // Accessible fields must begin with upper-case letter +#pragma warning restore SA1402 // File may only contain a single class +#pragma warning restore SA1600 // Elements must be documented +#pragma warning restore SA1649 // File name must match first type name +} diff --git a/src/Cake.Issues.EsLint/FodyWeavers.xml b/src/Cake.Issues.EsLint/FodyWeavers.xml deleted file mode 100644 index c6e1b7c..0000000 --- a/src/Cake.Issues.EsLint/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Cake.Issues.EsLint/JsonFormat.cs b/src/Cake.Issues.EsLint/JsonFormat.cs index 48a2f01..b2427b9 100644 --- a/src/Cake.Issues.EsLint/JsonFormat.cs +++ b/src/Cake.Issues.EsLint/JsonFormat.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; + using System.Runtime.Serialization.Json; + using System.Text; using Core.Diagnostics; - using Newtonsoft.Json; - using Newtonsoft.Json.Linq; /// /// ESLint Json format. @@ -29,22 +29,31 @@ public JsonFormat(ICakeLog log) repositorySettings.NotNull(nameof(repositorySettings)); esLintsettings.NotNull(nameof(esLintsettings)); - var logFileEntries = - JsonConvert.DeserializeObject>(esLintsettings.LogFileContent); + IEnumerable logFileEntries = null; + using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(esLintsettings.LogFileContent))) + { + var jsonSerializer = new DataContractJsonSerializer(typeof(LogFile[])); + logFileEntries = jsonSerializer.ReadObject(ms) as LogFile[]; + } + + if (logFileEntries != null) + { + return + from file in logFileEntries + from message in file.messages + let + rule = message.ruleId + select + new Issue( + GetRelativeFilePath(file.filePath, repositorySettings), + message.line, + message.message, + message.severity, + rule, + EsLintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); + } - return - from file in logFileEntries - from message in file.SelectToken("messages") - let - rule = (string)message.SelectToken("ruleId") - select - new Issue( - GetRelativeFilePath((string)file.SelectToken("filePath"), repositorySettings), - (int)message.SelectToken("line"), - (string)message.SelectToken("message"), - (int)message.SelectToken("severity"), - rule, - EsLintRuleUrlResolver.Instance.ResolveRuleUrl(rule)); + return new List(); } private static string GetRelativeFilePath( diff --git a/src/Cake.Issues.EsLint/Properties/AssemblyInfo.cs b/src/Cake.Issues.EsLint/Properties/AssemblyInfo.cs index 690f79d..e9fa8b7 100644 --- a/src/Cake.Issues.EsLint/Properties/AssemblyInfo.cs +++ b/src/Cake.Issues.EsLint/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.EsLint")] -[assembly: AssemblyDescription("EsLint support for the Cake.Issues Addin for 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 +11,5 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("eac1d76a-a763-4ea8-8b9d-7b2f71b7ea8b")] -// 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.EsLint.Tests")] diff --git a/src/Cake.Issues.EsLint/packages.config b/src/Cake.Issues.EsLint/packages.config deleted file mode 100644 index d248840..0000000 --- a/src/Cake.Issues.EsLint/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/packages.config b/tools/packages.config index 754904e..af3212e 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + \ No newline at end of file