Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.
Merged
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
11 changes: 6 additions & 5 deletions lib/src/formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ class LcovFormatter implements Formatter {
}

buf.write('SF:$source\n');
v.keys.toList()
..sort()
..forEach((int k) {
buf.write('DA:$k,${v[k]}\n');
});
final lines = v.keys.toList()..sort();
lines.forEach((int k) {
buf.write('DA:$k,${v[k]}\n');
});
Copy link
Contributor

@cbracken cbracken Oct 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you're here, would you mind switching this to use a for-loop here rather than .forEach()? (I'm the guilty party on the original)

https://www.dartlang.org/guides/language/effective-dart/usage#avoid-using-iterableforeach-with-a-function-literal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually never mind, I'll follow up and eliminate my previous shameful commit separately ;)

buf.write('LF:${lines.length}\n');
buf.write('LH:${lines.where((k) => v[k] > 0).length}\n');
buf.write('end_of_record\n');
}

Expand Down