Skip to content

Commit 7f2c174

Browse files
authored
2 parents 4b9ecdd + 96919d5 commit 7f2c174

File tree

12 files changed

+121
-35
lines changed

12 files changed

+121
-35
lines changed

.github/workflows/cla.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
issue_comment:
44
types: [created]
55
pull_request_target:
6-
types: [opened,closed,synchronize]
6+
types: [opened, closed, synchronize]
77

88
jobs:
99
CLAssistant:
@@ -16,21 +16,21 @@ jobs:
1616
env:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
# the below token should have repo scope and must be manually added by you in the repository's secret
19-
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
19+
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2020
with:
21-
path-to-signatures: 'signatures/version1/cla.json'
22-
path-to-document: 'https://github.com/Codeuctivity/PdfAValidatorApi/cla.md' # e.g. a CLA or a DCO document
21+
path-to-signatures: "signatures/version1/cla.json"
22+
path-to-document: "https://github.com/Codeuctivity/PdfAValidatorApi/blob/main/cla.md" # e.g. a CLA or a DCO document
2323
# branch should not be protected
24-
branch: 'main'
24+
branch: "main"
2525
allowlist: dependabot[bot],stesee
2626

27-
#below are the optional inputs - If the optional inputs are not given, then default values will be taken
28-
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
29-
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
30-
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
31-
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
32-
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
33-
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
34-
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
35-
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
36-
#use-dco-flag: true - If you are using DCO instead of CLA
27+
#below are the optional inputs - If the optional inputs are not given, then default values will be taken
28+
#remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
29+
#remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
30+
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
31+
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
32+
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
33+
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
34+
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
35+
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
36+
#use-dco-flag: true - If you are using DCO instead of CLA

.github/workflows/dotnet.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Setup .NET
19-
uses: actions/setup-dotnet@v2
19+
uses: actions/setup-dotnet@v3
2020
with:
2121
dotnet-version: 6.0.x
2222
- name: Restore dependencies
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v3
3535
- name: Setup .NET
36-
uses: actions/setup-dotnet@v2
36+
uses: actions/setup-dotnet@v3
3737
with:
3838
dotnet-version: 6.0.x
3939
- name: Restore dependencies
@@ -64,7 +64,7 @@ jobs:
6464
steps:
6565
- uses: actions/checkout@v3
6666
- name: Setup .NET
67-
uses: actions/setup-dotnet@v2
67+
uses: actions/setup-dotnet@v3
6868
with:
6969
dotnet-version: 6.0.x
7070
- name: Restore dependencies
@@ -95,7 +95,7 @@ jobs:
9595
steps:
9696
- uses: actions/checkout@v3
9797
- name: Setup .NET
98-
uses: actions/setup-dotnet@v2
98+
uses: actions/setup-dotnet@v3
9999
with:
100100
dotnet-version: 6.0.x
101101
- name: Restore dependencies

.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"recommendations": [
3+
"streetsidesoftware.code-spell-checker",
4+
"davidanson.vscode-markdownlint",
5+
"redhat.vscode-yaml",
6+
"mhutchie.git-graph",
37
"ms-dotnettools.csharp"
48
]
59
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"Nuget",
66
"Nunit",
77
"nupkg",
8-
"snupkg"
8+
"snupkg",
9+
"stesee"
910
],
1011
"editor.formatOnSave": true
1112
}

.vscode/updateNuget.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ find . -name "*.*proj" | while read proj; do
66
name="${BASH_REMATCH[1]}"
77
version="${BASH_REMATCH[2]}"
88
if [[ $version != *-* ]]; then
9+
echo dotnet add "$proj" package "$name"
910
dotnet add "$proj" package "$name"
1011
fi
1112
fi

PdfAValidator/PdfAValidator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</ItemGroup>
5656

5757
<ItemGroup>
58-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.44.0.52574">
58+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.47.0.55603">
5959
<PrivateAssets>all</PrivateAssets>
6060
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6161
</PackageReference>

PdfAValidator/Report.cs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,48 @@ public class Duration
255255
public string Text { get; set; } = string.Empty;
256256
}
257257

