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

style: change parameter style to avoid_final_parameters #1325

Merged
merged 5 commits into from
Dec 20, 2023
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
28 changes: 14 additions & 14 deletions packages/app/integration_test/screenshot_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:universal_io/io.dart';

Future<void> runTestApp(
final WidgetTester tester,
final IntegrationTestWidgetsFlutterBinding binding, {
final Account? account,
WidgetTester tester,
IntegrationTestWidgetsFlutterBinding binding, {
Account? account,
}) async {
await runNeon(
appImplementations: appImplementations,
Expand All @@ -33,23 +33,23 @@ Future<void> runTestApp(
await tester.pumpAndSettle();
}

Future<void> openDrawer(final WidgetTester tester) async {
Future<void> openDrawer(WidgetTester tester) async {
await tester.tap(find.byTooltip('Open navigation menu'));
await tester.pumpAndSettle();
}

Future<void> switchPage(final WidgetTester tester, final String name) async {
Future<void> switchPage(WidgetTester tester, String name) async {
await openDrawer(tester);
await tester.tap(find.text(name).last);
await tester.pumpAndSettle();
}

Future<void> prepareScreenshot(final WidgetTester tester, final IntegrationTestWidgetsFlutterBinding binding) async {
Future<void> prepareScreenshot(WidgetTester tester, IntegrationTestWidgetsFlutterBinding binding) async {
await binding.convertFlutterSurfaceToImage();
await tester.pumpAndSettle();
}

Future<Account> getAccount(final String username) async {
Future<Account> getAccount(String username) async {
final host = Uri(scheme: 'http', host: '10.0.2.2');
final appPassword = (await NextcloudClient(
host,
Expand Down Expand Up @@ -85,7 +85,7 @@ Future<void> main() async {
SharedPreferences.setMockInitialValues({});
});

testWidgets('login', (final tester) async {
testWidgets('login', (tester) async {
await runTestApp(
tester,
binding,
Expand All @@ -94,7 +94,7 @@ Future<void> main() async {
await binding.takeScreenshot('login_server_selection');
});

testWidgets('home', (final tester) async {
testWidgets('home', (tester) async {
await runTestApp(
tester,
binding,
Expand All @@ -107,7 +107,7 @@ Future<void> main() async {
await binding.takeScreenshot('home_drawer');
});

testWidgets('files', (final tester) async {
testWidgets('files', (tester) async {
await runTestApp(
tester,
binding,
Expand Down Expand Up @@ -146,7 +146,7 @@ Future<void> main() async {
await binding.takeScreenshot('files_create');
});

testWidgets('news', (final tester) async {
testWidgets('news', (tester) async {
const wikipediaFeedURL = 'https://en.wikipedia.org/w/api.php?action=featuredfeed&feed=featured&feedformat=atom';
const nasaFeedURL = 'https://www.nasa.gov/rss/dyn/breaking_news.rss';

Expand Down Expand Up @@ -220,7 +220,7 @@ Future<void> main() async {
await binding.takeScreenshot('news_articles_starred_list');
});

testWidgets('notes', (final tester) async {
testWidgets('notes', (tester) async {
await account.client.notes.createNote(
title: 'Wishlist',
category: 'Financial',
Expand Down Expand Up @@ -282,7 +282,7 @@ Future<void> main() async {
await binding.takeScreenshot('notes_categories_list');
});

testWidgets('notifications', (final tester) async {
testWidgets('notifications', (tester) async {
await (await getAccount('admin')).client.notifications.api.generateNotification(
userId: account.username,
shortMessage: 'Notifications demo',
Expand All @@ -304,7 +304,7 @@ Future<void> main() async {
await binding.takeScreenshot('notifications_list');
});

testWidgets('settings', (final tester) async {
testWidgets('settings', (tester) async {
await runTestApp(
tester,
binding,
Expand Down
2 changes: 1 addition & 1 deletion packages/app/test_driver/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Future<void> main() async {
Directory('screenshots').createSync();
try {
await integrationDriver(
onScreenshot: (final screenshotName, final screenshotBytes, [final args]) async {
onScreenshot: (screenshotName, screenshotBytes, [args]) async {
final file = File('screenshots/$screenshotName.png');
if (!file.existsSync()) {
file.writeAsBytesSync(screenshotBytes);
Expand Down
3 changes: 3 additions & 0 deletions packages/dynamite/dynamite/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ include: package:neon_lints/dart.yaml
linter:
rules:
public_member_api_docs: false
# TODO: migrate package to new lint rules
prefer_final_parameters: true
avoid_final_parameters: false

analyzer:
exclude:
Expand Down
2 changes: 1 addition & 1 deletion packages/dynamite/dynamite/lib/src/builder/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Iterable<String> buildAuthCheck(
yield '''
// coverage:ignore-start
final authentication = $client.authentications.firstWhereOrNull(
(final auth) => switch (auth) {
(auth) => switch (auth) {
''';

yield* securityRequirements.map((final requirement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TypeResultList extends TypeResult {
final String? mimeType,
}) {
if (onlyChildren) {
return '($object as List).map<String>((final e) => ${subType.encode('e', mimeType: mimeType)}).join()';
return '($object as List).map<String>((e) => ${subType.encode('e', mimeType: mimeType)}).join()';
}

return super.encode(object, mimeType: mimeType);
Expand Down
24 changes: 11 additions & 13 deletions packages/dynamite/dynamite_end_to_end_test/lib/all_of.openapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Client extends DynamiteClient {
super.cookieJar,
});

Client.fromClient(final DynamiteClient client)
Client.fromClient(DynamiteClient client)
: super(
client.baseURL,
baseHeaders: client.baseHeaders,
Expand All @@ -48,11 +48,11 @@ abstract interface class $ObjectAllOf_1Interface {
abstract interface class $ObjectAllOfInterface implements $ObjectAllOf_0Interface, $ObjectAllOf_1Interface {}

abstract class ObjectAllOf implements $ObjectAllOfInterface, Built<ObjectAllOf, ObjectAllOfBuilder> {
factory ObjectAllOf([final void Function(ObjectAllOfBuilder)? b]) = _$ObjectAllOf;
factory ObjectAllOf([void Function(ObjectAllOfBuilder)? b]) = _$ObjectAllOf;

const ObjectAllOf._();

factory ObjectAllOf.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory ObjectAllOf.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -69,12 +69,11 @@ abstract interface class $OneObjectAllOf_0Interface {
abstract interface class $OneObjectAllOfInterface implements $OneObjectAllOf_0Interface {}

abstract class OneObjectAllOf implements $OneObjectAllOfInterface, Built<OneObjectAllOf, OneObjectAllOfBuilder> {
factory OneObjectAllOf([final void Function(OneObjectAllOfBuilder)? b]) = _$OneObjectAllOf;
factory OneObjectAllOf([void Function(OneObjectAllOfBuilder)? b]) = _$OneObjectAllOf;

const OneObjectAllOf._();

factory OneObjectAllOf.fromJson(final Map<String, dynamic> json) =>
jsonSerializers.deserializeWith(serializer, json)!;
factory OneObjectAllOf.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -90,12 +89,11 @@ abstract interface class $PrimitiveAllOfInterface {
}

abstract class PrimitiveAllOf implements $PrimitiveAllOfInterface, Built<PrimitiveAllOf, PrimitiveAllOfBuilder> {
factory PrimitiveAllOf([final void Function(PrimitiveAllOfBuilder)? b]) = _$PrimitiveAllOf;
factory PrimitiveAllOf([void Function(PrimitiveAllOfBuilder)? b]) = _$PrimitiveAllOf;

const PrimitiveAllOf._();

factory PrimitiveAllOf.fromJson(final Map<String, dynamic> json) =>
jsonSerializers.deserializeWith(serializer, json)!;
factory PrimitiveAllOf.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -115,11 +113,11 @@ abstract interface class $MixedAllOfInterface implements $MixedAllOf_1Interface
}

abstract class MixedAllOf implements $MixedAllOfInterface, Built<MixedAllOf, MixedAllOfBuilder> {
factory MixedAllOf([final void Function(MixedAllOfBuilder)? b]) = _$MixedAllOf;
factory MixedAllOf([void Function(MixedAllOfBuilder)? b]) = _$MixedAllOf;

const MixedAllOf._();

factory MixedAllOf.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory MixedAllOf.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -133,11 +131,11 @@ abstract interface class $OneValueAllOfInterface {
}

abstract class OneValueAllOf implements $OneValueAllOfInterface, Built<OneValueAllOf, OneValueAllOfBuilder> {
factory OneValueAllOf([final void Function(OneValueAllOfBuilder)? b]) = _$OneValueAllOf;
factory OneValueAllOf([void Function(OneValueAllOfBuilder)? b]) = _$OneValueAllOf;

const OneValueAllOf._();

factory OneValueAllOf.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory OneValueAllOf.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand Down
61 changes: 30 additions & 31 deletions packages/dynamite/dynamite_end_to_end_test/lib/any_of.openapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Client extends DynamiteClient {
super.cookieJar,
});

Client.fromClient(final DynamiteClient client)
Client.fromClient(DynamiteClient client)
: super(
client.baseURL,
baseHeaders: client.baseHeaders,
Expand All @@ -48,11 +48,11 @@ abstract interface class $ObjectAnyOf0Interface {
}

abstract class ObjectAnyOf0 implements $ObjectAnyOf0Interface, Built<ObjectAnyOf0, ObjectAnyOf0Builder> {
factory ObjectAnyOf0([final void Function(ObjectAnyOf0Builder)? b]) = _$ObjectAnyOf0;
factory ObjectAnyOf0([void Function(ObjectAnyOf0Builder)? b]) = _$ObjectAnyOf0;

const ObjectAnyOf0._();

factory ObjectAnyOf0.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory ObjectAnyOf0.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -66,11 +66,11 @@ abstract interface class $ObjectAnyOf1Interface {
}

abstract class ObjectAnyOf1 implements $ObjectAnyOf1Interface, Built<ObjectAnyOf1, ObjectAnyOf1Builder> {
factory ObjectAnyOf1([final void Function(ObjectAnyOf1Builder)? b]) = _$ObjectAnyOf1;
factory ObjectAnyOf1([void Function(ObjectAnyOf1Builder)? b]) = _$ObjectAnyOf1;

const ObjectAnyOf1._();

factory ObjectAnyOf1.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory ObjectAnyOf1.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -84,11 +84,11 @@ abstract interface class $MixedAnyOf1Interface {
}

abstract class MixedAnyOf1 implements $MixedAnyOf1Interface, Built<MixedAnyOf1, MixedAnyOf1Builder> {
factory MixedAnyOf1([final void Function(MixedAnyOf1Builder)? b]) = _$MixedAnyOf1;
factory MixedAnyOf1([void Function(MixedAnyOf1Builder)? b]) = _$MixedAnyOf1;

const MixedAnyOf1._();

factory MixedAnyOf1.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory MixedAnyOf1.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -102,12 +102,11 @@ abstract interface class $OneObjectAnyOf0Interface {
}

abstract class OneObjectAnyOf0 implements $OneObjectAnyOf0Interface, Built<OneObjectAnyOf0, OneObjectAnyOf0Builder> {
factory OneObjectAnyOf0([final void Function(OneObjectAnyOf0Builder)? b]) = _$OneObjectAnyOf0;
factory OneObjectAnyOf0([void Function(OneObjectAnyOf0Builder)? b]) = _$OneObjectAnyOf0;

const OneObjectAnyOf0._();

factory OneObjectAnyOf0.fromJson(final Map<String, dynamic> json) =>
jsonSerializers.deserializeWith(serializer, json)!;
factory OneObjectAnyOf0.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;

Map<String, dynamic> toJson() => jsonSerializers.serializeWith(serializer, this)! as Map<String, dynamic>;

Expand All @@ -127,7 +126,7 @@ extension $ObjectAnyOf0ObjectAnyOf1Extension on $ObjectAnyOf0ObjectAnyOf1 {
void validateOneOf() => dynamite_utils.validateOneOf(_values);
void validateAnyOf() => dynamite_utils.validateAnyOf(_values);
static Serializer<$ObjectAnyOf0ObjectAnyOf1> get serializer => const _$ObjectAnyOf0ObjectAnyOf1Serializer();
static $ObjectAnyOf0ObjectAnyOf1 fromJson(final Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
static $ObjectAnyOf0ObjectAnyOf1 fromJson(Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
Object? toJson() => jsonSerializers.serializeWith(serializer, this);
}

Expand All @@ -142,9 +141,9 @@ class _$ObjectAnyOf0ObjectAnyOf1Serializer implements PrimitiveSerializer<$Objec

@override
Object serialize(
final Serializers serializers,
final $ObjectAnyOf0ObjectAnyOf1 object, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
$ObjectAnyOf0ObjectAnyOf1 object, {
FullType specifiedType = FullType.unspecified,
}) {
dynamic value;
value = object.objectAnyOf0;
Expand All @@ -161,9 +160,9 @@ class _$ObjectAnyOf0ObjectAnyOf1Serializer implements PrimitiveSerializer<$Objec

@override
$ObjectAnyOf0ObjectAnyOf1 deserialize(
final Serializers serializers,
final Object data, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
Object data, {
FullType specifiedType = FullType.unspecified,
}) {
ObjectAnyOf0? objectAnyOf0;
try {
Expand All @@ -184,7 +183,7 @@ extension $MixedAnyOf1StringExtension on $MixedAnyOf1String {
void validateOneOf() => dynamite_utils.validateOneOf(_values);
void validateAnyOf() => dynamite_utils.validateAnyOf(_values);
static Serializer<$MixedAnyOf1String> get serializer => const _$MixedAnyOf1StringSerializer();
static $MixedAnyOf1String fromJson(final Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
static $MixedAnyOf1String fromJson(Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
Object? toJson() => jsonSerializers.serializeWith(serializer, this);
}

Expand All @@ -199,9 +198,9 @@ class _$MixedAnyOf1StringSerializer implements PrimitiveSerializer<$MixedAnyOf1S

@override
Object serialize(
final Serializers serializers,
final $MixedAnyOf1String object, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
$MixedAnyOf1String object, {
FullType specifiedType = FullType.unspecified,
}) {
dynamic value;
value = object.mixedAnyOf1;
Expand All @@ -218,9 +217,9 @@ class _$MixedAnyOf1StringSerializer implements PrimitiveSerializer<$MixedAnyOf1S

@override
$MixedAnyOf1String deserialize(
final Serializers serializers,
final Object data, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
Object data, {
FullType specifiedType = FullType.unspecified,
}) {
MixedAnyOf1? mixedAnyOf1;
try {
Expand All @@ -241,7 +240,7 @@ extension $NumStringExtension on $NumString {
void validateOneOf() => dynamite_utils.validateOneOf(_values);
void validateAnyOf() => dynamite_utils.validateAnyOf(_values);
static Serializer<$NumString> get serializer => const _$NumStringSerializer();
static $NumString fromJson(final Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
static $NumString fromJson(Object? json) => jsonSerializers.deserializeWith(serializer, json)!;
Object? toJson() => jsonSerializers.serializeWith(serializer, this);
}

Expand All @@ -256,9 +255,9 @@ class _$NumStringSerializer implements PrimitiveSerializer<$NumString> {

@override
Object serialize(
final Serializers serializers,
final $NumString object, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
$NumString object, {
FullType specifiedType = FullType.unspecified,
}) {
dynamic value;
value = object.$num;
Expand All @@ -275,9 +274,9 @@ class _$NumStringSerializer implements PrimitiveSerializer<$NumString> {

@override
$NumString deserialize(
final Serializers serializers,
final Object data, {
final FullType specifiedType = FullType.unspecified,
Serializers serializers,
Object data, {
FullType specifiedType = FullType.unspecified,
}) {
num? $num;
try {
Expand Down
Loading