Skip to content

Commit ebf4140

Browse files
authored
Generate only a single lint ignore line (#1438)
1 parent 410e8c7 commit ebf4140

19 files changed

+5
-68
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
### Fixed
77
* Fixed an issue where connections to Atlas App Services would fail on Android with a certificate expiration error. (Issue [#1430](https://github.com/realm/realm-dart/issues/1430))
8+
* Fixed an issue with the generator where having multiple generated classes in the same file would result in multiple `// ignore_for_file: type=lint` lines being added, which itself was generating a lint warning. (Issue [#1412](https://github.com/realm/realm-dart/issues/1412))
89
* Errors encountered while reapplying local changes for client reset recovery on partition-based sync Realms would result in the client reset attempt not being recorded, possibly resulting in an endless loop of attempting and failing to automatically recover the client reset. Flexible sync and errors from the server after completing the local recovery were handled correctly. (Core 13.24.0)
910
* During a client reset with recovery when recovering a move or set operation on a `List` that operated on indices that were not also added in the recovery, links to an object which had been deleted by another client while offline would be recreated by the recovering client. But the objects of these links would only have the primary key populated and all other fields would be default values. Now, instead of creating these zombie objects, the lists being recovered skip such deleted links. (Core 13.24.0)
1011
* During a client reset recovery a Set of objects could be missing items, or an exception could be thrown that prevents recovery ex: "Requested index 1 calling get() on set 'source.collection' when max is 0". (Core 13.24.0)

example/bin/myapp.g.dart

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flutter/realm_flutter/example/lib/main.g.dart

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generator/lib/src/realm_model_info.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class RealmModelInfo {
3232
const RealmModelInfo(this.name, this.modelName, this.realmName, this.fields, this.baseType);
3333

3434
Iterable<String> toCode() sync* {
35-
yield '// ignore_for_file: type=lint';
3635
yield 'class $name extends $modelName with RealmEntity, RealmObjectBase, ${baseType.className} {';
3736
{
3837
final allSettable = fields.where((f) => !f.type.isRealmCollection && !f.isRealmBacklink).toList();

generator/lib/src/realm_object_generator.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ class RealmObjectGenerator extends Generator {
5858
final result = await _getResolvedLibrary(library.element, buildStep.resolver);
5959
return scopeSession(
6060
result,
61-
() => library.classes.realmInfo.expand((m) => m.toCode()).join('\n'),
61+
() {
62+
return ['// ignore_for_file: type=lint', ...library.classes.realmInfo.expand((m) => m.toCode())].join('\n');
63+
},
6264
color: stdout.supportsAnsiEscapes,
6365
);
6466
},

generator/test/good_test_data/all_types.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class Foo extends _Foo with RealmEntity, RealmObjectBase, RealmObject {
5050
}
5151
}
5252

53-
// ignore_for_file: type=lint
5453
class Bar extends _Bar with RealmEntity, RealmObjectBase, RealmObject {
5554
static var _defaultsSet = false;
5655

@@ -227,7 +226,6 @@ class Bar extends _Bar with RealmEntity, RealmObjectBase, RealmObject {
227226
}
228227
}
229228

230-
// ignore_for_file: type=lint
231229
class PrimitiveTypes extends _PrimitiveTypes
232230
with RealmEntity, RealmObjectBase, RealmObject {
233231
PrimitiveTypes(

generator/test/good_test_data/asymmetric_object.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class Asymmetric extends _Asymmetric
7171
}
7272
}
7373

74-
// ignore_for_file: type=lint
7574
class Embedded extends _Embedded
7675
with RealmEntity, RealmObjectBase, EmbeddedObject {
7776
Embedded(

generator/test/good_test_data/embedded_annotations.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class Parent extends _Parent with RealmEntity, RealmObjectBase, RealmObject {
5151
}
5252
}
5353

54-
// ignore_for_file: type=lint
5554
class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
5655
Child1(
5756
String value,

generator/test/good_test_data/embedded_objects.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class Parent extends _Parent with RealmEntity, RealmObjectBase, RealmObject {
4848
}
4949
}
5050

51-
// ignore_for_file: type=lint
5251
class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
5352
Child1(
5453
String value, {
@@ -113,7 +112,6 @@ class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
113112
}
114113
}
115114

116-
// ignore_for_file: type=lint
117115
class Child2 extends _Child2 with RealmEntity, RealmObjectBase, EmbeddedObject {
118116
Child2(
119117
bool boolProp,

generator/test/good_test_data/primary_key.expected

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class IntPK extends _IntPK with RealmEntity, RealmObjectBase, RealmObject {
3434
}
3535
}
3636

37-
// ignore_for_file: type=lint
3837
class NullableIntPK extends _NullableIntPK
3938
with RealmEntity, RealmObjectBase, RealmObject {
4039
NullableIntPK(
@@ -69,7 +68,7 @@ class NullableIntPK extends _NullableIntPK
6968
}
7069
}
7170

72-
// ignore_for_file: type=lint
71+
7372
class StringPK extends _StringPK
7473
with RealmEntity, RealmObjectBase, RealmObject {
7574
StringPK(
@@ -102,7 +101,6 @@ class StringPK extends _StringPK
102101
}
103102
}
104103

105-
// ignore_for_file: type=lint
106104
class NullableStringPK extends _NullableStringPK
107105
with RealmEntity, RealmObjectBase, RealmObject {
108106
NullableStringPK(
@@ -138,7 +136,6 @@ class NullableStringPK extends _NullableStringPK
138136
}
139137
}
140138

141-
// ignore_for_file: type=lint
142139
class ObjectIdPK extends _ObjectIdPK
143140
with RealmEntity, RealmObjectBase, RealmObject {
144141
ObjectIdPK(
@@ -171,7 +168,6 @@ class ObjectIdPK extends _ObjectIdPK
171168
}
172169
}
173170

174-
// ignore_for_file: type=lint
175171
class NullableObjectIdPK extends _NullableObjectIdPK
176172
with RealmEntity, RealmObjectBase, RealmObject {
177173
NullableObjectIdPK(
@@ -207,7 +203,6 @@ class NullableObjectIdPK extends _NullableObjectIdPK
207203
}
208204
}
209205

210-
// ignore_for_file: type=lint
211206
class UuidPK extends _UuidPK with RealmEntity, RealmObjectBase, RealmObject {
212207
UuidPK(
213208
Uuid id,
@@ -239,7 +234,6 @@ class UuidPK extends _UuidPK with RealmEntity, RealmObjectBase, RealmObject {
239234
}
240235
}
241236

242-
// ignore_for_file: type=lint
243237
class NullableUuidPK extends _NullableUuidPK
244238
with RealmEntity, RealmObjectBase, RealmObject {
245239
NullableUuidPK(

0 commit comments

Comments
 (0)