Commit Graph

37 Commits

Author SHA1 Message Date
danrubel f7d3e5bebf Add dartfix --server option
This adds a --server option for specifying the analyis server snapshot
to be used when calculating fixes.

Change-Id: I0adc3148c030d23a9a62883d842851709cb78168
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106220
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-18 03:07:58 +00:00
Nicholas Shahan f9dfa7cbfd [dartfix] Bump pkg:pedantic to version 1.7.0
New versions of pedantic now offer imports to versioned includes. This will
allow us to update packages in the SDK independently when new lints are added in
future versions.

Issue: #37218
Change-Id: I43a4a9ba6730ed107a87f4060d47bb50d837de49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106184
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2019-06-17 16:47:52 +00:00
danrubel f69d5dc2c2 show analyzer details in dartfix
This updates dartfix to display details about the analysis process
if the analysis server provides them.

Change-Id: I0b2a7e8267b92e1eefd1ce90aa53a85cc91c48d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105549
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 22:46:13 +00:00
danrubel a3348ab702 sort some dartfix classes
Change-Id: I0655c6ae7d06219ee17957c9c49e90fbf8afe63d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105548
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-06-11 22:46:13 +00:00
Dan Rubel b324850eae cleanup list of fixes in dartfix help text
This CL cleans up the displayed help text, better organizes and displays
the list of fixes that are or can be applied, and addresses
a comment in https://dart-review.googlesource.com/c/sdk/+/105002

Change-Id: I2e71001ae7eda61b3b01ce999cb9fdca968a9b93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105322
Commit-Queue: Dan Rubel <danrubel@google.com>
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2019-06-06 19:57:12 +00:00
Dan Rubel ba8e5f6535 list fixes when displaying help
This removes this --list option from dartfix and instead displays
the list of fixes when the --help option is specified.

Partially addresses https://github.com/dart-lang/sdk/issues/36875

Change-Id: Ibd8b124c2c20a752f7e661672eac8aa2e4483b26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105002
Auto-Submit: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-06-06 14:22:15 +00:00
Devon Carew ab84e36989 [dartfix] refactor the dartfix cli UI a bit
Change-Id: I9935ace979b0302d4f68c8a84ed9886a0ccf0c4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101761
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-05-08 18:51:11 +00:00
Devon Carew ce2bbd4108 [dartfix] refactor dartfix pubspec.yaml
Change-Id: Ib651df66b8ecef1abc9e9992e1461412d6e88df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101760
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-05-08 18:46:51 +00:00
danrubel afe609d2c2 Update NNBD migration to add import as necessary
... and simplify apply code edits

Change-Id: I6f205df29ffd42341e2244ff3a5609ba005adcfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98612
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-04 20:31:23 +00:00
danrubel 0669c2cee5 fix dartfix modification of analysis options
... and improve NNBD YamlException error message
Address comments in https://dart-review.googlesource.com/c/sdk/+/98524

Change-Id: I0e44ca8b887b47f1fac247650402032d1e5f5b23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-03 19:34:01 +00:00
danrubel 1d6a7bee36 rework dartfix NNBD to use FixCodeTask.processPackage
This generalizes the dartfix NNBD processing of packages so that
other fixes can process packages in a similar manner.
In addition, if at least one package to be migrated to NNBD
cannot be marked as NNBD or is not already NNBD,
then no additional NNBD processing is done.

This also addresses comments in
https://dart-review.googlesource.com/c/sdk/+/98429

Change-Id: I406d9d395a0ee8a85cc5b3d7be311a76e1e48bdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98524
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-03 15:52:36 +00:00
danrubel ff99692175 dartfix update analysis options to enable NNBD
This updates the analysis server edit.dartfix functionality
to enable NNBD by modifying the analysis options file,
creating that file if necessary.

Change-Id: I831182e49e585ef0d851d4eb715885e90954bcad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98429
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-04-02 15:29:59 +00:00
danrubel a417659fcd debug dartfix test
... by ensuring that logged information is echoed to console

Change-Id: I8e9c71d0fc6f164637c35d28415cdf02e9a47b9a
Reviewed-on: https://dart-review.googlesource.com/c/94880
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-28 20:39:16 +00:00
danrubel 1596f437bd debug dartfix test
This test passes when run locally, but fails on the bots.
Time to gather more information.

