Skip to content

Commit

Permalink
Merge pull request #18 from netglade/dependabot/pub/packages/auto_map…
Browse files Browse the repository at this point in the history
…pr/netglade_analysis-1.2.0

Bump netglade_analysis from 1.1.2 to 1.2.0 in /packages/auto_mappr
  • Loading branch information
tenhobi authored Apr 6, 2023
2 parents 71a5e10 + 7a42934 commit 389e69b
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 147 deletions.
6 changes: 6 additions & 0 deletions packages/auto_mappr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased
- Adhere lints to `netglade_analysis` 1.2.0.
- Use tear-offs when possible.
- Omit map when possible.
- Omit null check of non-nullable when possible.

## 1.1.2
- Update exception messages to include suggestions for troubleshooting.
- Add a Discord link to README.
Expand Down
8 changes: 6 additions & 2 deletions packages/auto_mappr/example/lib/equatable.g.dart

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

30 changes: 15 additions & 15 deletions packages/auto_mappr/example/lib/nested.g.dart

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

14 changes: 8 additions & 6 deletions packages/auto_mappr/example/lib/nullable.g.dart

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

8 changes: 6 additions & 2 deletions packages/auto_mappr/example/lib/rename.g.dart

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

2 changes: 1 addition & 1 deletion packages/auto_mappr/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ dev_dependencies:
path: ../
build_runner: ^2.0.0
lints: ^2.0.0
netglade_analysis: 1.1.2
netglade_analysis: 1.2.0
test: ^1.16.0
32 changes: 23 additions & 9 deletions packages/auto_mappr/lib/src/builder/auto_mappr_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,42 @@ import 'package:analyzer/dart/element/element.dart';
import 'package:auto_mappr/src/builder/convert_method_builder.dart';
import 'package:auto_mappr/src/builder/map_model_body_method_builder.dart';
import 'package:auto_mappr/src/models/auto_mappr_config.dart';
import 'package:built_collection/built_collection.dart';
import 'package:code_builder/code_builder.dart';

class AutoMapprBuilder {
final AutoMapprConfig config;
final ClassElement mapperClassElement;

static const List<String> fileIgnores = [
'unnecessary_parenthesis',
'non_constant_identifier_names',
'require_trailing_commas',
'unnecessary_raw_strings',

// Can we fix this somehow? (const defaults, const customs)
'prefer_const_constructors',
'prefer_const_literals_to_create_immutables'
];

AutoMapprBuilder({
required this.config,
required this.mapperClassElement,
});

Library build() {
return Library(
(b) => b.body.addAll(
[
Class(
(b) => b
..name = '\$${mapperClassElement.displayName}'
..methods.addAll(_buildMethods()),
),
],
),
(b) => b
..ignoreForFile = ListBuilder(fileIgnores)
..body.addAll(
[
Class(
(b) => b
..name = '\$${mapperClassElement.displayName}'
..methods.addAll(_buildMethods()),
),
],
),
);
}

Expand Down
Loading

0 comments on commit 389e69b

Please sign in to comment.