Skip to content

Commit

Permalink
chore: coverage:ignore-file (#62)
Browse files Browse the repository at this point in the history
* chore: coverage:ignore-file
* chore: ignore_for_file: type=lint

---------

Co-authored-by: Angga Arya Saputra <36914072+anggaaryas@users.noreply.github.com>
Co-authored-by: Angga Saputra v2 <angga.saputra@coinbit.id>
  • Loading branch information
3 people authored Nov 5, 2023
1 parent 561dec6 commit 62fa2e9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/envied_example/lib/debug_env.g.dart

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

2 changes: 2 additions & 0 deletions examples/envied_example/lib/env.g.dart

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

2 changes: 2 additions & 0 deletions examples/envied_example/lib/nullable_env.g.dart

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

2 changes: 2 additions & 0 deletions examples/envied_example/lib/release_env.g.dart

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

5 changes: 4 additions & 1 deletion packages/envied_generator/lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ final class EnviedGenerator extends GeneratorForAnnotation<Envied> {
]),
);

return DartFormatter().format(cls.accept(emitter).toString());
const String ignore = '// coverage:ignore-file\n'
'// ignore_for_file: type=lint';

return DartFormatter().format('$ignore\n${cls.accept(emitter)}');
}

static TypeChecker _typeChecker(Type type) => TypeChecker.fromRuntime(type);
Expand Down
40 changes: 36 additions & 4 deletions packages/envied_generator/test/src/generator_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import 'package:source_gen_test/annotations.dart';
const foo = 'bar';

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env0 {}
''')
@Envied()
Expand Down Expand Up @@ -62,6 +64,8 @@ abstract class Env7 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env8 {
static const String testString = 'testString';
Expand Down Expand Up @@ -89,6 +93,8 @@ abstract class Env8 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env8b {
static const String? testString = 'testString';
Expand Down Expand Up @@ -116,6 +122,8 @@ abstract class Env8b {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env9 {
static const String testString = 'test_string';
}
Expand All @@ -127,6 +135,8 @@ abstract class Env9 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env9b {
static const String? testString = 'test_string';
}
Expand All @@ -138,6 +148,8 @@ abstract class Env9b {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env10 {
static const String systemVar = 'system_var';
}
Expand All @@ -149,6 +161,8 @@ abstract class Env10 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env10b {
static const String? systemVar = 'system_var';
}
Expand All @@ -160,6 +174,8 @@ abstract class Env10b {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Foo {
static const String testString = 'test_string';
}
Expand All @@ -171,6 +187,8 @@ abstract class Env11 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Foo {
static const String? testString = 'test_string';
}
Expand Down Expand Up @@ -248,20 +266,22 @@ abstract class Env14 {
static const String? testDefaultParam = null;
}

@ShouldGenerate(
'''
@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env14b {
static const String? testDefaultParam = null;
}
''',
)
''')
@Envied(path: 'test/.env.example', allowOptionalFields: true)
abstract class Env14b {
@EnviedField(defaultValue: null)
static const String? testDefaultParam = null;
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env15 {
static const String testDefaultParam = 'test_';
Expand Down Expand Up @@ -293,6 +313,8 @@ abstract class Env15 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env15b {
static const String? testDefaultParam = 'test_';
Expand Down Expand Up @@ -320,6 +342,8 @@ abstract class Env15b {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env16 {
static const String testDefaultParam = 'test_';
}
Expand All @@ -331,6 +355,8 @@ abstract class Env16 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env16b {
static const String? testDefaultParam = 'test_';
}
Expand Down Expand Up @@ -515,6 +541,8 @@ abstract class Env25b {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env26 {
static final String? foo = null;
}
Expand All @@ -526,6 +554,8 @@ abstract class Env26 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env27 {
static final int? foo = null;
}
Expand All @@ -537,6 +567,8 @@ abstract class Env27 {
}

@ShouldGenerate('''
// coverage:ignore-file
// ignore_for_file: type=lint
final class _Env28 {
static final bool? foo = null;
}
Expand Down

0 comments on commit 62fa2e9

Please sign in to comment.