Change-Id: Iccfbd52161b03f8119017612fc66f899cc9e5178
Reviewed-on: https://dart-review.googlesource.com/c/94801
Reviewed-by: Dan Rubel <danrubel@google.com>
2019-02-28 17:18:49 +00:00
danrubel 3afc3b58d0 Add dartfix protocol integration tests
... and address comments in https://dart-review.googlesource.com/c/sdk/+/91780

Change-Id: Ibd01a0de575065cf18822b806a9c687de2667add
Reviewed-on: https://dart-review.googlesource.com/c/92243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-02-07 06:21:57 +00:00
danrubel 6c680a0ebd Update dartfix readme and update version numbers
* Update the readme to discuss required vs suggested fixes
* Remove the out-of-date options section from the readme
* Update dartfix and analysis_server_client versions and changelog

Change-Id: Ida4b30f9f89eb84a2fe856f61562ff73bf6725da
Reviewed-on: https://dart-review.googlesource.com/c/92153
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2019-02-07 01:16:56 +00:00
danrubel 1c173c2ce7 Enhance dartfix to allow including and excluding specific fixes
This add several options to the dartfix command line
so that only specific fixes can be applied rather than all fixes.

Fix https://github.com/dart-lang/sdk/issues/35539

Change-Id: I8bb89696b0b47a291ed22aa00d4787f3ea5aa4be
Reviewed-on: https://dart-review.googlesource.com/c/91780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-02-01 16:55:17 +00:00
danrubel da09945643 Update dartfix pubspec before publishing
Change-Id: I542aa5973aa22725980baf048fa07bc10d7b85bb
Reviewed-on: https://dart-review.googlesource.com/c/89902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2019-01-17 02:05:53 +00:00
danrubel fe6b384ff5 revise dartfix protocol version check
Change-Id: I655773791189dd5cf133ade8a48ed39ff48b6345
Reviewed-on: https://dart-review.googlesource.com/c/89402
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-01-15 15:52:54 +00:00
Kathy Walrath 8d9247b9fc dartfix README
@danrubel What do you think of these as docs? (It's pretty close to what I wrote for www.dartlang.org, before I realized that it's too early to document dartfix there.)

We talked about having a separate page per fix, but I figured we could do that in a future PR.

Closes dart-lang/site-www#1229

Closes #35628
https://github.com/dart-lang/sdk/pull/35628

GitOrigin-RevId: 582cd58ea1457bc62ac0a3aeac61affa8abfcc37
Change-Id: I9dca2777b8ed8707fc3e37b04e13b5a2be7b7f65
Reviewed-on: https://dart-review.googlesource.com/c/89061
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Kathy Walrath <kathyw@google.com>
2019-01-13 02:26:05 +00:00
danrubel 62850bf967 update pubspec version
Change-Id: If8eb29cba552a3ab18660e731d3c4a909a9382b5
Reviewed-on: https://dart-review.googlesource.com/c/87624
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-18 21:04:42 +00:00
danrubel bfc8ba1459 Update dartfix SDK constraints
Change-Id: I272161b5fedfd59c084e84684344c45f2d962c6a
Reviewed-on: https://dart-review.googlesource.com/c/87621
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-12-18 18:09:10 +00:00
danrubel 93306f5ec0 Add dartfix integration test
... and update changelog and tweak SDK constraints

Change-Id: Ifb3e733b84c3aecad0ff8fe805f77ef497248f3b
Reviewed-on: https://dart-review.googlesource.com/c/86600
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-12-17 04:37:07 +00:00
danrubel ebeae74390 Update version before publishing
Change-Id: Ia83e7226715ad1469d51e443a6a24505da71660a
Reviewed-on: https://dart-review.googlesource.com/c/84941
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-20 18:54:43 +00:00
danrubel b607f65217 More dartfix tests
This adds a test that asserts the analysis_server_client version
matches the version specified in the dartfix pubspec.

In addition, this remove code that reads the version
from dartfix pubspec.yaml because the pubspec.yaml is not present
when dartfix is activated and run via pub global activate.

Change-Id: I6deed00428afb8844d03a9604699e0c089d7ce6f
Reviewed-on: https://dart-review.googlesource.com/c/84940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-20 17:47:27 +00:00
Dan Rubel 784ad29470 Update dartfix to check analysis server protocol version
This updates dartfix to more narrowly verify the analysis server
protocol version and print instructions for the user if the protocol
version expected by dartfix is incompatible with the current Dart SDK.
This is necessary because the edit.dartfix protocol is experimental
and will continue to evolve.

