Git Product home page Git Product logo

dotnet-delice's Introduction

CI build Release build NuGet Badge The MIT License

dotnet-delice

delice is a tool for determining the license information of the packages that are referenced in a project/solution. This is a port of the Node.js utility delice, created by Tierney Cyren.

Note: dotnet-delice only supports SDK project files for C#, F# and VB.NET (although I'm not sure on VB.NET, never tried it!), not the legacy "MSBuild style" project files (which only support .NET full framework). If you are still using the legacy project file the tool will fail. I'd encourage you to try and upgrade (using a tool such as CsprojToVs2017).

Usage

This tool ships as a dotnet global tool and can be installed like so:

dotnet tool install -g dotnet-delice

You can then use it like so:

dotnet delice [folder, sln, csproj, fsproj]

Commands

  • -?|-h|--help Boolean. Show help.
  • -j|--json Boolean. Output results as JSON rather than pretty-print.
  • --json-output [path] String. Path to file that the JSON should be written to. Note: Only in use if you use -j|--json.
  • --check-github Boolean. If the license URL (for a legacy package) points to a GitHub hosted file, use the GitHub API to try and retrieve the license type.
  • --github-token <token> String. A GitHub Personal Access Token (PAT) to use when checking the GitHub API for license types. This avoids being rate limited when checking a project.
  • --check-license-content Boolean. When provided the contents of the license file will be compared to known templates.
  • --refresh-spdx Boolean. When provided the tool will also refresh the SPDX license cache used for conformance infomation.

Output

  • Project Name
    • The name of the project that was checked
  • License Expression
    • A license expression found when parsing references
    • Some packages may result in an undetermined license. See Undetermined Licenses for more information
  • Packages
    • The name(s) of the packages found for that license

The following is an example of pretty-printed output:

Project dotnet-delice
License Expression: MIT
β”œβ”€β”€ There are 10 occurances of MIT
β”œβ”€β”¬ Conformance:
β”‚ β”œβ”€β”€ Is OSI Approved: true
β”‚ β”œβ”€β”€ Is FSF Free/Libre: true
β”‚ └── Included deprecated IDs: false
└─┬ Packages:
  β”œβ”€β”€ FSharp.Core
  β”œβ”€β”€ Microsoft.NETCore.App
  β”œβ”€β”€ Microsoft.NETCore.DotNetAppHost
  β”œβ”€β”€ Microsoft.NETCore.DotNetHostPolicy
  β”œβ”€β”€ Microsoft.NETCore.DotNetHostResolver
  β”œβ”€β”€ Microsoft.NETCore.Platforms
  β”œβ”€β”€ Microsoft.NETCore.Targets
  β”œβ”€β”€ NETStandard.Library
  β”œβ”€β”€ Newtonsoft.Json
  └── System.ComponentModel.Annotations

Roadmap

  • Ability to filter for only a particular license
  • Anything you'd like? Open an issue 😁

Undetermined Licenses

At the end of 2018 the licenseUrl field in the nuspec file was deprecated to be replaced with a richer license metadata field. You can read more about it in the annuncement, the documentation and Spec wiki.

This new metadata makes it possible to determine from the package what the license in use by a package is, rather than relying on navigating through to the referred license file.

Some NuGet packages have moved over to the new format, but many of them are still using the legacy approach which makes it difficult for delice to determine what the license is of a package.

By default these packages will be reported with an "Unable to determine" license type with the URL of the license URL included in the output but there are two options that can be set at the CLI to help attempt to discover what the license is.

Using GitHub's API to Check Licenses

Projects hosted on GitHub will often have their license shown on the repository header, which is done by GitHub scanning the license file in the repository and determine the appropriate type. This can be accessed via GitHub's API and delice provides an integration to it.

When the --check-github flag is set delice will check if the projects license URL points to a GitHub-hosted file, if it does, it'll attempt to get the owner and repo name from the URL to then call the GitHub API. If the API returns a detected license the license information will be updated in the response from delice.

