Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Migrate from pedantic to flutter_lints and fix TODOs (#571)
Browse files Browse the repository at this point in the history
* Migrate from pedantic to flutter_lints and fix TODOs

* Update benchmarks_test.dart
  • Loading branch information
guidezpl authored Dec 10, 2021
1 parent fb5d1f2 commit 5e64e83
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 36 deletions.
19 changes: 8 additions & 11 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
include: package:pedantic/analysis_options.1.11.0.yaml
# To see flutter_lints, uncomment this line instead
# include: package:flutter_lints/flutter.yaml
include: package:flutter_lints/flutter.yaml

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false

linter:
# In addition to the pedantic lints
# In addition to the flutter_lints
rules:
- always_declare_return_types
- avoid_types_on_closure_parameters
- avoid_void_async
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- directives_ordering
- empty_statements
- flutter_style_todos
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_const_constructors
- prefer_const_literals_to_create_immutables
- prefer_single_quotes
- sort_child_properties_last
- test_types_in_equals
- throw_in_finally
- unawaited_futures
- unnecessary_statements
- unsafe_html
3 changes: 2 additions & 1 deletion lib/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class _SettingsPageState extends State<SettingsPage> {
/// native name can't be determined, it is omitted. If the locale can't be
/// determined, the locale code is used.
DisplayOption _getLocaleDisplayOption(BuildContext context, Locale locale) {
// TODO: gsw, fil, and es_419 aren't in flutter_localized_countries' dataset
final localeCode = locale.toString();
final localeName = LocaleNames.of(context).nameOf(localeCode);
if (localeName != null) {
Expand All @@ -93,6 +92,8 @@ class _SettingsPageState extends State<SettingsPage> {
? DisplayOption(localeNativeName, subtitle: localeName)
: DisplayOption(localeName);
} else {
// gsw, fil, and es_419 aren't in flutter_localized_countries' dataset
// so we handle them separately
switch (localeCode) {
case 'gsw':
return DisplayOption('Schwiizertüütsch', subtitle: 'Swiss German');
Expand Down
5 changes: 1 addition & 4 deletions lib/studies/rally/finance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ class FinancialEntityCategoryView extends StatelessWidget {
label: semanticsLabel,
),
excludeSemantics: true,
// TODO(shihaohong): State restoration of
// FinancialEntityCategoryDetailsPage on mobile is blocked because
// OpenContainer does not support restorablePush.
// See https://github.com/flutter/flutter/issues/69924.
// TODO(x): State restoration of FinancialEntityCategoryDetailsPage on mobile is blocked because OpenContainer does not support restorablePush, https://github.com/flutter/gallery/issues/570.
child: OpenContainer(
transitionDuration: const Duration(milliseconds: 350),
transitionType: ContainerTransitionType.fade,
Expand Down
4 changes: 1 addition & 3 deletions lib/studies/reply/adaptive_nav.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1219,9 +1219,7 @@ class _ReplyFabState extends State<_ReplyFab>
),
);
} else {
// TODO(shihaohong): State restoration of compose page on mobile is
// blocked because OpenContainer does not support restorablePush.
// See https://github.com/flutter/flutter/issues/69924.
// TODO(x): State restoration of compose page on mobile is blocked because OpenContainer does not support restorablePush, https://github.com/flutter/gallery/issues/570.
return OpenContainer(
openBuilder: (context, closedContainer) {
return const ComposePage();
Expand Down
4 changes: 1 addition & 3 deletions lib/studies/reply/mail_card_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class MailPreviewCard extends StatelessWidget {
Widget build(BuildContext context) {
final theme = Theme.of(context);

// TODO(shihaohong): State restoration of mail view page is
// blocked because OpenContainer does not support restorablePush.
// See https://github.com/flutter/flutter/issues/69924.
// TODO(x): State restoration of mail view page is blocked because OpenContainer does not support restorablePush, https://github.com/flutter/gallery/issues/570.
return OpenContainer(
openBuilder: (context, closedContainer) {
return MailViewPage(id: id, email: email);
Expand Down
11 changes: 2 additions & 9 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -430,20 +430,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -742,7 +735,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "7.3.0"
version: "7.5.0"
watcher:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dev_dependencies:
flutter_lints: ^1.0.2
grinder: ^0.9.0
path: ^1.8.0
pedantic: ^1.11.0
string_scanner: ^1.1.0
test: ^1.16.8
web_benchmarks: ^0.0.5
Expand Down
3 changes: 2 additions & 1 deletion test/restoration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void main() {
variant: const TargetPlatformVariant(
<TargetPlatform>{TargetPlatform.android},
),
skip: true, // TODO: Investigate why Inbox tap is failing. In App it works.
skip: true,
// TODO(x): State restoration test is failing at Inbox tap is failing, but works in App, https://github.com/flutter/gallery/issues/570.
);
}
2 changes: 0 additions & 2 deletions test_benchmarks/benchmarks/scroll.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ Future<void> scrollUntilVisible({

double pixelsToBeMoved;
switch (scrollable.axisDirection) {
/* TODO for the future:
add support for other directions and other alignment policies. */
case AxisDirection.down:
pixelsToBeMoved = elementRect.top - visibleWindow.top;
break;
Expand Down
2 changes: 1 addition & 1 deletion test_benchmarks/benchmarks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Future<void> main() async {
test('Can run a web benchmark', () async {
stdout.writeln('Starting web benchmark tests ...');

// TODO: re-enable this test (https://github.com/flutter/gallery/issues/463)
// TODO(pennzht): Re-enable this test, https://github.com/flutter/gallery/issues/463.
return;
// ignore: dead_code
final taskResult = await serveWebBenchmark(
Expand Down

0 comments on commit 5e64e83

Please sign in to comment.