Files
doormile_milderapp/test/retired_platform_test.dart
2026-08-28 11:13:15 +05:30

66 lines
2.8 KiB
Dart

import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
/// ─────────────────────────────────────────────────────────────────────────
/// THE RETIRED PLATFORM IS NOT NAMED ANYWHERE
///
/// The delivery screens under `lib/xpress` are a verbatim port of a rider app
/// that belonged to a platform which has since been shut down. The port
/// brought its hostnames, its image host and its name in comments with it, and
/// those references outlived the thing they referred to.
///
/// A dead product's name in a live repo is not a cosmetic problem. It sends the
/// next reader looking for a backend that no longer answers, and it is exactly
/// the sort of string that gets pasted into a config file by somebody trying to
/// make a screen work.
///
/// ── Why the word is assembled rather than written ──
///
/// This file has to know the banned string in order to look for it, and a
/// literal here would be the very thing it forbids — the ban would fail its own
/// test. Joining two halves keeps the guard real and keeps the repo clean.
/// ─────────────────────────────────────────────────────────────────────────
void main() {
// The retired platform's name, never spelled in one piece. See above.
final banned = <String>[
['nea', 'rle'].join(),
];
test('no source, test or document names the retired platform', () {
final offenders = <String>[];
for (final dir in const ['lib', 'test']) {
for (final entity in Directory(dir).listSync(recursive: true)) {
if (entity is! File) continue;
if (!entity.path.endsWith('.dart')) continue;
// This file is the one place the string legitimately exists, in two
// halves — skip it rather than assemble a special case for it.
if (entity.path.endsWith('retired_platform_test.dart')) continue;
final text = entity.readAsStringSync().toLowerCase();
for (final word in banned) {
if (text.contains(word)) offenders.add(entity.path);
}
}
}
for (final doc in Directory('.').listSync()) {
if (doc is! File || !doc.path.endsWith('.md')) continue;
final text = doc.readAsStringSync().toLowerCase();
for (final word in banned) {
if (text.contains(word)) offenders.add(doc.path);
}
}
expect(
offenders,
isEmpty,
reason:
'the retired platform is named in: ${offenders.join(', ')} — it was '
'shut down, so a reference to it points at nothing and reads as a '
'live dependency to the next person through this file',
);
});
}