Skip to content

Commit

Permalink
format improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tshedor committed May 6, 2024
1 parent de8c83e commit fe37a62
Show file tree
Hide file tree
Showing 41 changed files with 82 additions and 80 deletions.
2 changes: 1 addition & 1 deletion packages/brick_build/lib/src/builders/adapter_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ class AdapterBuilder<_ClassAnnotation> extends BaseBuilder<_ClassAnnotation> {

@override
Map<String, List<String>> get buildExtensions => {
'.dart': [outputExtension]
'.dart': [outputExtension],
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ class AggregateBuilder implements Builder {

@override
final buildExtensions = const {
r'$lib$': [outputFileName]
r'$lib$': [outputFileName],
};
}
2 changes: 1 addition & 1 deletion packages/brick_build/lib/src/builders/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class BaseBuilder<_ClassAnnotation> implements Builder {

@override
Map<String, List<String>> get buildExtensions => {
'$aggregateExtension.dart': ['${BaseBuilder.aggregateExtension}$outputExtension']
'$aggregateExtension.dart': ['${BaseBuilder.aggregateExtension}$outputExtension'],
};

/// The cached file this will produce
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_build/lib/src/utils/string_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _EscapedDartString {
'\f': r'\f', // 0C - form feed
'\r': r'\r', // 0D - carriage return
'\x7F': r'\x7F', // delete
r'\': r'\\' // backslash
r'\': r'\\', // backslash
};

static final _escapeMapRegexp = _escapeMap.keys.map(_getHexLiteral).join();
Expand Down
2 changes: 1 addition & 1 deletion packages/brick_core/test/query/where_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void main() {
'value': 1,
}
],
'required': false
'required': false,
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/brick_graphql/lib/src/graphql_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ class GraphqlProvider extends Provider<GraphqlModel> {
resp.data?.values.first!,
provider: this,
repository: repository,
) as TModel
) as TModel,
];
}

