refactor(code_push_protocol): upgrade analysis_options (#2718)

This commit is contained in:
Felix Angelov
2024-12-19 12:12:40 -06:00
committed by GitHub
parent 9cf0927f39
commit f31fdd0efc
33 changed files with 75 additions and 73 deletions
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.5.1.0.yaml
include: package:very_good_analysis/analysis_options.7.0.0.yaml
analyzer:
exclude:
- build/**
@@ -1,6 +1,3 @@
/// The Shorebird CodePush Protocol
library shorebird_code_push_protocol;
export 'src/messages/messages.dart';
export 'src/models/models.dart';
@@ -13,11 +13,11 @@ class CreateAppRequest {
required this.organizationId,
});
/// Converts a Map<String, dynamic> to a [CreateAppRequest]
/// Converts a `Map<String, dynamic>` to a [CreateAppRequest]
factory CreateAppRequest.fromJson(Map<String, dynamic> json) =>
_$CreateAppRequestFromJson(json);
/// Converts a [CreateAppRequest] to a Map<String, dynamic>
/// Converts a [CreateAppRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreateAppRequestToJson(this);
/// The display name of the app.
@@ -3,18 +3,18 @@ import 'package:json_annotation/json_annotation.dart';
part 'create_app_collaborator_request.g.dart';
/// {@template create_app_collaborator_request}
/// The request body for POST /api/v1/apps/<id>/collaborators
/// The request body for POST /api/v1/apps/:id/collaborators
/// {@endtemplate}
@JsonSerializable()
class CreateAppCollaboratorRequest {
/// {@macro create_app_collaborator_request}
const CreateAppCollaboratorRequest({required this.email});
/// Converts a Map<String, dynamic> to a [CreateAppCollaboratorRequest]
/// Converts a `Map<String, dynamic>` to a [CreateAppCollaboratorRequest]
factory CreateAppCollaboratorRequest.fromJson(Map<String, dynamic> json) =>
_$CreateAppCollaboratorRequestFromJson(json);
/// Converts a [CreateAppCollaboratorRequest] to a Map<String, dynamic>
/// Converts a [CreateAppCollaboratorRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreateAppCollaboratorRequestToJson(this);
/// The email of the collaborator to add.
@@ -3,18 +3,18 @@ import 'package:json_annotation/json_annotation.dart';
part 'create_channel_request.g.dart';
/// {@template create_channel_request}
/// The request body for POST /api/v1/apps/<appId>/channels
/// The request body for POST /api/v1/apps/:appId/channels
/// {@endtemplate}
@JsonSerializable()
class CreateChannelRequest {
/// {@macro create_channel_request}
const CreateChannelRequest({required this.channel});
/// Converts a Map<String, dynamic> to a [CreateChannelRequest]
/// Converts a `Map<String, dynamic>` to a [CreateChannelRequest]
factory CreateChannelRequest.fromJson(Map<String, dynamic> json) =>
_$CreateChannelRequestFromJson(json);
/// Converts a [CreateChannelRequest] to a Map<String, dynamic>
/// Converts a [CreateChannelRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreateChannelRequestToJson(this);
/// The channel name.
@@ -14,11 +14,11 @@ class CreatePatchRequest {
required this.metadata,
});
/// Converts a Map<String, dynamic> to a [CreatePatchRequest]
/// Converts a `Map<String, dynamic>` to a [CreatePatchRequest]
factory CreatePatchRequest.fromJson(Map<String, dynamic> json) =>
_$CreatePatchRequestFromJson(json);
/// Converts a [CreatePatchRequest] to a Map<String, dynamic>
/// Converts a [CreatePatchRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreatePatchRequestToJson(this);
/// The ID of the release.
@@ -10,11 +10,11 @@ class CreatePatchResponse {
/// {@macro create_patch_response}
const CreatePatchResponse({required this.id, required this.number});
/// Converts a Map<String, dynamic> to a [CreatePatchResponse]
/// Converts a `Map<String, dynamic>` to a [CreatePatchResponse]
factory CreatePatchResponse.fromJson(Map<String, dynamic> json) =>
_$CreatePatchResponseFromJson(json);
/// Converts a [CreatePatchResponse] to a Map<String, dynamic>
/// Converts a [CreatePatchResponse] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreatePatchResponseToJson(this);
/// The unique patch identifier.
@@ -4,7 +4,7 @@ import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
part 'create_patch_artifact_request.g.dart';
/// {@template create_patch_artifact_request}
/// The request body for POST /api/v1/patches/<id>/artifacts
/// The request body for POST /api/v1/patches/:id/artifacts
/// {@endtemplate}
@JsonSerializable()
class CreatePatchArtifactRequest {
@@ -18,11 +18,11 @@ class CreatePatchArtifactRequest {
this.podfileLockHash,
});
/// Converts a Map<String, dynamic> to a [CreatePatchArtifactRequest]
/// Converts a `Map<String, dynamic>` to a [CreatePatchArtifactRequest]
factory CreatePatchArtifactRequest.fromJson(Map<String, dynamic> json) =>
_$CreatePatchArtifactRequestFromJson(json);
/// Converts a [CreatePatchArtifactRequest] to a Map<String, dynamic>.
/// Converts a [CreatePatchArtifactRequest] to a `Map<String, dynamic>`.
Json toJson() => _$CreatePatchArtifactRequestToJson(this);
/// The arch of the artifact.
@@ -4,7 +4,7 @@ import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
part 'create_patch_artifact_response.g.dart';
/// {@template create_patch_artifact_response}
/// The response body for POST /api/v1/patches/<id>/artifacts
/// The response body for POST /api/v1/patches/:id/artifacts
/// {@endtemplate}
@JsonSerializable()
class CreatePatchArtifactResponse {
@@ -19,11 +19,11 @@ class CreatePatchArtifactResponse {
required this.url,
});
/// Converts a Map<String, dynamic> to a [CreatePatchArtifactResponse]
/// Converts a `Map<String, dynamic>` to a [CreatePatchArtifactResponse]
factory CreatePatchArtifactResponse.fromJson(Map<String, dynamic> json) =>
_$CreatePatchArtifactResponseFromJson(json);
/// Converts a [CreatePatchArtifactResponse] to a Map<String, dynamic>.
/// Converts a [CreatePatchArtifactResponse] to a `Map<String, dynamic>`.
Json toJson() => _$CreatePatchArtifactResponseToJson(this);
/// The ID of the artifact;
@@ -3,7 +3,7 @@ import 'package:json_annotation/json_annotation.dart';
part 'create_release_request.g.dart';
/// {@template create_release_request}
/// The request body for POST /api/v1/apps/<appId>/releases
/// The request body for POST /api/v1/apps/:appId/releases
/// {@endtemplate}
@JsonSerializable()
class CreateReleaseRequest {
@@ -15,11 +15,11 @@ class CreateReleaseRequest {
this.displayName,
});
/// Converts a Map<String, dynamic> to a [CreateReleaseRequest]
/// Converts a `Map<String, dynamic>` to a [CreateReleaseRequest]
factory CreateReleaseRequest.fromJson(Map<String, dynamic> json) =>
_$CreateReleaseRequestFromJson(json);
/// Converts a [CreateReleaseRequest] to a Map<String, dynamic>
/// Converts a [CreateReleaseRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreateReleaseRequestToJson(this);
/// The release version.
@@ -4,7 +4,7 @@ import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
part 'create_release_response.g.dart';
/// {@template create_release_response}
/// The response body for POST /api/v1/apps/<appId>/releases
/// The response body for POST /api/v1/apps/:appId/releases
/// {@endtemplate}
@JsonSerializable()
class CreateReleaseResponse {
@@ -13,11 +13,11 @@ class CreateReleaseResponse {
required this.release,
});
/// Converts a Map<String, dynamic> to a [CreateReleaseResponse]
/// Converts a `Map<String, dynamic>` to a [CreateReleaseResponse]
factory CreateReleaseResponse.fromJson(Map<String, dynamic> json) =>
_$CreateReleaseResponseFromJson(json);
/// Converts a [CreateReleaseResponse] to a Map<String, dynamic>
/// Converts a [CreateReleaseResponse] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$CreateReleaseResponseToJson(this);
/// The newly-created release.
@@ -22,11 +22,11 @@ class CreateReleaseArtifactRequest {
required this.podfileLockHash,
});
/// Converts a Map<String, dynamic> to a [CreateReleaseArtifactRequest]
/// Converts a `Map<String, dynamic>` to a [CreateReleaseArtifactRequest]
factory CreateReleaseArtifactRequest.fromJson(Map<String, dynamic> json) =>
_$CreateReleaseArtifactRequestFromJson(json);
/// Converts a [CreateReleaseArtifactRequest] to a Map<String, dynamic>.
/// Converts a [CreateReleaseArtifactRequest] to a `Map<String, dynamic>`.
Json toJson() => _$CreateReleaseArtifactRequestToJson(this);
/// The arch of the artifact.
@@ -19,11 +19,11 @@ class CreateReleaseArtifactResponse {
required this.url,
});
/// Converts a Map<String, dynamic> to a [CreateReleaseArtifactResponse]
/// Converts a `Map<String, dynamic>` to a [CreateReleaseArtifactResponse]
factory CreateReleaseArtifactResponse.fromJson(Map<String, dynamic> json) =>
_$CreateReleaseArtifactResponseFromJson(json);
/// Converts a [CreateReleaseArtifactResponse] to a Map<String, dynamic>.
/// Converts a [CreateReleaseArtifactResponse] to a `Map<String, dynamic>`.
Json toJson() => _$CreateReleaseArtifactResponseToJson(this);
/// The ID of the artifact;
@@ -11,11 +11,11 @@ class GetAppsResponse {
/// {@macro get_apps_response}
const GetAppsResponse({required this.apps});
/// Converts a Map<String, dynamic> to a [GetAppsResponse].
/// Converts a `Map<String, dynamic>` to a [GetAppsResponse].
factory GetAppsResponse.fromJson(Map<String, dynamic> json) =>
_$GetAppsResponseFromJson(json);
/// Converts a [GetAppsResponse] to a Map<String, dynamic>.
/// Converts a [GetAppsResponse] to a `Map<String, dynamic>`.
Json toJson() => _$GetAppsResponseToJson(this);
/// The list of apps.
@@ -11,11 +11,11 @@ class GetReleaseArtifactsResponse {
/// {@macro get_release_artifacts_response}
const GetReleaseArtifactsResponse({required this.artifacts});
/// Converts a Map<String, dynamic> to a [GetReleaseArtifactsResponse].
/// Converts a `Map<String, dynamic>` to a [GetReleaseArtifactsResponse].
factory GetReleaseArtifactsResponse.fromJson(Map<String, dynamic> json) =>
_$GetReleaseArtifactsResponseFromJson(json);
/// Converts a [GetReleaseArtifactsResponse] to a Map<String, dynamic>.
/// Converts a [GetReleaseArtifactsResponse] to a `Map<String, dynamic>`.
Json toJson() => _$GetReleaseArtifactsResponseToJson(this);
/// The artifacts for the release.
@@ -11,11 +11,11 @@ class GetReleasePatchesResponse {
/// {@macro get_release_patches_response}
const GetReleasePatchesResponse({required this.patches});
/// Converts a Map<String, dynamic> to a [GetReleasePatchesResponse]
/// Converts a `Map<String, dynamic>` to a [GetReleasePatchesResponse]
factory GetReleasePatchesResponse.fromJson(Map<String, dynamic> json) =>
_$GetReleasePatchesResponseFromJson(json);
/// Converts a [GetReleasePatchesResponse] to a Map<String, dynamic>
/// Converts a [GetReleasePatchesResponse] to a `Map<String, dynamic>`
Json toJson() => _$GetReleasePatchesResponseToJson(this);
/// List of patches.
@@ -11,11 +11,11 @@ class GetReleasesResponse {
/// {@macro get_releases_response}
const GetReleasesResponse({required this.releases});
/// Converts a Map<String, dynamic> to a [GetReleasesResponse].
/// Converts a `Map<String, dynamic>` to a [GetReleasesResponse].
factory GetReleasesResponse.fromJson(Map<String, dynamic> json) =>
_$GetReleasesResponseFromJson(json);
/// Converts a [GetReleasesResponse] to a Map<String, dynamic>.
/// Converts a [GetReleasesResponse] to a `Map<String, dynamic>`.
Json toJson() => _$GetReleasesResponseToJson(this);
/// The list of releases for the app.
@@ -10,11 +10,11 @@ class PromotePatchRequest {
/// {@macro promote_patch_request}
const PromotePatchRequest({required this.patchId, required this.channelId});
/// Converts a Map<String, dynamic> to a [PromotePatchRequest]
/// Converts a `Map<String, dynamic>` to a [PromotePatchRequest]
factory PromotePatchRequest.fromJson(Map<String, dynamic> json) =>
_$PromotePatchRequestFromJson(json);
/// Converts a [PromotePatchRequest] to a Map<String, dynamic>
/// Converts a [PromotePatchRequest] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$PromotePatchRequestToJson(this);
/// The ID of the patch.
@@ -5,7 +5,7 @@ part 'update_app_collaborator_request.g.dart';
/// {@template update_app_collaborator_request}
/// The request body for
/// PATCH /api/v1/apps/<appId>/collaborators/<collaboratorId>
/// PATCH /api/v1/apps/:appId/collaborators/:collaboratorId
/// {@endtemplate}
@JsonSerializable()
class UpdateAppCollaboratorRequest {
@@ -14,11 +14,11 @@ class UpdateAppCollaboratorRequest {
required this.role,
});
/// Converts a Map<String, dynamic> to a [UpdateAppCollaboratorRequest].
/// Converts a `Map<String, dynamic>` to a [UpdateAppCollaboratorRequest].
factory UpdateAppCollaboratorRequest.fromJson(Map<String, dynamic> json) =>
_$UpdateAppCollaboratorRequestFromJson(json);
/// Converts a [UpdateAppCollaboratorRequest] to a Map<String, dynamic>.
/// Converts a [UpdateAppCollaboratorRequest] to a `Map<String, dynamic>`.
Map<String, dynamic> toJson() => _$UpdateAppCollaboratorRequestToJson(this);
/// The new role for the collaborator.
@@ -15,11 +15,11 @@ class UpdateReleaseRequest {
required this.metadata,
});
/// Converts a Map<String, dynamic> to a [UpdateReleaseRequest].
/// Converts a `Map<String, dynamic>` to a [UpdateReleaseRequest].
factory UpdateReleaseRequest.fromJson(Json json) =>
_$UpdateReleaseRequestFromJson(json);
/// Converts a [UpdateReleaseRequest] to a Map<String, dynamic>.
/// Converts a [UpdateReleaseRequest] to a `Map<String, dynamic>`.
Json toJson() => _$UpdateReleaseRequestToJson(this);
/// The desired status of the release.
@@ -13,10 +13,10 @@ class App {
required this.displayName,
});
/// Converts a Map<String, dynamic> to an [App]
/// Converts a `Map<String, dynamic>` to an [App]
factory App.fromJson(Map<String, dynamic> json) => _$AppFromJson(json);
/// Converts a [App] to a Map<String, dynamic>
/// Converts a [App] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$AppToJson(this);
/// The ID of the app.
@@ -18,11 +18,11 @@ class AppMetadata extends Equatable {
this.latestPatchNumber,
});
/// Converts a Map<String, dynamic> to an [AppMetadata]
/// Converts a `Map<String, dynamic>` to an [AppMetadata]
factory AppMetadata.fromJson(Map<String, dynamic> json) =>
_$AppMetadataFromJson(json);
/// Converts a [AppMetadata] to a Map<String, dynamic>
/// Converts a [AppMetadata] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$AppMetadataToJson(this);
/// The ID of the app.
@@ -12,11 +12,11 @@ class Channel {
/// {@macro channel}
const Channel({required this.id, required this.appId, required this.name});
/// Converts a Map<String, dynamic> to a [Channel]
/// Converts a `Map<String, dynamic>` to a [Channel]
factory Channel.fromJson(Map<String, dynamic> json) =>
_$ChannelFromJson(json);
/// Converts a [Channel] to a Map<String, dynamic>
/// Converts a [Channel] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$ChannelToJson(this);
/// The ID of the channel;
@@ -12,10 +12,10 @@ class Patch {
/// {@macro patch}
const Patch({required this.id, required this.number});
/// Converts a Map<String, dynamic> to a [Patch]
/// Converts a `Map<String, dynamic>` to a [Patch]
factory Patch.fromJson(Map<String, dynamic> json) => _$PatchFromJson(json);
/// Converts a [Patch] to a Map<String, dynamic>
/// Converts a [Patch] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$PatchToJson(this);
/// The unique patch identifier.
@@ -20,11 +20,11 @@ class PatchArtifact {
required this.createdAt,
});
/// Converts a Map<String, dynamic> to a [PatchArtifact]
/// Converts a `Map<String, dynamic>` to a [PatchArtifact]
factory PatchArtifact.fromJson(Map<String, dynamic> json) =>
_$PatchArtifactFromJson(json);
/// Converts a [PatchArtifact] to a Map<String, dynamic>
/// Converts a [PatchArtifact] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$PatchArtifactToJson(this);
/// The ID of the artifact;
@@ -22,7 +22,7 @@ class PrivateUser {
this.patchOverageLimit,
});
/// Converts a Map<String, dynamic> to a [PrivateUser]
/// Converts a `Map<String, dynamic>` to a [PrivateUser]
factory PrivateUser.fromJson(Map<String, dynamic> json) =>
_$PrivateUserFromJson(json);
@@ -49,7 +49,7 @@ class PrivateUser {
);
// coverage:ignore-end
/// Converts a [PrivateUser] to a Map<String, dynamic>
/// Converts a [PrivateUser] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$PrivateUserToJson(this);
/// The unique user identifier.
@@ -15,7 +15,7 @@ class PublicUser {
required this.displayName,
});
/// Converts a Map<String, dynamic> to a [PublicUser]
/// Converts a `Map<String, dynamic>` to a [PublicUser]
factory PublicUser.fromJson(Map<String, dynamic> json) =>
_$PublicUserFromJson(json);
@@ -22,11 +22,11 @@ class Release {
required this.updatedAt,
});
/// Converts a Map<String, dynamic> to a [Release]
/// Converts a `Map<String, dynamic>` to a [Release]
factory Release.fromJson(Map<String, dynamic> json) =>
_$ReleaseFromJson(json);
/// Converts a [Release] to a Map<String, dynamic>
/// Converts a [Release] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$ReleaseToJson(this);
/// The ID of the release;
@@ -22,11 +22,11 @@ class ReleaseArtifact {
required this.canSideload,
});
/// Converts a Map<String, dynamic> to a [ReleaseArtifact]
/// Converts a `Map<String, dynamic>` to a [ReleaseArtifact]
factory ReleaseArtifact.fromJson(Map<String, dynamic> json) =>
_$ReleaseArtifactFromJson(json);
/// Converts a [ReleaseArtifact] to a Map<String, dynamic>
/// Converts a [ReleaseArtifact] to a `Map<String, dynamic>`
Map<String, dynamic> toJson() => _$ReleaseArtifactToJson(this);
/// The ID of the artifact;
@@ -19,11 +19,11 @@ class ReleasePatch extends Equatable {
required this.isRolledBack,
});
/// Converts a Map<String, dynamic> to a [ReleasePatch]
/// Converts a `Map<String, dynamic>` to a [ReleasePatch]
factory ReleasePatch.fromJson(Map<String, dynamic> json) =>
_$ReleasePatchFromJson(json);
/// Converts a [ReleasePatch] to a Map<String, dynamic>
/// Converts a [ReleasePatch] to a `Map<String, dynamic>`
Json toJson() => _$ReleasePatchToJson(this);
/// The patch id.
@@ -1,12 +1,15 @@
/// A platform to which a Shorebird release can be deployed.
enum ReleasePlatform {
// ignore: public_member_api_docs
/// Android
android('Android'),
// ignore: public_member_api_docs
/// macOS
macos('macOS'),
// ignore: public_member_api_docs
/// iOS
ios('iOS'),
// ignore: public_member_api_docs
/// Windows
windows('Windows');
const ReleasePlatform(this.displayName);
@@ -19,4 +19,4 @@ dev_dependencies:
json_serializable: ^6.6.1
mocktail: ^1.0.0
test: ^1.19.2
very_good_analysis: ^6.0.0
very_good_analysis: ^7.0.0
@@ -1,5 +1,3 @@
// ignore_for_file: prefer_const_constructors
import 'package:shorebird_code_push_protocol/shorebird_code_push_protocol.dart';
import 'package:test/test.dart';
@@ -7,6 +5,8 @@ void main() {
group(ReleasePatch, () {
test('is equatable', () {
expect(
// Ignoring const constructor for equality comparison.
// ignore: prefer_const_constructors
ReleasePatch(
id: 0,
number: 1,
@@ -15,6 +15,8 @@ void main() {
artifacts: const [],
),
equals(
// Ignoring const constructor for equality comparison.
// ignore: prefer_const_constructors
ReleasePatch(
id: 0,
number: 1,