Skip to content

Commit

Permalink
🚨 Add dart fix configurations (#2049)
Browse files Browse the repository at this point in the history
![image](https://github.com/cfug/dio/assets/15884415/a5ce8c75-5fcc-4063-b77d-b022de6cc819)

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [ ] I have added the required tests to prove the fix/feature I'm
adding
- [ ] I have updated the documentation (if necessary)
- [ ] I have run the tests without failures
- [x] I have updated the `CHANGELOG.md` in the corresponding package

### Additional context and info (if any)

https://github.com/flutter/flutter/wiki/Data-driven-Fixes

There are some limitations with `dart fix` data, such as we cannot
modify a method parameter's arguments in a constructor
(`onHttpClientCreate: (client)` to `createHttpClient: ()`, `stream` to
`() => stream`).
  • Loading branch information
AlexV525 authored Dec 3, 2023
1 parent 5024b29 commit ff46ffa
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ See the [Migration Guide][] for the complete breaking changes list.**

## Unreleased

*None.*
- Provide fix suggestions for `dart fix`.

## 5.4.0

Expand Down
75 changes: 75 additions & 0 deletions dio/lib/fix_data/fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
version: 1

transforms:
# Changes made in https://github.com/cfug/diox/pull/14
- title: "Migrate to 'IOHttpClientAdapter'"
date: 2022-11-07
element:
uris: ['dio.dart', 'src/adapter.dart', 'src/adapters/io_adapter.dart']
class: 'DefaultHttpClientAdapter'
changes:
- kind: 'rename'
newName: 'IOHttpClientAdapter'

# Changes made in https://github.com/cfug/diox/pull/62
- title: "Migrate to 'BackgroundTransformer'"
date: 2023-01-31
element:
uris: ['dio.dart', 'src/transformer.dart']
class: 'DefaultTransformer'
changes:
- kind: 'rename'
newName: 'BackgroundTransformer'

# Changes made in https://github.com/cfug/dio/pull/1812
- title: "Migrate to 'CreateHttpClient'"
date: 2023-05-14
element:
uris: ['dio.dart', 'src/adapters/io_adapter.dart']
typedef: 'OnHttpClientCreate'
changes:
- kind: 'rename'
newName: 'CreateHttpClient'
- kind: 'removeParameter'
index: 0
- title: "Migrate to 'createHttpClient'"
date: 2023-05-14
element:
uris: ['dio.dart', 'src/adapters/io_adapter.dart']
constructor: ''
inClass: 'IOHttpClientAdapter'
changes:
- kind: 'renameParameter'
oldName: 'onHttpClientCreate'
newName: 'createHttpClient'

# Changes made in https://github.com/cfug/dio/pull/1803
- title: "Migrate to 'DioException'"
date: 2023-05-15
element:
uris: ['dio.dart', 'src/dio_exception.dart', 'src/dio_error.dart']
class: 'DioError'
changes:
- kind: 'rename'
newName: 'DioException'

# Changes made in https://github.com/cfug/dio/pull/1803
- title: "Migrate to 'DioExceptionType'"
date: 2023-05-15
element:
uris: ['dio.dart', 'src/dio_exception.dart', 'src/dio_error.dart']
class: 'DioErrorType'
changes:
- kind: 'rename'
newName: 'DioExceptionType'

# Changes made in https://github.com/cfug/dio/pull/1903
- title: "Migrate to 'MultipartFile.fromStream'"
date: 2023-06-25
element:
uris: ['dio.dart', 'src/multipart_file.dart']
constructor: ''
inClass: 'MultipartFile'
changes:
- kind: 'rename'
newName: 'fromStream'
2 changes: 1 addition & 1 deletion plugins/native_dio_adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

*None.*
- Provide fix suggestions for `dart fix`.

## 1.2.0

Expand Down
17 changes: 17 additions & 0 deletions plugins/native_dio_adapter/lib/fix_data/fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 1

transforms:
# Changes made in https://github.com/cfug/dio/pull/2040
- title: "Migrate to create configuration"
date: 2023-11-25
element:
uris: ['native_dio_adapter.dart', 'src/native_adapter.dart']
constructor: ''
inClass: 'NativeAdapter'
changes:
- kind: 'renameParameter'
oldName: 'androidCronetEngine'
newName: 'createCronetEngine'
- kind: 'renameParameter'
oldName: 'cupertinoConfiguration'
newName: 'createCupertinoConfiguration'

0 comments on commit ff46ffa

Please sign in to comment.