258+
/// <summary>
259+
/// Feature entry
260+
/// </summary>
261+
public class FeatureEntry
262+
{
263+
/// <summary>
264+
/// Feature key, for example "Creator"
265+
/// </summary>
266+
[XmlAttribute(AttributeName = "key")]
267+
public string Key { get; set; } = string.Empty;
268+
269+
/// <summary>
270+
/// Feature value, for example "cairo 1.9.5 (http://cairographics.org)"
271+
/// </summary>
272+
[XmlText]
273+
public string Value { get; set; } = string.Empty;
274+
}
275+
276+
/// <summary>
277+
/// Feature information dictionary
278+
/// </summary>
279+
public class InformationDict
280+
{
281+
/// <summary>
282+
/// Feature entries
283+
/// </summary>
284+
[XmlElement(ElementName = "entry")]
285+
public List<FeatureEntry> Entries { get; set; } = new List<FeatureEntry>();
286+
}
287+
288+
/// <summary>
289+
/// Features Report details, use argument '--extract' to activate
290+
/// </summary>
291+
public class FeaturesReport
292+
{
293+
/// <summary>
294+
/// Feature information dictionary
295+
/// </summary>
296+
[XmlElement(ElementName = "informationDict")]
297+
public InformationDict InformationDict { get; set; } = new InformationDict();
298+
}
299+
258300
/// <summary>
259301
/// Job details
260302
/// </summary>
@@ -273,6 +315,12 @@ public class Job
273315
[XmlElement(ElementName = "validationReport")]
274316
public ValidationReport ValidationReport { get; set; } = new ValidationReport();
275317

318+
/// <summary>
319+
/// Feature report details
320+
/// </summary>
321+
[XmlElement(ElementName = "featuresReport")]
322+
public FeaturesReport FeaturesReport { get; set; } = new FeaturesReport();
323+
276324
/// <summary>
277325
/// Task result
278326
/// </summary>
@@ -488,4 +536,4 @@ public class Report
488536
/// </summary>
489537
public string RawOutput { get; set; } = string.Empty;
490538
}
491-
}
539+
}

PdfAValidatorTest/PdfAValidatorTest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,25 @@ public static async Task ShouldValidateFolderWithExpectedResult()
174174
Assert.Equal("3", result.BatchSummary.ValidationReports.FailedJobs);
175175
}
176176

177+
[Fact]
178+
public static async Task ShouldGetFeaturesReportWhenAskingForIt()
179+
{
180+
using var pdfAValidator = new PdfAValidator();
181+
Assert.True(File.Exists("./TestPdfFiles/FromLibreOffice.pdf"));
182+
var result = await pdfAValidator.ValidateWithDetailedReportAsync("./TestPdfFiles/FromLibreOffice.pdf", "--extract");
183+
var producerEntry = result.Jobs.Job.FeaturesReport.InformationDict.Entries.Single(e => e.Key == "Producer");
184+
Assert.Equal("LibreOffice 6.1", producerEntry.Value);
185+
}
186+
187+
[Fact]
188+
public static async Task ShouldNotGetFeaturesReportWhenNotAskingForIt()
189+
{
190+
using var pdfAValidator = new PdfAValidator();
191+
Assert.True(File.Exists("./TestPdfFiles/FromLibreOffice.pdf"));
192+
var result = await pdfAValidator.ValidateWithDetailedReportAsync("./TestPdfFiles/FromLibreOffice.pdf");
193+
Assert.Empty(result.Jobs.Job.FeaturesReport.InformationDict.Entries);
194+
}
195+
177196
[Fact]
178197
public static async Task ShouldNotDeadlockWhenValidatingFolderThatCausesLargeOutput()
179198
{

PdfAValidatorTest/PdfAValidatorTest.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
<PrivateAssets>all</PrivateAssets>
7474
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7575
</PackageReference>
76-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
77-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.44.0.52574">
76+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
77+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.47.0.55603">
7878
<PrivateAssets>all</PrivateAssets>
7979
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8080
</PackageReference>

PdfAValidatorWebApi/PdfAValidatorWebApi.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.8" />
17-
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.44.0.52574">
16+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.10" />
17+
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.47.0.55603">
1818
<PrivateAssets>all</PrivateAssets>
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
</PackageReference>

0 commit comments

Comments
 (0)