Skip to content

Commit

Permalink
Generate only a single lint ignore line
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Nov 30, 2023
1 parent 2355f74 commit 39b6685
Show file tree
Hide file tree
Showing 19 changed files with 5 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

### Fixed
* 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))
* 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))

### Compatibility
* Realm Studio: 13.0.0 or later.
Expand Down
1 change: 0 additions & 1 deletion example/bin/myapp.g.dart

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

1 change: 0 additions & 1 deletion flutter/realm_flutter/example/lib/main.g.dart

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

1 change: 0 additions & 1 deletion generator/lib/src/realm_model_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class RealmModelInfo {
const RealmModelInfo(this.name, this.modelName, this.realmName, this.fields, this.baseType);

Iterable<String> toCode() sync* {
yield '// ignore_for_file: type=lint';
yield 'class $name extends $modelName with RealmEntity, RealmObjectBase, ${baseType.className} {';
{
final allSettable = fields.where((f) => !f.type.isRealmCollection && !f.isRealmBacklink).toList();
Expand Down
4 changes: 3 additions & 1 deletion generator/lib/src/realm_object_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class RealmObjectGenerator extends Generator {
final result = await _getResolvedLibrary(library.element, buildStep.resolver);
return scopeSession(
result,
() => library.classes.realmInfo.expand((m) => m.toCode()).join('\n'),
() {
return ['// ignore_for_file: type=lint', ...library.classes.realmInfo.expand((m) => m.toCode())].join('\n');
},
color: stdout.supportsAnsiEscapes,
);
},
Expand Down
2 changes: 0 additions & 2 deletions generator/test/good_test_data/all_types.expected
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Foo extends _Foo with RealmEntity, RealmObjectBase, RealmObject {
}
}

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

Expand Down Expand Up @@ -227,7 +226,6 @@ class Bar extends _Bar with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class PrimitiveTypes extends _PrimitiveTypes
with RealmEntity, RealmObjectBase, RealmObject {
PrimitiveTypes(
Expand Down
1 change: 0 additions & 1 deletion generator/test/good_test_data/asymmetric_object.expected
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class Asymmetric extends _Asymmetric
}
}

// ignore_for_file: type=lint
class Embedded extends _Embedded
with RealmEntity, RealmObjectBase, EmbeddedObject {
Embedded(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class Parent extends _Parent with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
Child1(
String value,
Expand Down
2 changes: 0 additions & 2 deletions generator/test/good_test_data/embedded_objects.expected
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class Parent extends _Parent with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
Child1(
String value, {
Expand Down Expand Up @@ -113,7 +112,6 @@ class Child1 extends _Child1 with RealmEntity, RealmObjectBase, EmbeddedObject {
}
}

// ignore_for_file: type=lint
class Child2 extends _Child2 with RealmEntity, RealmObjectBase, EmbeddedObject {
Child2(
bool boolProp,
Expand Down
8 changes: 1 addition & 7 deletions generator/test/good_test_data/primary_key.expected
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class IntPK extends _IntPK with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class NullableIntPK extends _NullableIntPK
with RealmEntity, RealmObjectBase, RealmObject {
NullableIntPK(
Expand Down Expand Up @@ -69,7 +68,7 @@ class NullableIntPK extends _NullableIntPK
}
}

// ignore_for_file: type=lint

class StringPK extends _StringPK
with RealmEntity, RealmObjectBase, RealmObject {
StringPK(
Expand Down Expand Up @@ -102,7 +101,6 @@ class StringPK extends _StringPK
}
}

// ignore_for_file: type=lint
class NullableStringPK extends _NullableStringPK
with RealmEntity, RealmObjectBase, RealmObject {
NullableStringPK(
Expand Down Expand Up @@ -138,7 +136,6 @@ class NullableStringPK extends _NullableStringPK
}
}

// ignore_for_file: type=lint
class ObjectIdPK extends _ObjectIdPK
with RealmEntity, RealmObjectBase, RealmObject {
ObjectIdPK(
Expand Down Expand Up @@ -171,7 +168,6 @@ class ObjectIdPK extends _ObjectIdPK
}
}

// ignore_for_file: type=lint
class NullableObjectIdPK extends _NullableObjectIdPK
with RealmEntity, RealmObjectBase, RealmObject {
NullableObjectIdPK(
Expand Down Expand Up @@ -207,7 +203,6 @@ class NullableObjectIdPK extends _NullableObjectIdPK
}
}

// ignore_for_file: type=lint
class UuidPK extends _UuidPK with RealmEntity, RealmObjectBase, RealmObject {
UuidPK(
Uuid id,
Expand Down Expand Up @@ -239,7 +234,6 @@ class UuidPK extends _UuidPK with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class NullableUuidPK extends _NullableUuidPK
with RealmEntity, RealmObjectBase, RealmObject {
NullableUuidPK(
Expand Down
1 change: 0 additions & 1 deletion generator/test/good_test_data/realm_set.expected
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Car extends _Car with RealmEntity, RealmObjectBase, RealmObject {
}
}

// ignore_for_file: type=lint
class RealmSets extends _RealmSets
with RealmEntity, RealmObjectBase, RealmObject {
RealmSets(
Expand Down
1 change: 0 additions & 1 deletion test/backlinks_test.g.dart

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

2 changes: 0 additions & 2 deletions test/geospatial_test.g.dart

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

2 changes: 0 additions & 2 deletions test/indexed_test.g.dart

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

4 changes: 0 additions & 4 deletions test/migration_test.g.dart

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

9 changes: 0 additions & 9 deletions test/realm_object_test.g.dart

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

1 change: 0 additions & 1 deletion test/realm_set_test.g.dart

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

2 changes: 0 additions & 2 deletions test/realm_value_test.g.dart

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

Loading

0 comments on commit 39b6685

Please sign in to comment.