It's recommended to also use the --github-token <token> CLI option to provide a GitHub Personal Access Token to authenticate the requests (they are anonymous by default) as this will avoid rate-limiting happening with the API.

Checking License Contents

GitHub uses Licensee in its detecting a license. Licensee will look at the contents of the license and compare it to license templates using SΓΈrensen–Dice coefficient.

delice also supports doing this via the --check-license-content flag. When provided delice will download the contents of the licenseUrl in the nuspec and compare it to known templates stored within itself. The comparison requires that the license and template be at least 90% the same for it to be considered a match (this is lower than Licensee, which uses 98%, but experiments against .NET showed it was better to be a bit looser), so there is still some potential misses.

Also, only certain license templates are stored within delice, but feel free to add more via PR's.

This can work in conjunction with the GitHub API test, but will be run after the API check is done, and only if it fails.

Common License Cache

The file LicenseCache.fs contains a map of commonly used packages and the license file that they have. This means that delice can determine more licenses out of the box.

If you're coming across packages that you think should be in there, open a Pull Request with the updates.

Related Projects

This project is a port of the Node.js utility delice, created by Tierney Cyren and aims to provide the same sorts of functionality but in a .NET friendly workflow.

dotnet-delice's People

Contributors

aaronpowell avatar antoinega avatar bio2hazard avatar kimsey0 avatar mhienle avatar michael-wolfenden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet-delice's Issues

.NET 5.0 compatible version

Hello,

is it possible to tick the ".NET 5.0" checkbox (and maybe the dotnetcore3.1 checkbox as well) and publish a new version?
The current version is limited to .NET Core 3.0 - which works with the .NET Core 3.1 installed but not with .NET 5.0 - I would need to have an older runtime version installed as well when using the the dotnet-delice tool.

Getting a weird System.IO.FileNotFound-Exception when using fitsharp Nuget package

I get a weird FileNotFoundException and I'm not sure if a) this should really happen and b) while there is a file license.txt in the license subfolder of the package it can't find it.

I've tried it on linux and I guess the path is kind of weird - it is using backslashes and slashes while it should use either one (slashes in my case).

