avoid-empty-test-groups
- Group
- Correctness
- Path
lint/correctness/avoid-empty-test-groups- Default
- Off, opt in
- Origin
- Falcon
- Domain
- test
- Rule
- 61 of 512
Reports inline framework groups without any test registrations.
include-methods (array of strings, default: []) adds custom test registration helpers.
Invalid
import 'package:test/test.dart';
void main() {
group('empty', () {});
group('setup only', () { setUp(() {}); });
group('nested empty', () {
group('also empty', () {});
});
group('statements', () { final value = 1; final other = value + 1; });
group('lifecycle callback calls do not register tests', () { setUp(() { print('setup'); }); });
}void main() { group('empty', () {}); group('empty', () {}); group('setup only', () { setUp(() {}); }); group('nested empty', () { group('also empty', () {}); }); group('statements', () { final value = 1; final other = value + 1; }); group('statements', () { final value = 1; final other = value + 1; }); group('lifecycle callback calls do not register tests', () { setUp(() { print('setup'); }); });Valid
import 'package:flutter_test/flutter_test.dart' as t;
void callback() {}
void main() {
t.group('one', () { t.test('works', () {}); });
t.group('nested', () { t.group('inner', () { t.test('works', () {}); }); });
t.group('widget', () { t.testWidgets('works', (tester) {}); });
t.group('external callback', callback);
t.group('skipped tests still registered', () { t.test('skipped', () {}, skip: true); });
void group(String description, dynamic body) {}
group('local function', () {});
}Configure avoid-empty-test-groups
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"correctness": {
"avoid-empty-test-groups": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/correctness/avoid-empty-test-groups: <reason>More correctness rules
- avoid-global-state
avoid-global-stateDisallow mutable global and static state.
- avoid-hooks-outside-buildrecommendedflutter_hooks
Flags confirmed Flutter hooks outside hook builds, custom hooks, and HookBuilder/HookConsumer builders.
- avoid-incorrect-image-opacityflutter
Flags Opacity directly wrapping a Flutter Image, including named constructors.
- avoid-inherited-widget-in-initstaterecommendedflutter
Avoid inherited-widget subscriptions during initState.
- avoid-instantiating-in-value-providerprovider
Value providers borrow existing instances; newly constructed values need create.
- avoid-late-contextrecommendedflutter
Avoid storing
BuildContextin late fields or reading it in late initializers. - avoid-missing-completer-stack-trace
Preserve error origins when calling SDK
Completer.completeError. - avoid-missing-controllerflutter
Require Flutter text fields to expose their updated value.