Skip to content

Commit a1432a9

Browse files
PiinksSwiftaxe
andauthored
Refactor fix_data.yaml (flutter#114192)
* Refactor fix_data.yaml * ++ * lib, not lib/src * Nit * Nit * Update packages/flutter/test_fixes/material/app_bar_theme.dart Co-authored-by: Alexander Dahlberg <[email protected]> * Fix copy paste errors Co-authored-by: Alexander Dahlberg <[email protected]>
1 parent 53e6876 commit a1432a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+7996
-7374
lines changed

packages/flutter/lib/fix_data.yaml

Lines changed: 0 additions & 5665 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Directory contents
2+
3+
The `.yaml` files in these directories are used to
4+
define the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings
5+
used by the Flutter framework.
6+
7+
The number of fix rules defined in a file should not exceed 50 for better
8+
maintainability. Searching for `title:` is a given `.yaml` file will account
9+
for the number of fixes. Splitting out fix rules should be done by class.
10+
11+
When adding a new `.yaml` file, make a copy of `fix_template.yaml`. If the new
12+
file is not for generic library fixes (`fix_material.yaml`), ensure it is
13+
enclosed in an appropriate library directory (`fix_data/fix_material`), and
14+
named after the class. Fix files outside of generic libraries should represent
15+
individual classes (`fix_data/fix_material/fix_app_bar.yaml`).
16+
17+
See the flutter/packages/flutter/test_fixes directory for the tests that
18+
validate these fix rules.
19+
20+
To run these tests locally, execute this command in the
21+
flutter/packages/flutter/test_fixes directory.
22+
```sh
23+
dart fix --compare-to-golden
24+
```
25+
26+
For more documentation about Data Driven Fixes, see
27+
https://dart.dev/go/data-driven-fixes#test-folder.
28+
29+
To learn more about how fixes are authored in package:flutter, see
30+
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
31+
32+
## When making structural changes to this directory
33+
34+
Note that the tests in this directory are also invoked from external
35+
repositories. Specifically, the CI system for the dart-lang/sdk repo runs these
36+
tests in order to ensure that changes to the dart fix file format do not break
37+
Flutter.
38+
39+
See [tools/bots/flutter/analyze_flutter_flutter.sh](https://github.com/dart-lang/sdk/blob/main/tools/bots/flutter/analyze_flutter_flutter.sh)
40+
for where the tests are invoked.
41+
42+
When possible, please coordinate changes to this directory that might affect the
43+
`analyze_flutter_flutter.sh` script.
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
# Copyright 2014 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# For details regarding the *Flutter Fix* feature, see
6+
# https://flutter.dev/docs/development/tools/flutter-fix
7+
8+
# Please add new fixes to the top of the file, separated by one blank line
9+
# from other fixes. In a comment, include a link to the PR where the change
10+
# requiring the fix was made.
11+
12+
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
13+
# file for instructions on testing these data driven fixes.
14+
15+
# For documentation about this file format, see
16+
# https://dart.dev/go/data-driven-fixes.
17+
18+
# * Fixes in this file are from the Cupertino library. *
19+
version: 1
20+
transforms:
21+
# Change made in https://github.com/flutter/flutter/pull/20649
22+
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
23+
- title: "Replace with 'CupertinoPopupSurface'"
24+
date: 2021-01-07
25+
bulkApply: false
26+
element:
27+
uris: [ 'cupertino.dart' ]
28+
class: 'CupertinoDialog'
29+
changes:
30+
- kind: 'rename'
31+
newName: 'CupertinoPopupSurface'
32+
33+
# Change made in https://github.com/flutter/flutter/pull/20649
34+
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
35+
- title: "Replace with 'CupertinoAlertDialog'"
36+
date: 2021-01-07
37+
bulkApply: false
38+
element:
39+
uris: [ 'cupertino.dart' ]
40+
class: 'CupertinoDialog'
41+
changes:
42+
- kind: 'rename'
43+
newName: 'CupertinoAlertDialog'
44+
- kind: 'renameParameter'
45+
oldName: 'child'
46+
newName: 'content'
47+
48+
# Changes made in https://github.com/flutter/flutter/pull/68905.
49+
- title: "Migrate from 'nullOk'"
50+
date: 2021-01-27
51+
element:
52+
uris: [ 'cupertino.dart' ]
53+
method: 'resolveFrom'
54+
inClass: 'CupertinoTextThemeData'
55+
changes:
56+
- kind: 'removeParameter'
57+
name: 'nullOk'
58+
59+
# Changes made in https://github.com/flutter/flutter/pull/68905.
60+
- title: "Migrate from 'nullOk'"
61+
date: 2021-01-27
62+
element:
63+
uris: [ 'cupertino.dart' ]
64+
method: 'resolveFrom'
65+
inClass: 'NoDefaultCupertinoThemeData'
66+
changes:
67+
- kind: 'removeParameter'
68+
name: 'nullOk'
69+
70+
# Changes made in https://github.com/flutter/flutter/pull/68905.
71+
- title: "Migrate from 'nullOk'"
72+
date: 2021-01-27
73+
element:
74+
uris: [ 'cupertino.dart' ]
75+
method: 'resolveFrom'
76+
inClass: 'CupertinoThemeData'
77+
changes:
78+
- kind: 'removeParameter'
79+
name: 'nullOk'
80+
81+
# Changes made in https://github.com/flutter/flutter/pull/68736.
82+
- title: "Migrate from 'nullOk'"
83+
date: 2021-01-27
84+
element:
85+
uris: [ 'cupertino.dart' ]
86+
method: 'brightnessOf'
87+
inClass: 'CupertinoTheme'
88+
oneOf:
89+
- if: "nullOk == 'true'"
90+
changes:
91+
- kind: 'rename'
92+
newName: 'maybeBrightnessOf'
93+
- kind: 'removeParameter'
94+
name: 'nullOk'
95+
- if: "nullOk == 'false'"
96+
changes:
97+
- kind: 'removeParameter'
98+
name: 'nullOk'
99+
variables:
100+
nullOk:
101+
kind: 'fragment'
102+
value: 'arguments[nullOk]'
103+
104+
# Changes made in https://github.com/flutter/flutter/pull/68905.
105+
- title: "Migrate from 'nullOk'"
106+
date: 2021-01-27
107+
element:
108+
uris: [ 'cupertino.dart' ]
109+
method: 'of'
110+
inClass: 'CupertinoUserInterfaceLevel'
111+
oneOf:
112+
- if: "nullOk == 'true'"
113+
changes:
114+
- kind: 'rename'
115+
newName: 'maybeOf'
116+
- kind: 'removeParameter'
117+
name: 'nullOk'
118+
- if: "nullOk == 'false'"
119+
changes:
120+
- kind: 'removeParameter'
121+
name: 'nullOk'
122+
variables:
123+
nullOk:
124+
kind: 'fragment'
125+
value: 'arguments[nullOk]'
126+
127+
# Changes made in https://github.com/flutter/flutter/pull/68905.
128+
- title: "Migrate from 'nullOk'"
129+
date: 2021-01-27
130+
element:
131+
uris: [ 'cupertino.dart' ]
132+
method: 'resolveFrom'
133+
inClass: 'CupertinoDynamicColor'
134+
changes:
135+
- kind: 'removeParameter'
136+
name: 'nullOk'
137+
138+
# Changes made in https://github.com/flutter/flutter/pull/68905.
139+
- title: "Migrate from 'nullOk'"
140+
date: 2021-01-27
141+
element:
142+
uris: [ 'cupertino.dart' ]
143+
method: 'resolve'
144+
inClass: 'CupertinoDynamicColor'
145+
oneOf:
146+
- if: "nullOk == 'true'"
147+
changes:
148+
- kind: 'rename'
149+
newName: 'maybeResolve'
150+
- kind: 'removeParameter'
151+
name: 'nullOk'
152+
- if: "nullOk == 'false'"
153+
changes:
154+
- kind: 'removeParameter'
155+
name: 'nullOk'
156+
variables:
157+
nullOk:
158+
kind: 'fragment'
159+
value: 'arguments[nullOk]'
160+
161+
# Changes made in https://github.com/flutter/flutter/pull/72043
162+
- title: "Migrate to 'maxLengthEnforcement'"
163+
date: 2020-12-13
164+
element:
165+
uris: [ 'cupertino.dart' ]
166+
field: 'maxLengthEnforced'
167+
inClass: 'CupertinoTextField'
168+
changes:
169+
- kind: 'rename'
170+
newName: 'maxLengthEnforcement'
171+
172+
# Changes made in https://github.com/flutter/flutter/pull/72043
173+
- title: "Migrate to 'maxLengthEnforcement'"
174+
date: 2020-12-13
175+
element:
176+
uris: [ 'cupertino.dart' ]
177+
constructor: 'borderless'
178+
inClass: 'CupertinoTextField'
179+
oneOf:
180+
- if: "maxLengthEnforced == 'true'"
181+
changes:
182+
- kind: 'addParameter'
183+
index: 0
184+
name: 'maxLengthEnforcement'
185+
style: optional_named
186+
argumentValue:
187+
expression: 'MaxLengthEnforcement.enforce'
188+
requiredIf: "maxLengthEnforced == 'true'"
189+
- kind: 'removeParameter'
190+
name: 'maxLengthEnforced'
191+
- if: "maxLengthEnforced == 'false'"
192+
changes:
193+
- kind: 'addParameter'
194+
index: 0
195+
name: 'maxLengthEnforcement'
196+
style: optional_named
197+
argumentValue:
198+
expression: 'MaxLengthEnforcement.none'
199+
requiredIf: "maxLengthEnforced == 'false'"
200+
- kind: 'removeParameter'
201+
name: 'maxLengthEnforced'
202+
variables:
203+
maxLengthEnforced:
204+
kind: 'fragment'
205+
value: 'arguments[maxLengthEnforced]'
206+
207+
# Changes made in https://github.com/flutter/flutter/pull/72043
208+
- title: "Migrate to 'maxLengthEnforcement'"
209+
date: 2020-12-13
210+
element:
211+
uris: [ 'cupertino.dart' ]
212+
constructor: ''
213+
inClass: 'CupertinoTextField'
214+
oneOf:
215+
- if: "maxLengthEnforced == 'true'"
216+
changes:
217+
- kind: 'addParameter'
218+
index: 0
219+
name: 'maxLengthEnforcement'
220+
style: optional_named
221+
argumentValue:
222+
expression: 'MaxLengthEnforcement.enforce'
223+
requiredIf: "maxLengthEnforced == 'true'"
224+
- kind: 'removeParameter'
225+
name: 'maxLengthEnforced'
226+
- if: "maxLengthEnforced == 'false'"
227+
changes:
228+
- kind: 'addParameter'
229+
index: 0
230+
name: 'maxLengthEnforcement'
231+
style: optional_named
232+
argumentValue:
233+
expression: 'MaxLengthEnforcement.none'
234+
requiredIf: "maxLengthEnforced == 'false'"
235+
- kind: 'removeParameter'
236+
name: 'maxLengthEnforced'
237+
variables:
238+
maxLengthEnforced:
239+
kind: 'fragment'
240+
value: 'arguments[maxLengthEnforced]'
241+
242+
# Changes made in https://github.com/flutter/flutter/pull/96957
243+
- title: "Migrate to 'thumbVisibility'"
244+
date: 2022-01-20
245+
element:
246+
uris: [ 'cupertino.dart' ]
247+
field: 'isAlwaysShown'
248+
inClass: 'CupertinoScrollbar'
249+
changes:
250+
- kind: 'rename'
251+
newName: 'thumbVisibility'
252+
253+
# Changes made in https://github.com/flutter/flutter/pull/96957
254+
- title: "Migrate to 'thumbVisibility'"
255+
date: 2022-01-20
256+
element:
257+
uris: [ 'cupertino.dart' ]
258+
constructor: ''
259+
inClass: 'CupertinoScrollbar'
260+
changes:
261+
- kind: 'renameParameter'
262+
oldName: 'isAlwaysShown'
263+
newName: 'thumbVisibility'
264+
265+
# Changes made in https://github.com/flutter/flutter/pull/41859
266+
- title: "Remove 'brightness'"
267+
date: 2020-12-10
268+
element:
269+
uris: [ 'cupertino.dart' ]
270+
constructor: ''
271+
inClass: 'CupertinoTextThemeData'
272+
changes:
273+
- kind: 'removeParameter'
274+
name: 'brightness'
275+
276+
# Changes made in https://github.com/flutter/flutter/pull/41859
277+
- title: "Remove 'brightness'"
278+
date: 2020-12-10
279+
element:
280+
uris: [ 'cupertino.dart' ]
281+
method: 'copyWith'
282+
inClass: 'CupertinoTextThemeData'
283+
changes:
284+
- kind: 'removeParameter'
285+
name: 'brightness'
286+
287+
# Changes made in https://github.com/flutter/flutter/pull/78588
288+
- title: "Migrate to 'buildOverscrollIndicator'"
289+
date: 2021-03-18
290+
element:
291+
uris: [ 'cupertino.dart' ]
292+
method: 'buildViewportChrome'
293+
inClass: 'CupertinoScrollBehavior'
294+
changes:
295+
- kind: 'rename'
296+
newName: 'buildOverscrollIndicator'
297+
298+
# Before adding a new fix: read instructions at the top of this file.

0 commit comments

Comments
 (0)