dart-archive / dart2_fix

A tool to migrate API usage to Dart 2
https://pub.dartlang.org/packages/dart2_fix
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Initial sketch of code to compute and apply fixes #2

Closed bwilkerson closed 6 years ago

bwilkerson commented 6 years ago

Untested and incomplete. Just to make sure we're on the same page for the direction we're heading.

devoncarew commented 6 years ago

In your PR, can you remove the stable line here: https://github.com/dart-lang/dart2_fix/blob/master/.travis.yml#L10

bwilkerson commented 6 years ago

Done

devoncarew commented 6 years ago

If it helps, what I'm thinking for the UI:

> dart2_fix

Checking project foo_bar...

lib/main.dart
  line 23, deprecated Duration.ZERO
  line 37, deprecated Duration.ZERO
lib/src/foo.dart.dart
  line 23, deprecated Duration.ZERO

37 changes found.

and then:

dart2fix --apply

lib/main.dart
   7 changes Duration.ZERO ==> Duration.zero
lib/src/foo.dart
   1 change Duration.BAZ ==> Duration.baz
   3 changes Duration.ZERO ==> Duration.zero

37 changes total.

In other words, a run of the tool w/o args will just indicate what changes it's found; a run of the tool with something like --apply would actually perform the changes on disk (and indicate approx. what changed).

devoncarew commented 6 years ago

I would remove lines https://github.com/dart-lang/dart2_fix/blob/master/.travis.yml#L22 and 23 as well - the stable option, and the the dartfmt task.

bwilkerson commented 6 years ago

Also done

bwilkerson commented 6 years ago

That sounds like a reasonable UI. I'll refactor to support it.