Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: coverage:ignore-file #62

Merged
merged 6 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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