Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating Summary.licenseFile and Summary.licenses to AnalysisResult.licenses #1385

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Updated dependency: `tar: ^2.0.0`.
- New text logging format.
- Migrating `Summary.licenseFile` and `Summary.licenses` to `AnalysisResult.licenses`.
- *Breaking change:* Removed `ToolEnvironment.panaCache` field (not intended for public API).

## 0.22.7
Expand Down
8 changes: 8 additions & 0 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class Summary {
final String? packageName;
final Version? packageVersion;
final Pubspec? pubspec;
@Deprecated('Use `result.licenses` instead.')
final LicenseFile? licenseFile;
@Deprecated('Use `result.licenses` instead.')
final List<License>? licenses;

/// The packages that are either direct-, dev- or transient dependencies.
Expand Down Expand Up @@ -160,6 +162,8 @@ class PanaRuntimeInfo {
@JsonSerializable()
class License {
/// The file path that was recognized as a license.
@Deprecated(
'The field will be removed, as we only accept `LICENSE` as filename.')
final String path;

/// The SPDX identifier of the license.
Expand All @@ -177,6 +181,7 @@ class License {
}

@JsonSerializable()
@Deprecated('The class will be removed.')
class LicenseFile {
final String path;
final String name;
Expand Down Expand Up @@ -207,6 +212,7 @@ class LicenseFile {
int get hashCode => path.hashCode ^ name.hashCode ^ version.hashCode;
}

@Deprecated('The class will be removed.')
abstract class LicenseNames {
static const String agpl = 'AGPL';
static const String apache = 'Apache';
Expand Down Expand Up @@ -327,6 +333,7 @@ class AnalysisResult {
final List<String>? fundingUrls;
final Repository? repository;
final String? contributingUrl;
final List<License>? licenses;
final int? grantedPoints;
final int? maxPoints;

Expand All @@ -338,6 +345,7 @@ class AnalysisResult {
this.fundingUrls,
this.repository,
this.contributingUrl,
this.licenses,
this.grantedPoints,
this.maxPoints,
});
Expand Down
4 changes: 4 additions & 0 deletions lib/src/model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/package_analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ Future<AnalysisResult> _createAnalysisResult(
fundingUrls: fundingUrls.isEmpty ? null : fundingUrls,
repository: repository,
contributingUrl: repoVerification?.contributingUrl,
licenses: await context.licenses,
grantedPoints: report.grantedPoints,
maxPoints: report.maxPoints,
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
html: ^0.15.0
http: ^1.0.0
io: ^1.0.0
json_annotation: ^4.8.1
json_annotation: ^4.9.0
lints: ^4.0.0
logging: ^1.0.0
markdown: ^7.0.0
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/_dummy_pkg-1.0.0-null-safety.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
"screenshots": [],
"result": {
"homepageUrl": "https://github.com/dart-lang/pub-dev",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "BSD-3-Clause"
}
],
"grantedPoints": 25,
"maxPoints": 160
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/async-2.11.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
"branch": "master"
},
"contributingUrl": "https://github.com/dart-lang/async/blob/master/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "BSD-3-Clause"
}
],
"grantedPoints": 150,
"maxPoints": 160
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/audio_service-0.18.10.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@
"path": "audio_service"
},
"contributingUrl": "https://github.com/ryanheise/audio_service/blob/minor/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 140,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/bulma_min-0.7.4.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
"repository": "agilord/bulma_min",
"branch": "master"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 30,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/dnd-2.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
"repository": "marcojakob/dart-dnd",
"branch": "master"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 140,
"maxPoints": 160
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/gg-1.0.12.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@
"repository": "inlavigo/gg",
"branch": "main"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 120,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/http-0.13.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@
"path": "pkgs/http"
},
"contributingUrl": "https://github.com/dart-lang/http/blob/master/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "BSD-3-Clause"
}
],
"grantedPoints": 140,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/lints-1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
},
"screenshots": [],
"result": {
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "BSD-3-Clause"
}
],
"grantedPoints": 130,
"maxPoints": 150
},
Expand Down
1 change: 1 addition & 0 deletions test/goldens/end2end/mime_type-0.3.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"repository": "mitsuoka/mime_type",
"branch": "master"
},
"licenses": [],
"grantedPoints": 5,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/nsd_android-1.2.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
"branch": "main",
"path": "nsd_android"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 140,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/onepub-1.1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@
"screenshots": [],
"result": {
"homepageUrl": "https://github.com/noojee/onepub.dev",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "unknown"
}
],
"grantedPoints": 120,
"maxPoints": 160
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/sdp_transform-0.2.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
"repository": "cloudwebrtc/dart-sdp-transform",
"branch": "master"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 40,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/skiplist-0.1.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
"repository": "stevenroose/dart-skiplist",
"branch": "master"
},
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 20,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/steward-0.3.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
"branch": "main"
},
"contributingUrl": "https://github.com/pyrestudios/steward/blob/main/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "MIT"
}
],
"grantedPoints": 130,
"maxPoints": 150
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/url_launcher-6.1.12.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@
"path": "packages/url_launcher/url_launcher"
},
"contributingUrl": "https://github.com/flutter/packages/blob/main/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "BSD-3-Clause"
}
],
"grantedPoints": 160,
"maxPoints": 160
},
Expand Down
6 changes: 6 additions & 0 deletions test/goldens/end2end/webdriver-3.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@
"branch": "master"
},
"contributingUrl": "https://github.com/google/webdriver.dart/blob/master/CONTRIBUTING.md",
"licenses": [
{
"path": "LICENSE",
"spdxIdentifier": "Apache-2.0"
}
],
"grantedPoints": 100,
"maxPoints": 150
},
Expand Down