Unhandled exception. System.IO.FileNotFoundException: Could not find file '/root/.nuget/packages/fitsharp/2.8.1/license\license.txt'. File name: '/root/.nuget/packages/fitsharp/2.8.1/license\license.txt' at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at LicenseBuilder.buildLicenseFromPackage(Boolean checkGitHub, String token, FSharpFunc2 checkLicenseContents', PackageIdentity identity, String packagePath, LocalPackageInfo pId, String path) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseBuilder.fs:line 45 at [email protected](LockFileLibrary lib) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 45 at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81 at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 178
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@193[T](FSharpFunc2 f, IEnumerator1 e, FSharpRef1 started, Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 194 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable1 source)
at [email protected](Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1108
at [email protected](Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 469
at Microsoft.FSharp.Collections.SeqModule.Length[T](IEnumerable1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 716 at JsonOutput.jsonBuilder(String name, IEnumerable1 licenses) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68 at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@418-1.Invoke(Unit unitVar0) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 422 at Microsoft.FSharp.Collections.Generator.appG[a](Generator1 g) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 322
at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator1.System-Collections-IEnumerator-MoveNext() at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at JsonOutput.jsonPrinter(String path, IEnumerable1 json) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 99
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.b__0()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9`

Look at license file for license?

Some licenses seem to not be able to be determined, i.e

Packages using the legacy NuGet license structure
License Expression: Unable to determine
+-- There are 11 occurances of Unable to determine
+-- Conformance:
Β¦ +-- Is OSI Approved: false
Β¦ +-- Is FSF Free/Libre: false
Β¦ +-- Included deprecated IDs: false
+-- Packages:
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://aws.amazon.com/apache2.0/)
  +-- [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)
  +-- [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)
  +-- [email protected] (https://github.com/Microsoft/dotnet/blob/master/LICENSE)
  +-- [email protected] (https://raw.github.com/MindscapeHQ/raygun4net/master/LICENSE)
  +-- [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)

So for the AWS ones from the URL they appear to be apache 2.0. And opening up the Microsoft / Raygun ones they are MIT. Castle / NVelocity are Apache 2.0.

So would it be possible to look for keywords in the URL, or even look up the URL itself to determine the license?

I guess it would be slow to lookup all the URLs but that could be behind a flag.

I thought --check-license-content would do that for me but It only narrowed it down to:

Packages using the legacy NuGet license structure
License Expression: Unable to determine
β”œβ”€β”€ There are 9 occurances of Unable to determine
β”œβ”€β”¬ Conformance:
β”‚ β”œβ”€β”€ Is OSI Approved: false
β”‚ β”œβ”€β”€ Is FSF Free/Libre: false
β”‚ └── Included deprecated IDs: false
└─┬ Packages:
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://aws.amazon.com/apache2.0/)
  β”œβ”€β”€ [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)
  β”œβ”€β”€ [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)
  └── [email protected] (http://www.apache.org/licenses/LICENSE-2.0.html)

As these were not on github.

Unhandled nullpointerexception running in Jenkins

i get an unhandled exception in Jenkins running
path/to/dotnet-delice.dll path/to/project.csproj --check-github --github-token github-token --check-license-content --refresh-spdx --json-output path/to/output/licenses.json -j

The same command works on my local machine. I have tried changing both csproj and output to paths I know is wrong and then I get other errors. I realize its something in our Jenkins environment that cause this but it would be nice to check the input values here and throw an Exception with more information.

I have looked at the code but are not enough familiar with F# to determine what cause the exception, do you have any idea what it could be?

Stacktrace:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at App.getLicenses(Boolean checkGitHub, String token, Boolean checkLicenseContent, PackageSpec projectSpec) in /home/runner/work/dotnet-delice/dotnet-delice/src/DotNetDelice/App.fs:line 40
at App.getLicenses'@124.Invoke(PackageSpec projectSpec) in /home/runner/work/dotnet-delice/dotnet-delice/src/DotNetDelice/App.fs:line 124
at [email protected](PackageSpec projectSpec) in /home/runner/work/dotnet-delice/dotnet-delice/src/DotNetDelice/App.fs:line 139
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 78
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System.Collections.IEnumerator.MoveNext() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator<'T>[email protected](Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 421
at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 316
at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator`1.System.Collections.IEnumerator.MoveNext()
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at JsonOutput.jsonPrinter(String path, IEnumerable`1 json) in /home/runner/work/dotnet-delice/dotnet-delice/src/DotNetDelice/JsonOutput.fs:line 99
--- End of stack trace from previous location ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Program.main(String[] args) in /home/runner/work/dotnet-delice/dotnet-delice/src/DotNetDelice/Program.fs:line 9

Getting a 404 error if no license can be obtained from github

Unhandled exception. System.Net.WebException: The remote server returned an error: (404) Not Found.
Response from https://api.github.com/repos/CharsetDetector/UTF-unknown/license:
{"message":"Not Found","documentation_url":"https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license"}https://developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license%22%7D
---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at [email protected]mailto:[email protected](Exception _arg2)
at <StartupCode$FSharp-Core>.$[email protected]mailto:[email protected](Exception exn) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1082
at Microsoft.FSharp.Control.AsyncPrimitives.CallFilterThenInvoke[T](AsyncActivation1 ctxt, FSharpFunc2 catchFilter, ExceptionDispatchInfo edi) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 436
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc2 firstAction) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109 --- End of inner exception stack trace --- at FSharp.Data.HttpHelpers.augmentWebExceptionsWithDetails@1227-3.Invoke(Unit unitVar) at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation1 ctxt, TResult result1, FSharpFunc2 part2) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 398 at [email protected](AsyncActivation1 ctxt) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 589
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc2 firstAction) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109 --- End of stack trace from previous location where exception was thrown --- at Microsoft.FSharp.Control.AsyncResult1.Commit() in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 351
at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync1 computation) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 882 at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync1 computation, FSharpOption1 timeout) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 890 at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync1 computation, FSharpOption1 timeout, FSharpOption1 cancellationToken) in E:\A_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1154
at LicenseCache.checkLicenseViaGitHub$cont@197(String token, String licenseUrl, Group repoGroup, Group orgGroup, Unit unitVar) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseCache.fs:line 208
at LicenseCache.checkLicenseViaGitHub(String token, String licenseUrl) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseCache.fs:line 221
at LicenseBuilder.buildLicenseFromPackage$cont@55(Boolean checkGitHub, String token, FSharpFunc2 checkLicenseContents', PackageIdentity identity, LocalPackageInfo pId, LicenseMetadata licenseMetadata, Unit unitVar) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/LicenseBuilder.fs:line 58 at [email protected](LockFileLibrary lib) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 45 at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81 at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNextmailto:Microsoft.FSharp.Collections.Internal.IEnumerator.choose@171.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 178
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@193[T](FSharpFunc2 f, IEnumerator1 e, FSharpRef1 started, Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 194 at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable1 source)
at [email protected]mailto:[email protected](Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 1108
at [email protected]mailto:[email protected](Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 469
at Microsoft.FSharp.Collections.SeqModule.Length[T](IEnumerable1 source) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 716 at JsonOutput.jsonBuilder(String name, IEnumerable1 licenses) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 68
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNextmailto:Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 81
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator1.System-Collections-IEnumerator-MoveNext() in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 68 at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@418-1.Invoke(Unit unitVar0) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 422 at Microsoft.FSharp.Collections.Generator.appG[a](Generator1 g) in E:\A_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 322
at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator1.System-Collections-IEnumerator-MoveNext() at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at JsonOutput.jsonPrinter(String path, IEnumerable1 json) in /home/vsts/work/1/s/src/DotNetDelice/JsonOutput.fs:line 99
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.b__0()
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9

The api shows "null" in the license property - see:

https://api.github.com/repos/CharsetDetector/UTF-unknown

It it is trying to load a license via github api which produces a 404 error - would be great to have a way to ignore/allow such errors and/or a fallback solution and or it should not try to load a license if the license-property is null

pretty print to text file?

helo aaron,

thanks for this great project!

i see how i can get the json to a file but is there also a way to get the pretty print into a file?

.NET SDK (5.0.400), Failed to generate the dependency graph

Hello,
Thank you for maintaining this great project.

Unfortunately we've run into some problems, it seems like in 1.6.0 of the tool, relative multi-level ProjectReference paths don't work with .NET SDK 5.0.400.
These paths work with 1.6.0 and .NET SDK 3.1.407.
One-level paths ..\something.csproj seem to work.

Only tested on OSX with csproj <TargetFramework>netcoreapp3.1</TargetFramework>

Example:

1.6.0 + 3.1.407, works fine

<ItemGroup>
  <ProjectReference Include="..\..\src\Example.Application\Example.Application.csproj" />
</ItemGroup>

1.6.0 + 5.0.400, doesn't work, gives error after some time

<ItemGroup>
  <ProjectReference Include="..\..\src\Example.Application\Example.Application.csproj" />
</ItemGroup>

Error:

β‡’  dotnet delice --json
Failed to generate the dependency graph for '/Users/oscarwest/projects/exampleProject/test/Example.Tests'.
Ensure that the project has been restored and compiled before running delice.
delice only supports SDK project files (.NET Core, NETStandard, etc.), not legacy MSBuild ones (common for .NET Framework).

1.6.0 + 5.0.400, works fine, note the prefix \ path which essentially ignores the reference.

<ItemGroup>
  <ProjectReference Include="\..\..\src\Example.Application\Example.Application.csproj" />
</ItemGroup>

OS Info

β‡’  sw_vers
ProductName:	macOS
ProductVersion:	11.2.3
BuildVersion:	20D91

I noticed some changes to path stuff here: 96fb0eb#diff-357e52cc01d8127f42410c332d0964638746c570620d19c39d715ff5b79db069R8
Maybe this mucked something?

Thank you again.

Multiple sln's in folder triggers exception

Unhandled Exception: System.Exception: More than one solution file found in the path
   at App.findProject(String path) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 22
   at App.Cli.OnExecute() in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 78
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0()
   at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 7

Supplying the sln file just gives me "whoops". My project is regular .net 4, is this only meant for core projects?

ArgumentNullException

I'm trying to use dotnet-delice but getting an Unhandled Exception.

I've tried the following call of dotnet-delice:

PS C:\SolutionFolder> dotnet delice .\solutionFile.sln --check-github

Getting the following Output:
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'path1') at System.IO.Path.Combine(String path1, String path2) at App.getLicenses(Boolean checkGitHub, String token, Boolean checkLicenseContent, PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 40 at App.getLicenses'@96.Invoke(PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 96 at [email protected](PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 104 at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 495 --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9

Am I using it wrong?

Version 1.4.0: System.Exception: '/licenses[302]/isFsfLibre' is missing

Hello,

I get the error message below when executing dotnet-delice

Version 1.4.0
OS: MacOS 10.14.6
Dotnet Version: .NET Core SDK (3.1.100)
The processed project is for .Net Core 3

Unhandled exception. System.Exception: '/licenses[302]/isFsfLibre' is missing
   at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1637.Invoke(String message) in E:\A\_work\130\s\src\fsharp\FSharp.Core\printf.fs:line 1637
   at [email protected](IJsonDocument _arg1) in /home/vsts/work/1/s/src/DotNetDelice/Output.fs:line 40
   at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvokeNoHijackCheck[a,b](AsyncActivation`1 ctxt, FSharpFunc`2 userCode, b result1) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 417
   at [email protected](AsyncActivation`1 ctxt) in /home/vsts/work/1/s/src/DotNetDelice.Licensing/Spdx.fs:line 39
   at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 109
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.FSharp.Control.AsyncResult`1.Commit() in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 350
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronouslyInCurrentThread[a](CancellationToken cancellationToken, FSharpAsync`1 computation) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 882
   at Microsoft.FSharp.Control.AsyncPrimitives.RunSynchronously[T](CancellationToken cancellationToken, FSharpAsync`1 computation, FSharpOption`1 timeout) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 890
   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken) in E:\A\_work\130\s\src\fsharp\FSharp.Core\async.fs:line 1154
   at [email protected](Tuple`2 tupledArg) in /home/vsts/work/1/s/src/DotNetDelice/ConsoleOutput.fs:line 81
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 78
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 64
   at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 494
   at ConsoleOutput.prettyPrint(String name, IEnumerable`1 licenses) in /home/vsts/work/1/s/src/DotNetDelice/ConsoleOutput.fs:line 94
   at [email protected](PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 111
   at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source) in E:\A\_work\130\s\src\fsharp\FSharp.Core\seq.fs:line 495
   at App.Cli.OnExecute() in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 113
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
   at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.<OnExecute>b__0()
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 9
Abort trap: 6

Exception thrown when running against .csproj

Getting the following exception when running against my .csproj file:

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at [email protected](PackageSpec projectSpec) in /home/vsts/work/1/s/src/DotNetDelice/App.fs:line 77
at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source)
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.Invoke(MethodInfo method, Object instance, Object[] arguments)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context)
at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass142_0.b__0()
at Program.main(String[] args) in /home/vsts/work/1/s/src/DotNetDelice/Program.fs:line 7

GitHub License Query targets master branch

My F# is not the best, so correct me if I am wrong, but I am in the impression that if a package in version 1.2 does not have a spdx identifier, it would query the master (maybe version 3.5) of GitHub repo resulting in a license statement which is okay for 3.5 but not for version 1.2.

This would leave the wrong impression that the license is checked despite it is not a certainity.

Awesome tool. I played with the idea of writing it but failed doing it. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.