Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Refactor fix_data.yaml (#114192)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
Piinks and Swiftaxe authored Nov 8, 2022
1 parent 53e6876 commit a1432a9
Show file tree
Hide file tree
Showing 54 changed files with 7,996 additions and 7,374 deletions.
5,665 changes: 0 additions & 5,665 deletions packages/flutter/lib/fix_data.yaml

This file was deleted.

43 changes: 43 additions & 0 deletions packages/flutter/lib/fix_data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Directory contents

The `.yaml` files in these directories are used to
define the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings
used by the Flutter framework.

The number of fix rules defined in a file should not exceed 50 for better
maintainability. Searching for `title:` is a given `.yaml` file will account
for the number of fixes. Splitting out fix rules should be done by class.

When adding a new `.yaml` file, make a copy of `fix_template.yaml`. If the new
file is not for generic library fixes (`fix_material.yaml`), ensure it is
enclosed in an appropriate library directory (`fix_data/fix_material`), and
named after the class. Fix files outside of generic libraries should represent
individual classes (`fix_data/fix_material/fix_app_bar.yaml`).

See the flutter/packages/flutter/test_fixes directory for the tests that
validate these fix rules.

To run these tests locally, execute this command in the
flutter/packages/flutter/test_fixes directory.
```sh
dart fix --compare-to-golden
```

For more documentation about Data Driven Fixes, see
https://dart.dev/go/data-driven-fixes#test-folder.

To learn more about how fixes are authored in package:flutter, see
https://github.com/flutter/flutter/wiki/Data-driven-Fixes

## When making structural changes to this directory

Note that the tests in this directory are also invoked from external
repositories. Specifically, the CI system for the dart-lang/sdk repo runs these
tests in order to ensure that changes to the dart fix file format do not break
Flutter.

See [tools/bots/flutter/analyze_flutter_flutter.sh](https://github.com/dart-lang/sdk/blob/main/tools/bots/flutter/analyze_flutter_flutter.sh)
for where the tests are invoked.

When possible, please coordinate changes to this directory that might affect the
`analyze_flutter_flutter.sh` script.
298 changes: 298 additions & 0 deletions packages/flutter/lib/fix_data/fix_cupertino.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# For details regarding the *Flutter Fix* feature, see
# https://flutter.dev/docs/development/tools/flutter-fix

# Please add new fixes to the top of the file, separated by one blank line
# from other fixes. In a comment, include a link to the PR where the change
# requiring the fix was made.

# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
# file for instructions on testing these data driven fixes.

# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.

# * Fixes in this file are from the Cupertino library. *
version: 1
transforms:
# Change made in https://github.com/flutter/flutter/pull/20649
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
- title: "Replace with 'CupertinoPopupSurface'"
date: 2021-01-07
bulkApply: false
element:
uris: [ 'cupertino.dart' ]
class: 'CupertinoDialog'
changes:
- kind: 'rename'
newName: 'CupertinoPopupSurface'

# Change made in https://github.com/flutter/flutter/pull/20649
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
- title: "Replace with 'CupertinoAlertDialog'"
date: 2021-01-07
bulkApply: false
element:
uris: [ 'cupertino.dart' ]
class: 'CupertinoDialog'
changes:
- kind: 'rename'
newName: 'CupertinoAlertDialog'
- kind: 'renameParameter'
oldName: 'child'
newName: 'content'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'NoDefaultCupertinoThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'

# Changes made in https://github.com/flutter/flutter/pull/68736.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'brightnessOf'
inClass: 'CupertinoTheme'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeBrightnessOf'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'of'
inClass: 'CupertinoUserInterfaceLevel'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeOf'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoDynamicColor'
changes:
- kind: 'removeParameter'
name: 'nullOk'

# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolve'
inClass: 'CupertinoDynamicColor'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeResolve'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'

# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
field: 'maxLengthEnforced'
inClass: 'CupertinoTextField'
changes:
- kind: 'rename'
newName: 'maxLengthEnforcement'

# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
constructor: 'borderless'
inClass: 'CupertinoTextField'
oneOf:
- if: "maxLengthEnforced == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.enforce'
requiredIf: "maxLengthEnforced == 'true'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
- if: "maxLengthEnforced == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.none'
requiredIf: "maxLengthEnforced == 'false'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
variables:
maxLengthEnforced:
kind: 'fragment'
value: 'arguments[maxLengthEnforced]'

# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoTextField'
oneOf:
- if: "maxLengthEnforced == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.enforce'
requiredIf: "maxLengthEnforced == 'true'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
- if: "maxLengthEnforced == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.none'
requiredIf: "maxLengthEnforced == 'false'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
variables:
maxLengthEnforced:
kind: 'fragment'
value: 'arguments[maxLengthEnforced]'

# Changes made in https://github.com/flutter/flutter/pull/96957
- title: "Migrate to 'thumbVisibility'"
date: 2022-01-20
element:
uris: [ 'cupertino.dart' ]
field: 'isAlwaysShown'
inClass: 'CupertinoScrollbar'
changes:
- kind: 'rename'
newName: 'thumbVisibility'

# Changes made in https://github.com/flutter/flutter/pull/96957
- title: "Migrate to 'thumbVisibility'"
date: 2022-01-20
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoScrollbar'
changes:
- kind: 'renameParameter'
oldName: 'isAlwaysShown'
newName: 'thumbVisibility'

# Changes made in https://github.com/flutter/flutter/pull/41859
- title: "Remove 'brightness'"
date: 2020-12-10
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'brightness'

# Changes made in https://github.com/flutter/flutter/pull/41859
- title: "Remove 'brightness'"
date: 2020-12-10
element:
uris: [ 'cupertino.dart' ]
method: 'copyWith'
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'brightness'

# Changes made in https://github.com/flutter/flutter/pull/78588
- title: "Migrate to 'buildOverscrollIndicator'"
date: 2021-03-18
element:
uris: [ 'cupertino.dart' ]
method: 'buildViewportChrome'
inClass: 'CupertinoScrollBehavior'
changes:
- kind: 'rename'
newName: 'buildOverscrollIndicator'

# Before adding a new fix: read instructions at the top of this file.
Loading

0 comments on commit a1432a9

Please sign in to comment.