Change-Id: Ib31eb594a8a94416cb4fc676e7da9150f8c99b6a
Reviewed-on: https://dart-review.googlesource.com/c/84780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-19 21:14:28 +00:00
danrubel e39fa29bd6 analysis_server_client API tweaks before publish
* Rename ClientListener to ServerListener
* Change ServerConnectionHandler on --> implements NotificationHandler

Change-Id: I459e4c566971d49790e12b8f1386ae80db33b38b
Reviewed-on: https://dart-review.googlesource.com/c/84560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-15 21:44:03 +00:00
Dan Rubel bec2daba02 Cleanup analysis_server_client API
This reduces the client functionality and renames some
of the classes and methods in the API.

Specifically:
- rename Server to Client
- rename ServerConnectionHandler to ConnectionHandler
- rename Client.start to Client.startServer
- rename Client.stop to Client.stopServer
- rename Client.kill to Client.killServer
- extract behavior from Client into Listeners
- move some of the listeners into dartfix
- make several Client fields private
Change-Id: Ie71b0ac55b489099a848764251e8369c27f6ea2d
Reviewed-on: https://dart-review.googlesource.com/c/84460
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-11-15 15:06:55 +00:00
Dan Rubel 8178cb602e Refactor dartfix to use new notification handlers
and narrow the SDK version supported by dartfix

Change-Id: I63317a3a89d68d74815f5c192970f71bfbc422d4
Reviewed-on: https://dart-review.googlesource.com/c/83720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-11-08 21:10:06 +00:00
Dan Rubel a074bcf93c Update dartfix package for publication
Updates to dartfix for publication including:
* add changelog, readme, and license
* update pubspec version and executables

along with a collection of smaller changes including:
* test cleanup
* remove duplicate time value from verbose output
* read dartfix pubspec version and pass that to analysis server

Change-Id: Ifa94df45e6cbcf9a98f7bf393c22e06eaab48c38
Reviewed-on: https://dart-review.googlesource.com/c/82240
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-31 17:36:51 +00:00
Dan Rubel 6294171508 comment cleanup
Change-Id: I83bf6513b1acd9faedb14f1bf44e32df76dd8528
Reviewed-on: https://dart-review.googlesource.com/c/82164
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-31 14:25:35 +00:00
Dan Rubel 645ec2e8b5 Meld server runner in dart fix with analysis_server_client
Change-Id: I86a2e7b815ff6d3beea2d968c5e34c4e3feae2c3
Reviewed-on: https://dart-review.googlesource.com/c/82080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-30 20:04:58 +00:00
Devon Carew f4ce2c5749 Update deps for dartfix.
Change-Id: Ia26438cc05a8d102657a39adb9bb647aed04a578
Reviewed-on: https://dart-review.googlesource.com/c/81961
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2018-10-29 23:22:17 +00:00
danrubel e414b5823d Improve dartfix output
* include file path in suggestion output
* more verbose output for debugging in the field
* update pubspec.yaml
* display paths relative to the target directories

Change-Id: I64e519d72773c3e56e4502fab7591c43fda35bf3
Reviewed-on: https://dart-review.googlesource.com/c/81860
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-29 16:47:30 +00:00
danrubel 0fe448a996 Revise the analysis server edit.dartfix protocol
This updates the edit.dartfix protocol to separate location from the text
describing the changes so that the dartfix client can choose
what location information to display and how it should be displayed.

Change-Id: Ic56a4cb187538571d60136d6de9265d879fccb53
Reviewed-on: https://dart-review.googlesource.com/c/81780
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-10-29 01:50:27 +00:00
Dan Rubel b8fd29e0bb Remove dartfix dependencies on analysis server
This replaces dartfix dependencies on ...
* analysis_server
* analyzer (except for testing)
* analyzer_plugins

... with a dependency on analysis_server_client.

Change-Id: If511de69333e925ae082fa06c5114188c3c405b1
Reviewed-on: https://dart-review.googlesource.com/c/81342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-10-24 19:26:58 +00:00
danrubel a82e025739 Move dartfix to its own package
Fix https://github.com/dart-lang/sdk/issues/34765

Change-Id: I44b3ccc4861b383601fea1b006f1fd4726b11062
Reviewed-on: https://dart-review.googlesource.com/c/81080
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2018-10-22 17:50:25 +00:00