wellactually
rehlma / flutter-debuggable-control-flowr1

agents: helpful 88%, did not apply 12%, not helpful 0%, from 1 userKeep control flow easy to debug

Public

Use braces and put every control-flow body on a separate line.

tests, run by the registry9 passed · slowest 2.6 ms
✓fires
reports newly written problematic code detector.test.ts
write lib/example.dart · in fixtures/flutterfired: line 1
if (ready) { return; }
2.6 ms
✓quiet
allows the intended form detector.test.ts
write lib/example.dart · in fixtures/flutterstayed quiet
if (ready) {
  return;
}
2.0 ms
✓quiet
does not apply to a pure Dart package detector.test.ts
write lib/example.dart · in fixtures/dartstayed quiet
if (ready) { return; }
1.6 ms
✓skips
does not judge reads detector.test.ts
read lib/example.dart · in fixtures/flutterno handler of the detector wants this event
if (ready) { return; }
0.0 ms
✓quiet
does not report an untouched legacy line detector.test.ts
write lib/example.dart · in fixtures/flutter · wrote line 2stayed quiet
if (ready) { return; }
final added = 1;
1.7 ms
✓quiet
ignores comments, strings and collection elements detector.test.ts
write lib/a.dart · in fixtures/flutterstayed quiet
// if (ready) return;
final text = 'if (ready) return;';
final values = [if (ready) value];
1.8 ms
✓fires
supports inline flutter dependency detector.test.ts
write lib/a.dart · in fixtures/inlinefired: line 1
if (ready) return;
1.6 ms
✓skips
ignores generated source detector.test.ts
write lib/a.genq.dart · in fixtures/flutterno handler of the detector wants this event
if (ready) return;
0.0 ms
✓quiet
allows multiline collection elements and do-while endings detector.test.ts
write lib/a.dart · in fixtures/flutterstayed quiet
final items = [
  if (ready) buildItem(),
];
write lib/a.dart · in fixtures/flutterstayed quiet
} while (running);
1.9 ms
detector.test.tseach detect() call runs the real detector
import { expect, test } from 'vitest';
import { detect, write, edit, read, command, output, prompt } from '@wellactually/sdk/v3/test';
const flutter = { project: 'fixtures/flutter' };
const dart = { project: 'fixtures/dart' };

test('reports newly written problematic code', () => {
  expect(detect(write("lib/example.dart", "if (ready) { return; }"), flutter)).toEqual([{ line: 1 }]);
});
test('allows the intended form', () => {
  expect(detect(write("lib/example.dart", "if (ready) {\n  return;\n}"), flutter)).toEqual([]);
});
test('does not apply to a pure Dart package', () => {
  expect(detect(write("lib/example.dart", "if (ready) { return; }"), dart)).toEqual([]);
});
test('does not judge reads', () => {
  expect(detect(read("lib/example.dart", "if (ready) { return; }"), flutter)).toEqual([]);
});
test('does not report an untouched legacy line', () => {
  expect(detect(edit("lib/example.dart", "if (ready) { return; }\nfinal added = 1;", { written: 'final added = 1;' }), flutter)).toEqual([]);
});

test('ignores comments, strings and collection elements', () => {
  expect(detect(write('lib/a.dart', "// if (ready) return;\nfinal text = 'if (ready) return;';\nfinal values = [if (ready) value];"), flutter)).toEqual([]);
});
test('supports inline flutter dependency', () => {
  expect(detect(write('lib/a.dart', 'if (ready) return;'), { project: 'fixtures/inline' })).toEqual([{ line: 1 }]);
});
test('ignores generated source', () => {
  expect(detect(write('lib/a.genq.dart', 'if (ready) return;'), flutter)).toEqual([]);
});
test('allows multiline collection elements and do-while endings', () => {
  expect(detect(write('lib/a.dart', 'final items = [\n  if (ready) buildItem(),\n];'), flutter)).toEqual([]);
  expect(detect(write('lib/a.dart', '} while (running);'), flutter)).toEqual([]);
});