Skip to content

Commit a3125b7

Browse files
authored
Merge pull request #4 from fossology/development
Development to master
2 parents 0eb6c7e + 96cf872 commit a3125b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4847
-995
lines changed

.gitignore

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,38 +86,10 @@ _ReSharper*/
8686
*.[Rr]e[Ss]harper
8787
*.DotSettings.user
8888

89-
# JustCode is a .NET coding addin-in
90-
.JustCode
91-
92-
# TeamCity is a build add-in
93-
_TeamCity*
9489

9590
# DotCover is a Code Coverage Tool
9691
*.dotCover
9792

98-
# NCrunch
99-
_NCrunch_*
100-
.*crunch*.local.xml
101-
102-
# MightyMoose
103-
*.mm.*
104-
AutoTest.Net/
105-
106-
# Web workbench (sass)
107-
.sass-cache/
108-
109-
# Installshield output folder
110-
[Ee]xpress/
111-
112-
# DocProject is a documentation generator add-in
113-
DocProject/buildhelp/
114-
DocProject/Help/*.HxT
115-
DocProject/Help/*.HxC
116-
DocProject/Help/*.hhc
117-
DocProject/Help/*.hhk
118-
DocProject/Help/*.hhp
119-
DocProject/Help/Html2
120-
DocProject/Help/html
12193

12294
# Click-Once directory
12395
publish/
@@ -193,3 +165,5 @@ _internal_/
193165
TestData/
194166
Output/
195167
ToDo.txt
168+
.tests/
169+
Fossology.Rest.Dotnet.Test/coverage.cobertura.xml

ChangeLog.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# ChangeLog - FOSSology.REST.dotnet
22

3-
## NEXT
3+
## 1.2.0
44
* improved error handling.
5+
* supports FOSSology REST API v1.4.3 (FOSSology 4.0.0 built @ 2023/03/09).
56
* new method GetHealth().
7+
* have `FossologyClient` to be a partial class for better overview.
8+
* new method GetGroupList().
9+
* add support for groups for all methods where it did not yet exist.
10+
* new method GetInfo().
11+
* support for licenses added: new methods GetLicenseList(), GetLicense(), CreateLicense().
12+
* code coverage support
13+
* new classes Hash and Obligation.
14+
* improved unit tests.
615

716
## 1.1.0 (2020-06-25)
817
* supports FOSSology REST API v1.0.16 (FOSSology 3.8.0 built @ 2020/06/19).

CodeCoverageReport.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -------------------------------------------------------
2+
# Create Code Covergae Report - Powershell based approach
3+
# -------------------------------------------------------
4+
5+
$testfolder = "./.tests"
6+
7+
# 1. Remove all TestResult folders and files
8+
Write-Host "Removing all 'TestResults' folders..."
9+
$testfolders = Get-ChildItem -Path . "TestResults" -Recurse -Directory
10+
foreach ($folder in $testfolders) {
11+
Remove-Item $folder.FullName -Recurse
12+
}
13+
14+
Write-Host "Removing all 'coverage.cobertura.xml' files..."
15+
$coberturaFiles = Get-ChildItem -Path . "coverage.cobertura.xml" -Recurse
16+
foreach ($file in $coberturaFiles) {
17+
Remove-Item $file.FullName
18+
}
19+
20+
# 2. Run tests
21+
Write-Host "Running unit tests..."
22+
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
23+
24+
# 3 Generate reports
25+
Write-Host "Generating reports..."
26+
$coberturaFiles = Get-ChildItem -Path . "coverage.cobertura.xml" -Recurse
27+
$list = ""
28+
for ($i=0; $i -lt $coberturaFiles.Count; $i++) {
29+
$list = $list + $coberturaFiles[$i].FullName
30+
$list = $list + ";"
31+
}
32+
33+
$cmd = "-reports:" + $list
34+
$targetdir = "-targetdir:" + $testfolder + "\coverage-report"
35+
reportgenerator $cmd $targetdir -reporttypes:"Html"
36+
37+
$targetdir = "-targetdir:" + $testfolder + "\badges"
38+
reportgenerator $cmd $targetdir -reporttypes:"Badges"
39+
40+
$targetdir = "-targetdir:" + $testfolder
41+
reportgenerator $cmd $targetdir -reporttypes:"Cobertura;JsonSummary"

Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.1</Version>
4-
<FileVersion>1.1.0.0</FileVersion>
3+
<Version>1.2</Version>
4+
<FileVersion>1.2.0.0</FileVersion>
55
<Product>Fossology.Rest.Dotnet</Product>
66
<Company></Company>
7-
<Copyright>Copyright © 2019-2020 T. Graf</Copyright>
7+
<Copyright>Copyright © 2019-2022 T. Graf</Copyright>
88
<Authors>T. Graf</Authors>
99
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1010
<RepositoryType>git</RepositoryType>

Fossology.Rest.Dotnet.Model/Analysis.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ---------------------------------------------------------------------------
22
// <copyright file="Analysis.cs" company="Tethys">
3-
// Copyright (C) 2020 T. Graf
3+
// Copyright (C) 2020-2022 T. Graf
44
// </copyright>
55
//
66
// Licensed under the MIT License.
@@ -74,5 +74,11 @@ public class Analysis
7474
/// </summary>
7575
[JsonProperty("package")]
7676
public bool Package { get; set; }
77+
78+
/// <summary>
79+
/// Gets or sets a value indicating whether to use the REUSE.Software analysis.
80+
/// </summary>
81+
[JsonProperty("reso")]
82+
public bool Reso { get; set; }
7783
} // Analysis
7884
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// ---------------------------------------------------------------------------
2+
// <copyright file="AppInfo.cs" company="Tethys">
3+
// Copyright (C) 2022 T. Graf
4+
// </copyright>
5+
//
6+
// Licensed under the MIT License.
7+
// SPDX-License-Identifier: MIT
8+
//
9+
// Unless required by applicable law or agreed to in writing,
10+
// software distributed under the License is distributed on an
11+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
// either express or implied.
13+
// ---------------------------------------------------------------------------
14+
15+
namespace Fossology.Rest.Dotnet.Model
16+
{
17+
using Newtonsoft.Json;
18+
19+
/// <summary>
20+
/// Fossology application information.
21+
/// </summary>
22+
public class AppInfo
23+
{
24+
/// <summary>
25+
/// Gets or sets the name.
26+
/// </summary>
27+
[JsonProperty("name")]
28+
public string Name { get; set; }
29+
30+
/// <summary>
31+
/// Gets or sets the description.
32+
/// </summary>
33+
[JsonProperty("description")]
34+
public string Description { get; set; }
35+
36+
/// <summary>
37+
/// Gets or sets the version.
38+
/// </summary>
39+
[JsonProperty("version")]
40+
public string Version { get; set; }
41+
42+
/// <summary>
43+
/// Gets or sets the contact information.
44+
/// </summary>
45+
[JsonProperty("contact")]
46+
public string Contact { get; set; }
47+
48+
/// <summary>
49+
/// Gets or sets the Fossology license information.
50+
/// </summary>
51+
[JsonProperty("license")]
52+
public FossologyLicense FossologyLicense { get; set; }
53+
54+
/// <summary>
55+
/// Gets or sets the Fossology information.
56+
/// </summary>
57+
[JsonProperty("fossology")]
58+
public FossologyInfo FossologyInfo { get; set; }
59+
60+
/// <inheritdoc />
61+
public override string ToString()
62+
{
63+
return $"{this.Name}, {this.Version}";
64+
}
65+
} // AppInfo
66+
}

Fossology.Rest.Dotnet.Model/File.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// ---------------------------------------------------------------------------
2+
// <copyright file="File.cs" company="Tethys">
3+
// Copyright (C) 2022 T. Graf
4+
// </copyright>
5+
//
6+
// Licensed under the MIT License.
7+
// SPDX-License-Identifier: MIT
8+
//
9+
// Unless required by applicable law or agreed to in writing,
10+
// software distributed under the License is distributed on an
11+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
// either express or implied.
13+
// ---------------------------------------------------------------------------
14+
15+
namespace Fossology.Rest.Dotnet.Model
16+
{
17+
using System.Collections.Generic;
18+
using Newtonsoft.Json;
19+
20+
/// <summary>
21+
/// Fossology file information as returned by searching for files.
22+
/// </summary>
23+
public class File
24+
{
25+
/// <summary>
26+
/// Gets or sets the hash.
27+
/// </summary>
28+
[JsonProperty("hash")]
29+
public Hash Hash { get; set; }
30+
31+
/// <summary>
32+
/// Gets or sets the findings.
33+
/// </summary>
34+
[JsonProperty("findings")]
35+
public Findings Findings { get; set; }
36+
37+
/// <summary>
38+
/// Gets or sets the SHA256 hash.
39+
/// </summary>
40+
[JsonProperty("uploads")]
41+
#pragma warning disable CA2227 // Collection properties should be read only
42+
public List<int> Uploads { get; set; }
43+
#pragma warning restore CA2227 // Collection properties should be read only
44+
45+
/// <summary>
46+
/// Gets or sets the message.
47+
/// </summary>
48+
[JsonProperty("message")]
49+
public string Message { get; set; }
50+
51+
/// <inheritdoc />
52+
public override string ToString()
53+
{
54+
return $"{this.Hash}, {this.Findings}, {this.Uploads}, '{this.Message}'";
55+
}
56+
} // File
57+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// ---------------------------------------------------------------------------
2+
// <copyright file="Findings.cs" company="Tethys">
3+
// Copyright (C) 2022 T. Graf
4+
// </copyright>
5+
//
6+
// Licensed under the MIT License.
7+
// SPDX-License-Identifier: MIT
8+
//
9+
// Unless required by applicable law or agreed to in writing,
10+
// software distributed under the License is distributed on an
11+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12+
// either express or implied.
13+
// ---------------------------------------------------------------------------
14+
15+
namespace Fossology.Rest.Dotnet.Model
16+
{
17+
using System.Collections.Generic;
18+
using Newtonsoft.Json;
19+
20+
/// <summary>
21+
/// Information about the licenses of the uploaded files.
22+
/// </summary>
23+
public class Findings
24+
{
25+
/// <summary>
26+
/// Gets the short names of the licenses found by the scanner.
27+
/// </summary>
28+
[JsonProperty("scanner")]
29+
public List<string> Scanner { get; }
30+
31+
/// <summary>
32+
/// Gets the conclusions, i.e. license(s) decided by user.
33+
/// </summary>
34+
[JsonProperty("conclusions")]
35+
public List<string> Conclusions { get; }
36+
37+
/// <summary>
38+
/// Gets the copyrights.
39+
/// </summary>
40+
[JsonProperty("copyright")]
41+
public List<string> Copyrights { get; }
42+
43+
/// <summary>
44+
/// Initializes a new instance of the <see cref="Findings"/> class.
45+
/// </summary>
46+
public Findings()
47+
{
48+
this.Scanner = new List<string>();
49+
this.Conclusions = new List<string>();
50+
this.Copyrights = new List<string>();
51+
} // UploadLicenses()
52+
53+
/// <inheritdoc />
54+
public override string ToString()
55+
{
56+
return $"S={Support.ListToString(this.Scanner)}, C={Support.ListToString(this.Conclusions)}: Copy={Support.ListToString(this.Copyrights)}";
57+
} // ToString()
58+
} // Findings
59+
}
Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<CodeAnalysisRuleSet>..\Fossology.Rest.Dotnet.ruleset</CodeAnalysisRuleSet>
6-
<Description>Object model for the NET implementation of the REST API of FOSSology.</Description>
7-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<CodeAnalysisRuleSet>..\Fossology.Rest.Dotnet.ruleset</CodeAnalysisRuleSet>
6+
<Description>Object model for the NET implementation of the REST API of FOSSology.</Description>
7+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
8+
<PackageReadmeFile>README.md</PackageReadmeFile>
9+
</PropertyGroup>
910

10-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
11-
<DocumentationFile>bin\Fossology.Rest.Dotnet.Model.xml</DocumentationFile>
12-
</PropertyGroup>
11+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
12+
<DocumentationFile>bin\Fossology.Rest.Dotnet.Model.xml</DocumentationFile>
13+
</PropertyGroup>
1314

14-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
15-
<DocumentationFile>bin\Fossology.Rest.Dotnet.Model.xml</DocumentationFile>
16-
</PropertyGroup>
15+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
16+
<DocumentationFile>bin\Fossology.Rest.Dotnet.Model.xml</DocumentationFile>
17+
</PropertyGroup>
1718

18-
<ItemGroup>
19-
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
20-
<PrivateAssets>all</PrivateAssets>
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
</PackageReference>
23-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
24-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
25-
<PrivateAssets>all</PrivateAssets>
26-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
27-
</PackageReference>
28-
</ItemGroup>
19+
<ItemGroup>
20+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23+
</PackageReference>
24+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
25+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
26+
<PrivateAssets>all</PrivateAssets>
27+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
28+
</PackageReference>
29+
<None Include="..\README.md" Pack="true" PackagePath="\"/>
30+
</ItemGroup>
2931

30-
<ItemGroup>
31-
<None Include="..\.editorconfig">
32-
<Link>.editorconfig</Link>
33-
</None>
34-
</ItemGroup>
32+
<ItemGroup>
33+
<None Include="..\.editorconfig">
34+
<Link>.editorconfig</Link>
35+
</None>
36+
</ItemGroup>
3537

3638
</Project>

0 commit comments

Comments
 (0)