From bdcc0e067af41abda5ce85a8aa69ff814378e624 Mon Sep 17 00:00:00 2001 From: Honza Bittner Date: Tue, 12 Dec 2023 09:20:33 +0100 Subject: [PATCH 1/2] Adhere to netglade_analysis 6 --- examples/drift/pubspec.yaml | 2 +- examples/example/pubspec.yaml | 2 +- examples/freezed/pubspec.yaml | 2 +- examples/injectable/pubspec.yaml | 2 +- examples/json_serializable/pubspec.yaml | 2 +- packages/auto_mappr/example/pubspec.yaml | 2 +- .../assignments/assignment_builder_base.dart | 5 +- .../iterable_assignment_builder.dart | 2 +- .../assignments/map_assignment_builder.dart | 2 +- .../nested_object_assignment_builder.dart | 2 +- .../assignments/nested_object_mixin.dart | 6 +- .../record_assignment_builder.dart | 2 +- .../assignments/type_converter_builder.dart | 2 +- .../lib/src/builder/auto_mappr_builder.dart | 2 +- .../map_bodies/class_body_builder.dart | 8 +-- .../builder/map_bodies/enum_body_builder.dart | 2 +- .../map_bodies/map_body_builder_base.dart | 5 +- .../map_model_body_method_builder.dart | 9 +-- .../methods/mapping_method_builder.dart | 7 ++- .../src/builder/value_assignment_builder.dart | 15 ++--- .../lib/src/helpers/run_zoned_auto_mappr.dart | 2 +- packages/auto_mappr/pubspec.yaml | 2 +- .../builder/convert_method_builder_test.dart | 6 +- .../integration/convert_iterable_test.dart | 2 + .../test/integration/delegates_test.dart | 56 ++++++++--------- .../fixture/mapping_from_source.dart | 4 +- .../integration/fixture/type_converters.dart | 2 +- .../test/integration/generics_test.dart | 12 ++-- .../test/integration/includes_test.dart | 62 +++++++++---------- .../auto_mappr/test/integration/map_test.dart | 2 +- .../selecting_constructor_test.dart | 12 ++-- .../example/pubspec.yaml | 2 +- .../lib/src/map_extension.dart | 1 + .../lib/src/type_converter.dart | 1 + packages/auto_mappr_annotation/pubspec.yaml | 2 +- 35 files changed, 129 insertions(+), 120 deletions(-) diff --git a/examples/drift/pubspec.yaml b/examples/drift/pubspec.yaml index 65ff2f87..811353bf 100644 --- a/examples/drift/pubspec.yaml +++ b/examples/drift/pubspec.yaml @@ -15,5 +15,5 @@ dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 drift_dev: ^2.7.0 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/examples/example/pubspec.yaml b/examples/example/pubspec.yaml index b7947c6f..0f30df48 100644 --- a/examples/example/pubspec.yaml +++ b/examples/example/pubspec.yaml @@ -13,5 +13,5 @@ dependencies: dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/examples/freezed/pubspec.yaml b/examples/freezed/pubspec.yaml index 0f5f4ca7..4d283853 100644 --- a/examples/freezed/pubspec.yaml +++ b/examples/freezed/pubspec.yaml @@ -15,5 +15,5 @@ dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 freezed: ^2.3.2 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/examples/injectable/pubspec.yaml b/examples/injectable/pubspec.yaml index c729f096..74cc9e8a 100644 --- a/examples/injectable/pubspec.yaml +++ b/examples/injectable/pubspec.yaml @@ -16,5 +16,5 @@ dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 injectable_generator: ^2.1.5 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/examples/json_serializable/pubspec.yaml b/examples/json_serializable/pubspec.yaml index dcdbfcbf..d27af85d 100644 --- a/examples/json_serializable/pubspec.yaml +++ b/examples/json_serializable/pubspec.yaml @@ -14,5 +14,5 @@ dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 json_serializable: ^6.6.1 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/packages/auto_mappr/example/pubspec.yaml b/packages/auto_mappr/example/pubspec.yaml index 3111f3cd..0d81f792 100644 --- a/packages/auto_mappr/example/pubspec.yaml +++ b/packages/auto_mappr/example/pubspec.yaml @@ -13,5 +13,5 @@ dependencies: dev_dependencies: auto_mappr: ^2.0.0 build_runner: ^2.0.0 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/packages/auto_mappr/lib/src/builder/assignments/assignment_builder_base.dart b/packages/auto_mappr/lib/src/builder/assignments/assignment_builder_base.dart index a3308478..d8d9fc43 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/assignment_builder_base.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/assignment_builder_base.dart @@ -5,7 +5,8 @@ abstract class AssignmentBuilderBase { final SourceAssignment assignment; final AutoMapprConfig mapperConfig; final TypeMapping mapping; - final void Function(TypeMapping? mapping)? usedNullableMethodCallback; + // ignore: prefer-typedefs-for-callbacks, private API + final void Function(TypeMapping? mapping)? onUsedNullableMethodCallback; static const Reference modelReference = Reference('model'); @@ -13,7 +14,7 @@ abstract class AssignmentBuilderBase { required this.assignment, required this.mapperConfig, required this.mapping, - required this.usedNullableMethodCallback, + required this.onUsedNullableMethodCallback, }); Expression buildAssignment(); diff --git a/packages/auto_mappr/lib/src/builder/assignments/iterable_assignment_builder.dart b/packages/auto_mappr/lib/src/builder/assignments/iterable_assignment_builder.dart index 47fd985f..4becadbe 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/iterable_assignment_builder.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/iterable_assignment_builder.dart @@ -11,7 +11,7 @@ class IterableAssignmentBuilder extends AssignmentBuilderBase with NestedObjectM required super.assignment, required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, }); @override diff --git a/packages/auto_mappr/lib/src/builder/assignments/map_assignment_builder.dart b/packages/auto_mappr/lib/src/builder/assignments/map_assignment_builder.dart index 6e51217a..a9d03381 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/map_assignment_builder.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/map_assignment_builder.dart @@ -14,7 +14,7 @@ class MapAssignmentBuilder extends AssignmentBuilderBase with NestedObjectMixin required super.assignment, required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, }); @override diff --git a/packages/auto_mappr/lib/src/builder/assignments/nested_object_assignment_builder.dart b/packages/auto_mappr/lib/src/builder/assignments/nested_object_assignment_builder.dart index f2ac78fa..d99061b9 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/nested_object_assignment_builder.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/nested_object_assignment_builder.dart @@ -14,7 +14,7 @@ class NestedObjectAssignmentBuilder extends AssignmentBuilderBase with NestedObj required super.assignment, required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, required this.source, required this.target, this.convertMethodArgument, diff --git a/packages/auto_mappr/lib/src/builder/assignments/nested_object_mixin.dart b/packages/auto_mappr/lib/src/builder/assignments/nested_object_mixin.dart index 625b969d..903e2c46 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/nested_object_mixin.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/nested_object_mixin.dart @@ -39,7 +39,7 @@ mixin NestedObjectMixin on AssignmentBuilderBase { assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: null, + onUsedNullableMethodCallback: null, convertMethodArgument: convertMethodArgument, source: source, target: target, @@ -102,7 +102,7 @@ mixin NestedObjectMixin on AssignmentBuilderBase { /// When [convertMethodArgument] is null, then a tear off `_mapAlphaDto_to_Alpha` is generated. /// /// This function also marks nullable mapping to be generated - /// using the [usedNullableMethodCallback] callback. + /// using the [onUsedNullableMethodCallback] callback. Expression mappingCall({ required DartType source, required DartType target, @@ -133,7 +133,7 @@ mixin NestedObjectMixin on AssignmentBuilderBase { ); if (useNullableMethod) { - usedNullableMethodCallback?.call(nestedMapping); + onUsedNullableMethodCallback?.call(nestedMapping); } return convertMethodArgument == null diff --git a/packages/auto_mappr/lib/src/builder/assignments/record_assignment_builder.dart b/packages/auto_mappr/lib/src/builder/assignments/record_assignment_builder.dart index ce7d33aa..3d033cf7 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/record_assignment_builder.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/record_assignment_builder.dart @@ -14,7 +14,7 @@ class RecordAssignmentBuilder extends AssignmentBuilderBase with NestedObjectMix required super.assignment, required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, }); @override diff --git a/packages/auto_mappr/lib/src/builder/assignments/type_converter_builder.dart b/packages/auto_mappr/lib/src/builder/assignments/type_converter_builder.dart index 7064d3a9..393812b8 100644 --- a/packages/auto_mappr/lib/src/builder/assignments/type_converter_builder.dart +++ b/packages/auto_mappr/lib/src/builder/assignments/type_converter_builder.dart @@ -14,7 +14,7 @@ class TypeConverterBuilder extends AssignmentBuilderBase { required super.assignment, required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, required this.convertMethodArgument, required this.source, required this.target, diff --git a/packages/auto_mappr/lib/src/builder/auto_mappr_builder.dart b/packages/auto_mappr/lib/src/builder/auto_mappr_builder.dart index 0074d007..617531e5 100644 --- a/packages/auto_mappr/lib/src/builder/auto_mappr_builder.dart +++ b/packages/auto_mappr/lib/src/builder/auto_mappr_builder.dart @@ -112,7 +112,7 @@ class AutoMapprBuilder { MappingMethodBuilder( config, mapping: mapping, - usedNullableMethodCallback: usedNullableMappingMethod, + onUsedNullableMethodCallback: usedNullableMappingMethod, ).buildMethod(), // Generates nullable mapping method only when nullable method is used. diff --git a/packages/auto_mappr/lib/src/builder/map_bodies/class_body_builder.dart b/packages/auto_mappr/lib/src/builder/map_bodies/class_body_builder.dart index 04871ce7..023d39f9 100644 --- a/packages/auto_mappr/lib/src/builder/map_bodies/class_body_builder.dart +++ b/packages/auto_mappr/lib/src/builder/map_bodies/class_body_builder.dart @@ -15,7 +15,7 @@ class ClassBodyBuilder extends MapBodyBuilderBase { const ClassBodyBuilder({ required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, }); @override @@ -249,7 +249,7 @@ class ClassBodyBuilder extends MapBodyBuilderBase { targetField: targetField, typeConverters: mapping.typeConverters, ), - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ).build(), ); } @@ -299,7 +299,7 @@ class ClassBodyBuilder extends MapBodyBuilderBase { mapperConfig: mapperConfig, mapping: mapping, assignment: assignment, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ).build(), ), { @@ -308,7 +308,7 @@ class ClassBodyBuilder extends MapBodyBuilderBase { mapperConfig: mapperConfig, mapping: mapping, assignment: assignment, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ).build(), }, ); diff --git a/packages/auto_mappr/lib/src/builder/map_bodies/enum_body_builder.dart b/packages/auto_mappr/lib/src/builder/map_bodies/enum_body_builder.dart index 06030ff4..2ecb220c 100644 --- a/packages/auto_mappr/lib/src/builder/map_bodies/enum_body_builder.dart +++ b/packages/auto_mappr/lib/src/builder/map_bodies/enum_body_builder.dart @@ -8,7 +8,7 @@ class EnumBodyBuilder extends MapBodyBuilderBase { const EnumBodyBuilder({ required super.mapperConfig, required super.mapping, - required super.usedNullableMethodCallback, + required super.onUsedNullableMethodCallback, }); @override diff --git a/packages/auto_mappr/lib/src/builder/map_bodies/map_body_builder_base.dart b/packages/auto_mappr/lib/src/builder/map_bodies/map_body_builder_base.dart index 259a0c4a..545dcbb6 100644 --- a/packages/auto_mappr/lib/src/builder/map_bodies/map_body_builder_base.dart +++ b/packages/auto_mappr/lib/src/builder/map_bodies/map_body_builder_base.dart @@ -6,12 +6,13 @@ abstract class MapBodyBuilderBase { final AutoMapprConfig mapperConfig; final TypeMapping mapping; - final void Function(TypeMapping? mapping)? usedNullableMethodCallback; + // ignore: prefer-typedefs-for-callbacks, private API + final void Function(TypeMapping? mapping)? onUsedNullableMethodCallback; const MapBodyBuilderBase({ required this.mapperConfig, required this.mapping, - required this.usedNullableMethodCallback, + required this.onUsedNullableMethodCallback, }); Code build(); diff --git a/packages/auto_mappr/lib/src/builder/map_model_body_method_builder.dart b/packages/auto_mappr/lib/src/builder/map_model_body_method_builder.dart index d842306b..b30ca485 100644 --- a/packages/auto_mappr/lib/src/builder/map_model_body_method_builder.dart +++ b/packages/auto_mappr/lib/src/builder/map_model_body_method_builder.dart @@ -8,12 +8,13 @@ class MapModelBodyMethodBuilder { final AutoMapprConfig mapperConfig; final TypeMapping mapping; final bool nullable; - final void Function(TypeMapping? mapping)? usedNullableMethodCallback; + // ignore: prefer-typedefs-for-callbacks, private API + final void Function(TypeMapping? mapping)? onUsedNullableMethodCallback; const MapModelBodyMethodBuilder({ required this.mapperConfig, required this.mapping, - this.usedNullableMethodCallback, + this.onUsedNullableMethodCallback, this.nullable = false, }); @@ -29,7 +30,7 @@ class MapModelBodyMethodBuilder { final enumMapBodyBuilder = EnumBodyBuilder( mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ); if (enumMapBodyBuilder.canProcess()) { block.statements.add(enumMapBodyBuilder.build()); @@ -40,7 +41,7 @@ class MapModelBodyMethodBuilder { final classMapBodyBuilder = ClassBodyBuilder( mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ); // Return a constructor call diff --git a/packages/auto_mappr/lib/src/builder/methods/mapping_method_builder.dart b/packages/auto_mappr/lib/src/builder/methods/mapping_method_builder.dart index de2cbaff..8f9996a1 100644 --- a/packages/auto_mappr/lib/src/builder/methods/mapping_method_builder.dart +++ b/packages/auto_mappr/lib/src/builder/methods/mapping_method_builder.dart @@ -8,13 +8,14 @@ import 'package:code_builder/code_builder.dart'; class MappingMethodBuilder extends MethodBuilderBase { final TypeMapping mapping; final bool nullable; - final void Function(TypeMapping? mapping)? usedNullableMethodCallback; + // ignore: prefer-typedefs-for-callbacks, private API + final void Function(TypeMapping? mapping)? onUsedNullableMethodCallback; const MappingMethodBuilder( super.config, { required this.mapping, this.nullable = false, - this.usedNullableMethodCallback, + this.onUsedNullableMethodCallback, }); @override @@ -46,7 +47,7 @@ class MappingMethodBuilder extends MethodBuilderBase { return MapModelBodyMethodBuilder( mapping: mapping, mapperConfig: config, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, nullable: nullable, ).build(); } diff --git a/packages/auto_mappr/lib/src/builder/value_assignment_builder.dart b/packages/auto_mappr/lib/src/builder/value_assignment_builder.dart index eb01f4f5..030d7fb4 100644 --- a/packages/auto_mappr/lib/src/builder/value_assignment_builder.dart +++ b/packages/auto_mappr/lib/src/builder/value_assignment_builder.dart @@ -9,13 +9,14 @@ class ValueAssignmentBuilder { final AutoMapprConfig mapperConfig; final TypeMapping mapping; final SourceAssignment assignment; - final void Function(TypeMapping? mapping)? usedNullableMethodCallback; + // ignore: prefer-typedefs-for-callbacks, private API + final void Function(TypeMapping? mapping)? onUsedNullableMethodCallback; const ValueAssignmentBuilder({ required this.mapperConfig, required this.mapping, required this.assignment, - required this.usedNullableMethodCallback, + required this.onUsedNullableMethodCallback, }); Expression build() { @@ -49,7 +50,7 @@ class ValueAssignmentBuilder { assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, source: assignment.sourceType!, target: assignment.targetType, convertMethodArgument: rightSide, @@ -59,28 +60,28 @@ class ValueAssignmentBuilder { assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ), // Map. MapAssignmentBuilder( assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ), // Record. RecordAssignmentBuilder( assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, ), // Nested object. NestedObjectAssignmentBuilder( assignment: assignment, mapperConfig: mapperConfig, mapping: mapping, - usedNullableMethodCallback: usedNullableMethodCallback, + onUsedNullableMethodCallback: onUsedNullableMethodCallback, source: assignment.sourceType!, target: assignment.targetType, convertMethodArgument: rightSide, diff --git a/packages/auto_mappr/lib/src/helpers/run_zoned_auto_mappr.dart b/packages/auto_mappr/lib/src/helpers/run_zoned_auto_mappr.dart index 8d4dfa49..2c62fcc0 100644 --- a/packages/auto_mappr/lib/src/helpers/run_zoned_auto_mappr.dart +++ b/packages/auto_mappr/lib/src/helpers/run_zoned_auto_mappr.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:auto_mappr/src/helpers/emitter_helper.dart'; /// We need to use zones so we can easily have "scoped globals" for EmitterHelper. -// ignore: prefer-static-class, must be top level +// ignore: prefer-static-class, must be top level, prefer-typedefs-for-callbacks, simpler this way R runZonedAutoMappr(R Function() body, {Uri? libraryUri}) { return runZoned( () { diff --git a/packages/auto_mappr/pubspec.yaml b/packages/auto_mappr/pubspec.yaml index b82a51a8..c566f115 100644 --- a/packages/auto_mappr/pubspec.yaml +++ b/packages/auto_mappr/pubspec.yaml @@ -28,6 +28,6 @@ dev_dependencies: build_runner: ^2.0.0 generator_test: ^0.2.0 mocktail: ^1.0.0 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 source_gen_test: ^1.0.4 test: ^1.16.0 diff --git a/packages/auto_mappr/test/builder/convert_method_builder_test.dart b/packages/auto_mappr/test/builder/convert_method_builder_test.dart index 3a8036be..efd568f8 100644 --- a/packages/auto_mappr/test/builder/convert_method_builder_test.dart +++ b/packages/auto_mappr/test/builder/convert_method_builder_test.dart @@ -27,7 +27,7 @@ void main() { expect(result.returns, equals(result.types.elementAtOrNull(1))); expect(result.optionalParameters, isEmpty); expect( - result.requiredParameters, + result.requiredParameters.toList(), equals([ Parameter( (p) => p @@ -55,7 +55,7 @@ void main() { expect(result.returns, equals(result.types.elementAtOrNull(1)?.nullabled())); expect(result.optionalParameters, isEmpty); expect( - result.requiredParameters, + result.requiredParameters.toList(), equals([ Parameter( (p) => p @@ -83,7 +83,7 @@ void main() { expect(result.returns, equals(result.types.elementAtOrNull(1)?.nullabled())); expect(result.optionalParameters.isEmpty, isFalse); expect( - result.requiredParameters, + result.requiredParameters.toList(), equals([ Parameter( (p) => p diff --git a/packages/auto_mappr/test/integration/convert_iterable_test.dart b/packages/auto_mappr/test/integration/convert_iterable_test.dart index 0db60a3c..0b526899 100644 --- a/packages/auto_mappr/test/integration/convert_iterable_test.dart +++ b/packages/auto_mappr/test/integration/convert_iterable_test.dart @@ -229,6 +229,7 @@ void main() { {_getUserDto(1), _getUserDto(2), _getUserDto(3)}, ); + // ignore: avoid-misused-test-matchers, checking list vs set expect(converted, equals({_getUser(1), _getUser(2), _getUser(3)})); }); @@ -237,6 +238,7 @@ void main() { {_getUserDto(1), _getUserDto(2), _getUserDto(3), null}, ); + // ignore: avoid-misused-test-matchers, checking list vs set expect(converted, equals({_getUser(1), _getUser(2), _getUser(3), null})); }); diff --git a/packages/auto_mappr/test/integration/delegates_test.dart b/packages/auto_mappr/test/integration/delegates_test.dart index 93116737..c3f3c5a0 100644 --- a/packages/auto_mappr/test/integration/delegates_test.dart +++ b/packages/auto_mappr/test/integration/delegates_test.dart @@ -473,11 +473,11 @@ void main() { expect( converted, - equals(const [ - fixture_group.Group(1), - fixture_group.Group(2), - fixture_group.Group(3), - ]), + equals({ + const fixture_group.Group(1), + const fixture_group.Group(2), + const fixture_group.Group(3), + }), ); }); @@ -490,7 +490,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5)]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5)}), ); }); @@ -504,11 +504,11 @@ void main() { expect( converted, - equals(const [ - fixture_beta.Beta(6), - fixture_beta.Beta(7), - fixture_beta.Beta(8), - ]), + equals({ + const fixture_beta.Beta(6), + const fixture_beta.Beta(7), + const fixture_beta.Beta(8), + }), ); }); @@ -519,7 +519,7 @@ void main() { }; final converted = mappr.convertSet(dto); - expect(converted, equals(const [fixture_gama.Gama(9), fixture_gama.Gama(10)])); + expect(converted, equals({const fixture_gama.Gama(9), const fixture_gama.Gama(10)})); }); }); @@ -534,11 +534,11 @@ void main() { expect( converted, - equals(const [ - fixture_group.Group(1), - fixture_group.Group(2), - fixture_group.Group(3), - ]), + equals({ + const fixture_group.Group(1), + const fixture_group.Group(2), + const fixture_group.Group(3), + }), ); }); @@ -552,7 +552,7 @@ void main() { expect( converted, - equals(const [fixture_group.Group(1), null, fixture_group.Group(3)]), + equals({const fixture_group.Group(1), null, const fixture_group.Group(3)}), ); }); @@ -565,7 +565,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5)]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5)}), ); }); @@ -579,7 +579,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5), null]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5), null}), ); }); @@ -593,11 +593,11 @@ void main() { expect( converted, - equals(const [ - fixture_beta.Beta(6), - fixture_beta.Beta(7), - fixture_beta.Beta(8), - ]), + equals({ + const fixture_beta.Beta(6), + const fixture_beta.Beta(7), + const fixture_beta.Beta(8), + }), ); }); @@ -611,7 +611,7 @@ void main() { expect( converted, - equals(const [null, fixture_beta.Beta(7), fixture_beta.Beta(8)]), + equals({null, const fixture_beta.Beta(7), const fixture_beta.Beta(8)}), ); }); @@ -622,7 +622,7 @@ void main() { }; final converted = mappr.tryConvertSet(dto); - expect(converted, equals(const [fixture_gama.Gama(9), fixture_gama.Gama(10)])); + expect(converted, equals({const fixture_gama.Gama(9), const fixture_gama.Gama(10)})); }); test('gama w/ null', () { @@ -635,7 +635,7 @@ void main() { expect( converted, - equals(const [null, fixture_gama.Gama(9), fixture_gama.Gama(10)]), + equals({null, const fixture_gama.Gama(9), const fixture_gama.Gama(10)}), ); }); }); diff --git a/packages/auto_mappr/test/integration/fixture/mapping_from_source.dart b/packages/auto_mappr/test/integration/fixture/mapping_from_source.dart index 9c6edfbf..c48d962b 100644 --- a/packages/auto_mappr/test/integration/fixture/mapping_from_source.dart +++ b/packages/auto_mappr/test/integration/fixture/mapping_from_source.dart @@ -38,7 +38,7 @@ class InstanceGetter { String get secondValue => 'test 2'; - set value(int newValue) => _value = newValue; + set value(int value) => _value = value; } class StaticField { @@ -54,5 +54,5 @@ class StaticGetter { static String get secondValue => 'test 4'; - static set value(int newValue) => _value = newValue; + static set value(int value) => _value = value; } diff --git a/packages/auto_mappr/test/integration/fixture/type_converters.dart b/packages/auto_mappr/test/integration/fixture/type_converters.dart index 6b899615..2f034b59 100644 --- a/packages/auto_mappr/test/integration/fixture/type_converters.dart +++ b/packages/auto_mappr/test/integration/fixture/type_converters.dart @@ -37,7 +37,7 @@ class Mappr extends $Mappr { } static Value objectToValueObject(T source) { - return Value(source); + return Value(source); } static Value objectToValueObject2(Object source) { diff --git a/packages/auto_mappr/test/integration/generics_test.dart b/packages/auto_mappr/test/integration/generics_test.dart index 76d7a5c7..089f6f83 100644 --- a/packages/auto_mappr/test/integration/generics_test.dart +++ b/packages/auto_mappr/test/integration/generics_test.dart @@ -31,7 +31,7 @@ void main() { test('With> -> With>', () { const dto = fixture.With>( first: 69, - second: fixture.AlphaDto( + second: fixture.AlphaDto( fixture.With(first: 741, second: 852.666), 123, ), @@ -44,7 +44,7 @@ void main() { equals( const fixture.With>( first: 69, - second: fixture.Alpha( + second: fixture.Alpha( fixture.With(first: 741, second: 852.666), 123, ), @@ -93,22 +93,22 @@ void main() { }); test('AlphaDto -> Alpha', () { - const dto = fixture.AlphaDto(fixture.With(first: 7771, second: 1472), 42); + const dto = fixture.AlphaDto(fixture.With(first: 7771, second: 1472), 42); final converted = mappr.convert, fixture.Alpha>(dto); expect( converted, - equals(const fixture.Alpha(fixture.With(first: 7771, second: 1472), 42)), + equals(const fixture.Alpha(fixture.With(first: 7771, second: 1472), 42)), ); }); test('AlphaDto -> Alpha', () { - const dto = fixture.AlphaDto(fixture.With(first: 'test a', second: 'test b'), 42); + const dto = fixture.AlphaDto(fixture.With(first: 'test a', second: 'test b'), 42); final converted = mappr.convert, fixture.Alpha>(dto); expect( converted, - equals(const fixture.Alpha(fixture.With(first: 'test a', second: 'test b'), 42)), + equals(const fixture.Alpha(fixture.With(first: 'test a', second: 'test b'), 42)), ); }); }); diff --git a/packages/auto_mappr/test/integration/includes_test.dart b/packages/auto_mappr/test/integration/includes_test.dart index c4d563f0..73420bb1 100644 --- a/packages/auto_mappr/test/integration/includes_test.dart +++ b/packages/auto_mappr/test/integration/includes_test.dart @@ -487,11 +487,11 @@ void main() { expect( converted, - equals(const [ - fixture_group.Group(fixture_alpha.Alpha(41), fixture_beta.Beta(42), fixture_gama.Gama(43)), - fixture_group.Group(fixture_alpha.Alpha(44), fixture_beta.Beta(45), fixture_gama.Gama(46)), - fixture_group.Group(fixture_alpha.Alpha(47), fixture_beta.Beta(48), fixture_gama.Gama(49)), - ]), + equals({ + const fixture_group.Group(fixture_alpha.Alpha(41), fixture_beta.Beta(42), fixture_gama.Gama(43)), + const fixture_group.Group(fixture_alpha.Alpha(44), fixture_beta.Beta(45), fixture_gama.Gama(46)), + const fixture_group.Group(fixture_alpha.Alpha(47), fixture_beta.Beta(48), fixture_gama.Gama(49)), + }), ); }); @@ -504,7 +504,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5)]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5)}), ); }); @@ -518,11 +518,11 @@ void main() { expect( converted, - equals(const [ - fixture_beta.Beta(6), - fixture_beta.Beta(7), - fixture_beta.Beta(8), - ]), + equals({ + const fixture_beta.Beta(6), + const fixture_beta.Beta(7), + const fixture_beta.Beta(8), + }), ); }); @@ -533,7 +533,7 @@ void main() { }; final converted = mappr.convertSet(dto); - expect(converted, equals(const [fixture_gama.Gama(9), fixture_gama.Gama(10)])); + expect(converted, equals({const fixture_gama.Gama(9), const fixture_gama.Gama(10)})); }); }); @@ -548,11 +548,11 @@ void main() { expect( converted, - equals(const [ - fixture_group.Group(fixture_alpha.Alpha(51), fixture_beta.Beta(52), fixture_gama.Gama(53)), - fixture_group.Group(fixture_alpha.Alpha(54), fixture_beta.Beta(55), fixture_gama.Gama(56)), - fixture_group.Group(fixture_alpha.Alpha(57), fixture_beta.Beta(58), fixture_gama.Gama(59)), - ]), + equals({ + const fixture_group.Group(fixture_alpha.Alpha(51), fixture_beta.Beta(52), fixture_gama.Gama(53)), + const fixture_group.Group(fixture_alpha.Alpha(54), fixture_beta.Beta(55), fixture_gama.Gama(56)), + const fixture_group.Group(fixture_alpha.Alpha(57), fixture_beta.Beta(58), fixture_gama.Gama(59)), + }), ); }); @@ -566,11 +566,11 @@ void main() { expect( converted, - equals(const [ - fixture_group.Group(fixture_alpha.Alpha(421), fixture_beta.Beta(422), fixture_gama.Gama(423)), + equals({ + const fixture_group.Group(fixture_alpha.Alpha(421), fixture_beta.Beta(422), fixture_gama.Gama(423)), null, - fixture_group.Group(fixture_alpha.Alpha(431), fixture_beta.Beta(432), fixture_gama.Gama(433)), - ]), + const fixture_group.Group(fixture_alpha.Alpha(431), fixture_beta.Beta(432), fixture_gama.Gama(433)), + }), ); }); @@ -583,7 +583,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5)]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5)}), ); }); @@ -597,7 +597,7 @@ void main() { expect( converted, - equals(const [fixture_alpha.Alpha(4), fixture_alpha.Alpha(5), null]), + equals({const fixture_alpha.Alpha(4), const fixture_alpha.Alpha(5), null}), ); }); @@ -611,11 +611,11 @@ void main() { expect( converted, - equals(const [ - fixture_beta.Beta(6), - fixture_beta.Beta(7), - fixture_beta.Beta(8), - ]), + equals({ + const fixture_beta.Beta(6), + const fixture_beta.Beta(7), + const fixture_beta.Beta(8), + }), ); }); @@ -629,7 +629,7 @@ void main() { expect( converted, - equals(const [null, fixture_beta.Beta(7), fixture_beta.Beta(8)]), + equals({null, const fixture_beta.Beta(7), const fixture_beta.Beta(8)}), ); }); @@ -640,7 +640,7 @@ void main() { }; final converted = mappr.tryConvertSet(dto); - expect(converted, equals(const [fixture_gama.Gama(9), fixture_gama.Gama(10)])); + expect(converted, equals({const fixture_gama.Gama(9), const fixture_gama.Gama(10)})); }); test('gama w/ null', () { @@ -653,7 +653,7 @@ void main() { expect( converted, - equals(const [null, fixture_gama.Gama(9), fixture_gama.Gama(10)]), + equals({null, const fixture_gama.Gama(9), const fixture_gama.Gama(10)}), ); }); }); diff --git a/packages/auto_mappr/test/integration/map_test.dart b/packages/auto_mappr/test/integration/map_test.dart index e7311fcf..2caba23d 100644 --- a/packages/auto_mappr/test/integration/map_test.dart +++ b/packages/auto_mappr/test/integration/map_test.dart @@ -233,7 +233,7 @@ void main() { expect(converted, equals(const fixture.NullableMap(data: {'Beta': 222}))); }); - test('non nullable to nullable', () { + test('non nullable to non nullable', () { const dto = fixture.NonNullableMap(data: {'Gama': 333}); final converted = mappr.convert(dto); diff --git a/packages/auto_mappr/test/integration/selecting_constructor_test.dart b/packages/auto_mappr/test/integration/selecting_constructor_test.dart index bba786b0..c8674cb5 100644 --- a/packages/auto_mappr/test/integration/selecting_constructor_test.dart +++ b/packages/auto_mappr/test/integration/selecting_constructor_test.dart @@ -35,8 +35,8 @@ void main() { final converted = mappr.convert(dto); expect(converted.a, equals(1)); - expect(converted.b, equals(null)); - expect(converted.c, equals(null)); + expect(converted.b, isNull); + expect(converted.c, isNull); }); test('with non final target', () { @@ -54,9 +54,9 @@ void main() { const dto = fixture.TestBetaDto(1, 2, 3); final converted = mappr.convert(dto); - expect(converted.a, equals(null)); + expect(converted.a, isNull); expect(converted.b, equals(2)); - expect(converted.c, equals(null)); + expect(converted.c, isNull); }); test('with non final target', () { @@ -74,8 +74,8 @@ void main() { const dto = fixture.TestGamaDto(1, 2, 3); final converted = mappr.convert(dto); - expect(converted.a, equals(null)); - expect(converted.b, equals(null)); + expect(converted.a, isNull); + expect(converted.b, isNull); expect(converted.c, equals(3)); }); diff --git a/packages/auto_mappr_annotation/example/pubspec.yaml b/packages/auto_mappr_annotation/example/pubspec.yaml index d070969d..f07cb2ca 100644 --- a/packages/auto_mappr_annotation/example/pubspec.yaml +++ b/packages/auto_mappr_annotation/example/pubspec.yaml @@ -11,5 +11,5 @@ dependencies: dev_dependencies: build_runner: ^2.0.0 - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 diff --git a/packages/auto_mappr_annotation/lib/src/map_extension.dart b/packages/auto_mappr_annotation/lib/src/map_extension.dart index 3c682923..b8a1ced3 100644 --- a/packages/auto_mappr_annotation/lib/src/map_extension.dart +++ b/packages/auto_mappr_annotation/lib/src/map_extension.dart @@ -1,6 +1,7 @@ /// Map extension that provides additional methods we use in AutoMap. extension MapExtension on Map { /// Immutable where on maps. + // ignore: prefer-typedefs-for-callbacks, it's ok Map where(bool Function(KEY key, VALUE value) test) { final result = {}; diff --git a/packages/auto_mappr_annotation/lib/src/type_converter.dart b/packages/auto_mappr_annotation/lib/src/type_converter.dart index caca4217..8c173111 100644 --- a/packages/auto_mappr_annotation/lib/src/type_converter.dart +++ b/packages/auto_mappr_annotation/lib/src/type_converter.dart @@ -1,6 +1,7 @@ /// Configured type converter from [SOURCE] to [TARGET]. final class TypeConverter { /// A function that does type converter. + // ignore: prefer-typedefs-for-callbacks, prefer-correct-callback-field-name, it's simpler this way final TARGET Function(SOURCE source) converter; /// Constructs type converter between [SOURCE] and [TARGET]. diff --git a/packages/auto_mappr_annotation/pubspec.yaml b/packages/auto_mappr_annotation/pubspec.yaml index 13ff8568..74c5b48e 100644 --- a/packages/auto_mappr_annotation/pubspec.yaml +++ b/packages/auto_mappr_annotation/pubspec.yaml @@ -8,5 +8,5 @@ environment: sdk: ^3.0.0 dev_dependencies: - netglade_analysis: ^5.0.0 + netglade_analysis: ^6.0.0 test: ^1.16.0 From d76d7b7eeb750c5878618797994808283f917f1a Mon Sep 17 00:00:00 2001 From: Honza Bittner Date: Tue, 12 Dec 2023 09:22:09 +0100 Subject: [PATCH 2/2] Bump melos-action --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6351aa8a..11d9977f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 - - uses: bluefireteam/melos-action@v2 + - uses: bluefireteam/melos-action@v3 - name: Generate AutoMappr files run: melos run gen:build-all