return [
await adapter.fromGraphql(resp.data!, provider: this, repository: repository) as TModel
await adapter.fromGraphql(resp.data!, provider: this, repository: repository) as TModel,
];
}
return <TModel>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Future<Map<String, dynamic>> _$DemoModelToGraphql(
'complex_field_name': instance.complexFieldName,
'last_name': instance.lastName,
'full_name': instance.name,
'simple_bool': instance.simpleBool == null ? null : (instance.simpleBool! ? 1 : 0)
'simple_bool': instance.simpleBool == null ? null : (instance.simpleBool! ? 1 : 0),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DemoModelAssocWithSubfieldsAdapter extends GraphqlAdapter<DemoModelAssoc>
iterable: false,
subfields: {
'first': {'subfield1': {}},
'last': {}
'last': {},
},
type: String,
),
Expand Down
6 changes: 3 additions & 3 deletions packages/brick_graphql/test/graphql_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void main() {
group('#get', () {
test('array', () async {
final provider = generateProvider([
{'full_name': 'Thomas'}
{'full_name': 'Thomas'},
]);

final m = await provider.get<DemoModel>();
Expand All @@ -73,7 +73,7 @@ void main() {

test('#subscribe', () async {
final payload = [
{'full_name': 'Guy'}
{'full_name': 'Guy'},
];
final provider = generateProvider(payload);

Expand All @@ -92,7 +92,7 @@ void main() {
final resp = await provider.upsert<DemoModel>(instance);

expect(resp?.data, {
'upsertPerson': [payload]
'upsertPerson': [payload],
});
expect(resp?.errors, isNull);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/brick_graphql/test/graphql_request_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void main() {
modelDictionary: provider.modelDictionary,
query: Query(
providerArgs: {
'context': {'SampleContextEntry': SampleContextEntry('myValue')}
'context': {'SampleContextEntry': SampleContextEntry('myValue')},
},
),
).request;
Expand Down Expand Up @@ -114,7 +114,7 @@ void main() {
variables: {'myVar': 1234},
);
expect(request.requestVariables, {
'vars': {'myVar': 1234}
'vars': {'myVar': 1234},
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GraphqlDeserialize extends GraphqlSerdesGenerator

return [
if (config?.queryOperationTransformerName != null)
'@override\nfinal queryOperationTransformer = ${config!.queryOperationTransformerName};'
'@override\nfinal queryOperationTransformer = ${config!.queryOperationTransformerName};',
];
}

Expand Down
5 changes: 3 additions & 2 deletions packages/brick_graphql_generators/lib/src/graphql_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ class GraphqlAnnotationFinder extends AnnotationFinder<Graphql> {
if (unconvertedMap == null) return {};
return {
for (final entry in unconvertedMap.entries)
entry.key!.toStringValue()!:
entry.value?.toStringValue() == null ? _convertMapToMap(entry.value!.toMapValue()!) : {}
entry.key!.toStringValue()!: entry.value?.toStringValue() == null
? _convertMapToMap(entry.value!.toMapValue()!)
: {},
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ToFromJson {
'subfield1': {},
'subfield2': {
'nestedSubfield': {},
}
},
},
)
final ToFromJsonAssoc assoc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DemoModelMigration extends Migration {
foreignKeyColumn: 'f_Mounty_brick_id',
onDeleteCascade: true,
),
InsertColumn('name', Column.varchar, onTable: 'Horse')
InsertColumn('name', Column.varchar, onTable: 'Horse'),
],
down: const <MigrationCommand>[],
);
Expand Down Expand Up @@ -95,14 +95,14 @@ class TestRepository extends OfflineFirstWithTestRepository {
final Map<Type, TestAdapter<TestModel>> testMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final testModelDictionary = TestModelDictionary(testMappings);

/// Sqlite mappings should only be used when initializing a [SqliteProvider]
final Map<Type, SqliteAdapter<SqliteModel>> sqliteMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final sqliteModelDictionary = SqliteModelDictionary(sqliteMappings);
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Future<Map<String, dynamic>> _$HorseToTest(
instance.mounties
.map((s) => MountyAdapter().toTest(s, provider: provider, repository: repository))
.toList(),
)
),
};
}

Expand Down Expand Up @@ -88,7 +88,7 @@ class HorseAdapter extends OfflineFirstWithTestAdapter<Horse> {
columnName: 'mounties',
iterable: true,
type: Mounty,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Horse instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MountyAdapter extends OfflineFirstWithTestAdapter<Mounty> {
columnName: 'name',
iterable: false,
type: String,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Mounty instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestProvider extends Provider<TestModel> {
methodsCalled.add('get');
final adapter = modelDictionary.adapterFor[T]!;
final data = [
{'name': 'SqliteName'}
{'name': 'SqliteName'},
];
final results = data
.map((e) => adapter.fromTest(e, provider: this, repository: repository))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const List<MigrationCommand> _migration1up = [
InsertTable('Serdes'),
InsertTable('WithSerdes'),
InsertColumn('name', Column.varchar, onTable: 'Serdes'),
InsertColumn('serdes_member', Column.varchar, onTable: 'WithSerdes')
InsertColumn('serdes_member', Column.varchar, onTable: 'WithSerdes'),
];
const List<MigrationCommand> _migration1down = [
DropTable('Serdes'),
DropTable('WithSerdes'),
DropColumn('name', onTable: 'Serdes'),
DropColumn('serdes_member', onTable: 'WithSerdes')
DropColumn('serdes_member', onTable: 'WithSerdes'),
];

@Migratable(version: '1', up: _migration1up, down: _migration1down)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class OfflineFirstWithGraphqlRepository
upsert: upsert,
),
...?query.providerArgs['context'] as Map<String, ContextEntry>?,
}
},
},
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';

import 'package:gql_exec/gql_exec.dart';
import 'package:gql_link/gql_link.dart';
import 'package:mockito/mockito.dart';
Expand All @@ -15,7 +16,7 @@ Link stubGraphqlLink(

if (wrapInTopLevelKeyAndArray) {
response = {
'result': [response]
'result': [response],
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
const response = Response(
data: <String, dynamic>{'firstName': 'Thomas'},
response: {
'body': <String, dynamic>{'firstName': 'Thomas'}
'body': <String, dynamic>{'firstName': 'Thomas'},
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DemoModelMigration extends Migration {
foreignKeyColumn: 'f_Mounty_brick_id',
onDeleteCascade: true,
),
InsertColumn('name', Column.varchar, onTable: 'Horse')
InsertColumn('name', Column.varchar, onTable: 'Horse'),
],
down: const <MigrationCommand>[],
);
Expand Down Expand Up @@ -84,14 +84,14 @@ class TestRepository extends OfflineFirstWithGraphqlRepository {
final Map<Type, GraphqlAdapter<GraphqlModel>> graphqlMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final graphqlModelDictionary = GraphqlModelDictionary(graphqlMappings);

/// Sqlite mappings should only be used when initializing a [SqliteProvider]
final Map<Type, SqliteAdapter<SqliteModel>> sqliteMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final sqliteModelDictionary = SqliteModelDictionary(sqliteMappings);
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Future<Map<String, dynamic>> _$HorseToGraphql(
instance.mounties
.map((s) => MountyAdapter().toGraphql(s, provider: provider, repository: repository))
.toList(),
)
),
};
}

Expand Down Expand Up @@ -139,7 +139,7 @@ class HorseAdapter extends OfflineFirstWithGraphqlAdapter<Horse> {
documentNodeName: 'mounties',
iterable: true,
type: Mounty,
)
),
};

@override
Expand All @@ -161,7 +161,7 @@ class HorseAdapter extends OfflineFirstWithGraphqlAdapter<Horse> {
columnName: 'mounties',
iterable: true,
type: Mounty,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Horse instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MountyAdapter extends OfflineFirstWithGraphqlAdapter<Mounty> {
columnName: 'name',
iterable: false,
type: String,
)
),
};

@override
Expand All @@ -109,7 +109,7 @@ class MountyAdapter extends OfflineFirstWithGraphqlAdapter<Mounty> {
documentNodeName: 'name',
iterable: false,
type: String,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Mounty instance, DatabaseExecutor executor) async =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ abstract class OfflineFirstWithRestRepository
// This header is removed by the [RestOfflineQueueClient]
if (headerValue != null) RestOfflineQueueClient.policyHeader: headerValue,
...?query.providerArgs['headers'] as Map<String, String>?,
}
},
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RestRequestSqliteCache extends RequestSqliteCache<http.Request> {
String attemptLogMessage(Map<String, dynamic> responseFromSqlite) {
final attemptMessage = [
responseFromSqlite[HTTP_JOBS_REQUEST_METHOD_COLUMN],
responseFromSqlite[HTTP_JOBS_URL_COLUMN]
responseFromSqlite[HTTP_JOBS_URL_COLUMN],
].join(' ');

return 'in $attemptMessage : $responseFromSqlite';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DemoModelMigration extends Migration {
foreignKeyColumn: 'f_Mounty_brick_id',
onDeleteCascade: true,
),
InsertColumn('name', Column.varchar, onTable: 'Horse')
InsertColumn('name', Column.varchar, onTable: 'Horse'),
],
down: const <MigrationCommand>[],
);
Expand Down Expand Up @@ -91,14 +91,14 @@ class TestRepository extends OfflineFirstWithRestRepository {
final Map<Type, RestAdapter<RestModel>> restMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final restModelDictionary = RestModelDictionary(restMappings);

/// Sqlite mappings should only be used when initializing a [SqliteProvider]
final Map<Type, SqliteAdapter<SqliteModel>> sqliteMappings = {
Horse: HorseAdapter(),
MemoryDemoModel: MountyAdapter(),
Mounty: MountyAdapter()
Mounty: MountyAdapter(),
};
final sqliteModelDictionary = SqliteModelDictionary(sqliteMappings);
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Future<Map<String, dynamic>> _$HorseToRest(
instance.mounties
.map((s) => MountyAdapter().toRest(s, provider: provider, repository: repository))
.toList(),
)
),
};
}

Expand Down Expand Up @@ -88,7 +88,7 @@ class HorseAdapter extends OfflineFirstWithRestAdapter<Horse> {
columnName: 'mounties',
iterable: true,
type: Mounty,
)
),
};
@override
Future<int?> primaryKeyByUniqueColumns(Horse instance, DatabaseExecutor executor) async =>
Expand Down
Loading

0 comments on commit fe37a62

Please sign in to comment.