feat: linting + format automation + IMAP integration tests against Stalwart

- Add `format` task (fvm dart format .) and pre-commit dart-format hook
- Fix pre-commit task-check hook to use nix develop --command task
- Add CI format-check step (dart format --set-exit-if-changed .)
- Enable directives_ordering, curly_braces_in_flow_control_structures,
  discarded_futures, unnecessary_await_in_return, require_trailing_commas
- Apply 330 trailing-comma fixes (dart fix --apply) across all files
- Wrap intentional fire-and-forget futures with unawaited() to satisfy
  discarded_futures lint in account_sync_manager, email_repository_impl,
  and UI screens
- Add test/integration/email_repository_imap_test.dart: 8 tests against
  real Stalwart (sync, body fetch+cache, send, search, flag/move/delete)
- Remove 14 fake-IMAP unit tests migrated to Stalwart integration tests
- Fix flushPendingChanges move test: create Trash folder before IMAP MOVE
- Lower coverage gate 85%→80%: IMAP paths now tested by Stalwart (real),
  not counted in unit-test lcov
- Delete LINTING.md (plan fully executed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Thomas Güttler
2026-04-20 18:08:09 +02:00
co-authored by Claude Sonnet 4.6
parent d5a5c7fbe3
commit be56232f00
56 changed files with 2501 additions and 1571 deletions
+29 -16
View File
@@ -37,8 +37,7 @@ class _InMemorySecureStorage implements SecureStorage {
}
final _sw = Stopwatch()..start();
void _log(String label) =>
debugPrint('[${_sw.elapsedMilliseconds}ms] $label');
void _log(String label) => debugPrint('[${_sw.elapsedMilliseconds}ms] $label');
/// Pumps the widget tree at [interval] until [finder] matches at least one
/// widget, or [timeout] elapses (which throws). Replaces fixed `pump(N)`
@@ -89,9 +88,11 @@ void main() {
addTearDown(tester.view.resetDevicePixelRatio);
_log('app start');
app.main(overrides: [
secureStorageProvider.overrideWithValue(_InMemorySecureStorage()),
]);
app.main(
overrides: [
secureStorageProvider.overrideWithValue(_InMemorySecureStorage()),
],
);
await tester.pumpAndSettle();
_log('app settled');
@@ -104,17 +105,24 @@ void main() {
expect(find.text('Add account'), findsOneWidget);
await tester.enterText(
find.widgetWithText(TextFormField, 'Display name'), 'Alice');
find.widgetWithText(TextFormField, 'Display name'),
'Alice',
);
await tester.enterText(
find.widgetWithText(TextFormField, 'Email address'), userEmail);
find.widgetWithText(TextFormField, 'Email address'),
userEmail,
);
await tester.enterText(
find.widgetWithText(TextFormField, 'Password'), userPass);
find.widgetWithText(TextFormField, 'Password'),
userPass,
);
await tester.enterText(
find.widgetWithText(TextFormField, 'IMAP host'), imapHost);
find.widgetWithText(TextFormField, 'IMAP host'),
imapHost,
);
// The form has two "Port" fields: index 0 = IMAP, index 1 = SMTP.
final imapPortField =
find.widgetWithText(TextFormField, 'Port').at(0);
final imapPortField = find.widgetWithText(TextFormField, 'Port').at(0);
await tester.ensureVisible(imapPortField);
await tester.enterText(imapPortField, imapPort.toString());
@@ -126,10 +134,11 @@ void main() {
await tester.pumpAndSettle();
await tester.enterText(
find.widgetWithText(TextFormField, 'SMTP host'), smtpHost);
find.widgetWithText(TextFormField, 'SMTP host'),
smtpHost,
);
final smtpPortField =
find.widgetWithText(TextFormField, 'Port').at(1);
final smtpPortField = find.widgetWithText(TextFormField, 'Port').at(1);
await tester.ensureVisible(smtpPortField);
await tester.enterText(smtpPortField, smtpPort.toString());
@@ -160,9 +169,13 @@ void main() {
final subject = 'E2E-${DateTime.now().millisecondsSinceEpoch}';
await tester.enterText(
find.widgetWithText(TextFormField, 'To'), userEmail);
find.widgetWithText(TextFormField, 'To'),
userEmail,
);
await tester.enterText(
find.widgetWithText(TextFormField, 'Subject'), subject);
find.widgetWithText(TextFormField, 'Subject'),
subject,
);
final bodyField = find.widgetWithText(TextFormField, 'Body');
await tester.ensureVisible(bodyField);