Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Issue 16964008: Code coverage, something is working now. (Closed)

Created:
7 years, 6 months ago by scheglov
Modified:
7 years, 6 months ago
Reviewers:
Bob Nystrom, pquitslund
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Code coverage, something is working now. For now only 'statement' level coverage. Review this, please. Any comments about Dart code style, using libraries, etc will be helpful! There are some Dart VM changes, which I'm _not_ going to commit. I'm waiting for https://codereview.chromium.org/16368002/ So, ignore them. R=pquitslund@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=24116

Patch Set 1 #

Total comments: 47

Patch Set 2 : Fixes for Phil review comments #

Total comments: 26

Patch Set 3 : Fixes for Bob review comments. #

Messages

Total messages: 8 (0 generated)
scheglov
7 years, 6 months ago (2013-06-17 06:31:38 UTC) #1
pquitslund
LGTM. My comments are pretty superficial. I bet Bob will have something more substantial to ...
7 years, 6 months ago (2013-06-17 20:15:58 UTC) #2
scheglov
Thanks! https://chromiumcodereview.appspot.com/16964008/diff/1/pkg/analyzer_experimental/bin/coverage.dart File pkg/analyzer_experimental/bin/coverage.dart (right): https://chromiumcodereview.appspot.com/16964008/diff/1/pkg/analyzer_experimental/bin/coverage.dart#newcode83 pkg/analyzer_experimental/bin/coverage.dart:83: buffer.write('${_argParser.getUsage()}\n\n'); On 2013/06/17 20:15:58, pquitslund wrote: > Cascade ...
7 years, 6 months ago (2013-06-17 20:50:59 UTC) #3
Bob Nystrom
I just skimmed it, but here's a few comments. https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin/coverage.dart File pkg/analyzer_experimental/bin/coverage.dart (right): https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin/coverage.dart#newcode9 pkg/analyzer_experimental/bin/coverage.dart:9: ...
7 years, 6 months ago (2013-06-17 21:30:11 UTC) #4
scheglov
Thank you for comments! https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart File pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart (right): https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart#newcode11 pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart:11: const int PORT = 0; ...
7 years, 6 months ago (2013-06-17 22:30:56 UTC) #5
Bob Nystrom
https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart File pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart (right): https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart#newcode24 pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_lib.dart:24: request.close(); On 2013/06/17 22:30:57, scheglov wrote: > Should I ...
7 years, 6 months ago (2013-06-17 22:44:41 UTC) #6
scheglov
Committed patchset #3 manually as r24116 (presubmit successful).
7 years, 6 months ago (2013-06-17 23:24:24 UTC) #7
scheglov
7 years, 6 months ago (2013-06-18 06:11:03 UTC) #8
Message was sent while issue was closed.
More comments addressed in new CL.
https://codereview.chromium.org/16885003

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin...
File pkg/analyzer_experimental/bin/coverage.dart (right):

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin...
pkg/analyzer_experimental/bin/coverage.dart:9: import "package:args/args.dart"
show ArgParser, ArgResults;
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Is there anything you were specifically trying to not import here? Otherwise,
> normal style is to not use "show".

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin...
pkg/analyzer_experimental/bin/coverage.dart:14: //
/Users/scheglov/Source/Dart/dart/pkg/analyzer_experimental/test/generated/all_test.dart
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Remove this?

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin...
pkg/analyzer_experimental/bin/coverage.dart:75: ..addOption('port', help: 'The
port to run server on, if 0 select any.', defaultsTo: '0');
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Long line. For Dart, we stick to 80 columns.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/bin...
pkg/analyzer_experimental/bin/coverage.dart:84: print(buffer.toString());
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Instead of building a buffer, I'd probably just print each line.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
File
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart
(right):

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:19:
import 'package:analyzer_experimental/src/generated/engine.dart' show
RecordingErrorListener;
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> I'd remove these "show" clauses.

These libraries are huge.
I feel uncomfortable if I blindly import everything from them :-(

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:33:
.then((int port) {
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Most people don't type annotate lambdas. It's usually obvious from the
context.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:39:
Process.start(dartExecutable, targetArgs).then((Process process) {
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> return Process.start...
> 
> If you create a future inside a .then() callback, you almost always want to
> return it. That makes sure errors get piped through.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:79:
var path = basePath + '/' + request.uri.path;
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Use pathos.join for this.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:80:
path = pathos.normalize(path);
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> If you're using pathos to work with URLs, you should create a builder
> specifically for that. Otherwise, on Windows, it will think you're working
with
> windows file paths. You can do:
> 
> var builder = new pathos.Builder(style: pathos.url)
> 
> And then call the same methods on builder that you do on pathos.

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:83:
{
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Is there a reason for this block?

Just to don't leak variable 'content' into outer scope.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:95:
file.exists().then((bool found) {
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> .then() returns a future, and ideally you would do something to keep track of
> that future. If an error is thrown from within it, it will exit the VM if
> nothing handles it.

I've added 'catchError'.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:164:
new File(outPath).writeAsString(sb.toString());
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> writeAsStringSync() or handle the returned future.

Actually I've found new File(outPath).openWrite() which is sync and I don't need
temporary StringBuffer.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:190:
if (path.contains('/packages/analyzer_experimental/')) {
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> return path.contains(...)

Done.

https://codereview.chromium.org/16964008/diff/1/pkg/analyzer_experimental/lib...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/coverage_impl.dart:215:
'class __CCC extends __cc_ut.Configuration {'
On 2013/06/17 21:30:11, Bob Nystrom wrote:
> Multiline string?

Done.

https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/...
File pkg/analyzer_experimental/lib/src/services/runtime/coverage/models.dart
(right):

https://codereview.chromium.org/16964008/diff/8001/pkg/analyzer_experimental/...
pkg/analyzer_experimental/lib/src/services/runtime/coverage/models.dart:83:
children.asMap().forEach((int i, NodeInfo child) {
On 2013/06/17 22:44:41, Bob Nystrom wrote:
> On 2013/06/17 22:30:57, scheglov wrote:
> > Is it recommended to have type annotations for closure parameters or skip
> them?
> 
> The style guide says: "AVOID annotating types on function expressions."
> 
> I'm assuming at some point you'll add inference for them so we don't have to
> annotate. :)

Done.

Powered by Google App Engine
This is Rietveld 408576698