[go: nahoru, domu]

Skip to content

Commit

Permalink
Sync analysis_options.yaml & cleanups (flutter#117327)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Dec 20, 2022
1 parent 81bc54b commit fdd2d7d
Show file tree
Hide file tree
Showing 42 changed files with 88 additions and 151 deletions.
8 changes: 8 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ linter:
# - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
- collection_methods_unrelated_type
- combinators_ordering
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
- conditional_uri_does_not_exist
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
- curly_braces_in_flow_control_structures
# - dangling_library_doc_comments # not yet tested
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
Expand All @@ -103,15 +105,18 @@ linter:
- empty_catches
- empty_constructor_bodies
- empty_statements
- enable_null_safety
- eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- implicit_call_tearoffs
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
# - library_annotations # not yet tested
- library_names
- library_prefixes
- library_private_types_in_public_api
Expand Down Expand Up @@ -204,6 +209,7 @@ linter:
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
- unnecessary_late
- unnecessary_library_directive
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
Expand All @@ -218,6 +224,7 @@ linter:
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
Expand All @@ -235,6 +242,7 @@ linter:
- use_rethrow_when_possible
- use_setters_to_change_properties
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
- use_string_in_part_of_directives
- use_super_parameters
- use_test_throws_matchers
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
Expand Down
2 changes: 0 additions & 2 deletions dev/benchmarks/test_apps/stocks/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

library stocks;

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show
debugPaintBaselinesEnabled,
Expand Down
1 change: 1 addition & 0 deletions dev/bots/analyze_snippet_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ class _SnippetChecker {
'// ignore_for_file: directives_ordering',
'// ignore_for_file: prefer_final_locals',
'// ignore_for_file: unnecessary_import',
'// ignore_for_file: unreachable_from_main',
'// ignore_for_file: unused_element',
'// ignore_for_file: unused_local_variable',
];
Expand Down
3 changes: 0 additions & 3 deletions dev/bots/post_process_docs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import 'package:platform/platform.dart' as platform;

import 'package:process/process.dart';

const String kDocsRoot = 'dev/docs';
const String kPublishRoot = '$kDocsRoot/doc';

class CommandException implements Exception {}

Future<void> main() async {
Expand Down
3 changes: 1 addition & 2 deletions dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

// @dart = 2.12

// This is a dummy dart:ui package for the sample code analyzer tests to use.

/// This is a dummy dart:ui package for the sample code analyzer tests to use.
library dart.ui;

/// Bla bla bla bla bla bla bla bla bla.
Expand Down
8 changes: 4 additions & 4 deletions dev/bots/test/analyze_snippet_code_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const List<String> expectedMainErrors = <String>[
];

const List<String> expectedUiErrors = <String>[
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:15:7: (top-level declaration) (prefer_typing_uninitialized_variables)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:15:7: (top-level declaration) (missing_const_final_var_or_type)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:17:20: (top-level declaration) (prefer_final_fields)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:17:20: (top-level declaration) (unused_field)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (prefer_typing_uninitialized_variables)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:14:7: (top-level declaration) (missing_const_final_var_or_type)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (prefer_final_fields)',
'dev/bots/test/analyze-snippet-code-test-dart-ui/ui.dart:16:20: (top-level declaration) (unused_field)',
];

final RegExp errorPrefixRE = RegExp(r'^([-a-z0-9/_.:]+): .*(\([-a-z_ ]+\) \([-a-z_ ]+\))$');
Expand Down
12 changes: 6 additions & 6 deletions dev/devicelab/bin/tasks/plugin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';

Future<void> main() async {
await task(combine(<TaskFunction>[
PluginTest('apk', <String>['-a', 'java', '--platforms=android']),
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android']),
PluginTest('apk', <String>['-a', 'java', '--platforms=android']).call,
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android']).call,
// These create the plugins using the new v2 plugin templates but create the
// apps using the old v1 embedding app templates to make sure new plugins
// are by default backward compatible.
PluginTest('apk', <String>['-a', 'java', '--platforms=android'], pluginCreateEnvironment:
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}),
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}).call,
PluginTest('apk', <String>['-a', 'kotlin', '--platforms=android'], pluginCreateEnvironment:
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}),
<String, String>{'ENABLE_ANDROID_EMBEDDING_V2': 'true'}).call,
// Test that Dart-only plugins are supported.
PluginTest('apk', <String>['--platforms=android'], dartOnlyPlugin: true),
PluginTest('apk', <String>['--platforms=android'], dartOnlyPlugin: true).call,
// Test that FFI plugins are supported.
PluginTest('apk', <String>['--platforms=android'], template: 'plugin_ffi'),
PluginTest('apk', <String>['--platforms=android'], template: 'plugin_ffi').call,
]));
}
14 changes: 7 additions & 7 deletions dev/devicelab/bin/tasks/plugin_test_ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import 'package:flutter_devicelab/tasks/plugin_tests.dart';

Future<void> main() async {
await task(combine(<TaskFunction>[
PluginTest('ios', <String>['-i', 'objc', '--platforms=ios']),
PluginTest('ios', <String>['-i', 'swift', '--platforms=ios']),
PluginTest('macos', <String>['--platforms=macos']),
PluginTest('ios', <String>['-i', 'objc', '--platforms=ios']).call,
PluginTest('ios', <String>['-i', 'swift', '--platforms=ios']).call,
PluginTest('macos', <String>['--platforms=macos']).call,
// Test that Dart-only plugins are supported.
PluginTest('ios', <String>['--platforms=ios'], dartOnlyPlugin: true),
PluginTest('macos', <String>['--platforms=macos'], dartOnlyPlugin: true),
PluginTest('ios', <String>['--platforms=ios'], dartOnlyPlugin: true).call,
PluginTest('macos', <String>['--platforms=macos'], dartOnlyPlugin: true).call,
// Test that FFI plugins are supported.
PluginTest('ios', <String>['--platforms=ios'], template: 'plugin_ffi'),
PluginTest('macos', <String>['--platforms=macos'], template: 'plugin_ffi'),
PluginTest('ios', <String>['--platforms=ios'], template: 'plugin_ffi').call,
PluginTest('macos', <String>['--platforms=macos'], template: 'plugin_ffi').call,
]));
}
2 changes: 1 addition & 1 deletion dev/devicelab/bin/tasks/smoke_test_build_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:flutter_devicelab/tasks/build_test_task.dart';
/// Smoke test of a successful task.
Future<void> main(List<String> args) async {
deviceOperatingSystem = DeviceOperatingSystem.fake;
await task(FakeBuildTestTask(args));
await task(FakeBuildTestTask(args).call);
}

class FakeBuildTestTask extends BuildTestTask {
Expand Down
12 changes: 6 additions & 6 deletions dev/devicelab/lib/tasks/gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ final Directory galleryDirectory = dir('${flutterDirectory.path}/dev/integration
///
/// https://github.com/flutter/flutter/issues/103542
TaskFunction createGalleryTransitionBuildTest(List<String> args, {bool semanticsEnabled = false}) {
return GalleryTransitionBuildTest(args, semanticsEnabled: semanticsEnabled);
return GalleryTransitionBuildTest(args, semanticsEnabled: semanticsEnabled).call;
}

TaskFunction createGalleryTransitionTest({bool semanticsEnabled = false}) {
return GalleryTransitionTest(semanticsEnabled: semanticsEnabled);
return GalleryTransitionTest(semanticsEnabled: semanticsEnabled).call;
}

TaskFunction createGalleryTransitionE2EBuildTest(
Expand All @@ -39,7 +39,7 @@ TaskFunction createGalleryTransitionE2EBuildTest(
timelineTraceFile: null,
driverFile: 'transitions_perf_e2e_test',
enableImpeller: enableImpeller,
);
).call;
}

TaskFunction createGalleryTransitionE2ETest({
Expand All @@ -56,7 +56,7 @@ TaskFunction createGalleryTransitionE2ETest({
timelineTraceFile: null,
driverFile: 'transitions_perf_e2e_test',
enableImpeller: enableImpeller,
);
).call;
}

TaskFunction createGalleryTransitionHybridBuildTest(
Expand All @@ -67,7 +67,7 @@ TaskFunction createGalleryTransitionHybridBuildTest(
args,
semanticsEnabled: semanticsEnabled,
driverFile: semanticsEnabled ? 'transitions_perf_hybrid_with_semantics_test' : 'transitions_perf_hybrid_test',
);
).call;
}

TaskFunction createGalleryTransitionHybridTest({bool semanticsEnabled = false}) {
Expand All @@ -76,7 +76,7 @@ TaskFunction createGalleryTransitionHybridTest({bool semanticsEnabled = false})
driverFile: semanticsEnabled
? 'transitions_perf_hybrid_with_semantics_test'
: 'transitions_perf_hybrid_test',
);
).call;
}

class GalleryTransitionTest {
Expand Down
40 changes: 20 additions & 20 deletions dev/devicelab/lib/tasks/integration_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,73 +11,73 @@ TaskFunction createChannelsIntegrationTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/channels',
'lib/main.dart',
);
).call;
}

TaskFunction createPlatformInteractionTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/platform_interaction',
'lib/main.dart',
);
).call;
}

TaskFunction createFlavorsTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'lib/main.dart',
extraOptions: <String>['--flavor', 'paid'],
);
).call;
}

TaskFunction createIntegrationTestFlavorsTest() {
return IntegrationTest(
'${flutterDirectory.path}/dev/integration_tests/flavors',
'integration_test/integration_test.dart',
extraOptions: <String>['--flavor', 'paid'],
);
).call;
}

TaskFunction createExternalUiIntegrationTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/external_ui',
'lib/main.dart',
);
).call;
}

TaskFunction createPlatformChannelSampleTest({String? deviceIdOverride}) {
return DriverTest(
'${flutterDirectory.path}/examples/platform_channel',
'test_driver/button_tap.dart',
deviceIdOverride: deviceIdOverride,
);
).call;
}

TaskFunction createPlatformChannelSwiftSampleTest() {
return DriverTest(
'${flutterDirectory.path}/examples/platform_channel_swift',
'test_driver/button_tap.dart',
);
).call;
}

TaskFunction createEmbeddedAndroidViewsIntegrationTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/android_views',
'lib/main.dart',
);
).call;
}

TaskFunction createHybridAndroidViewsIntegrationTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/hybrid_android_views',
'lib/main.dart',
);
).call;
}

TaskFunction createAndroidSemanticsIntegrationTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/android_semantics_testing',
'lib/main.dart',
);
).call;
}

TaskFunction createIOSPlatformViewTests() {
Expand All @@ -87,42 +87,42 @@ TaskFunction createIOSPlatformViewTests() {
extraOptions: <String>[
'--dart-define=ENABLE_DRIVER_EXTENSION=true',
],
);
).call;
}

TaskFunction createEndToEndKeyboardTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/keyboard_resize.dart',
);
).call;
}

TaskFunction createEndToEndFrameNumberTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/frame_number.dart',
);
).call;
}

TaskFunction createEndToEndDriverTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/driver.dart',
);
).call;
}

TaskFunction createEndToEndScreenshotTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/screenshot.dart',
);
).call;
}

TaskFunction createEndToEndKeyboardTextfieldTest() {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'lib/keyboard_textfield.dart',
);
).call;
}

TaskFunction dartDefinesTask() {
Expand All @@ -132,29 +132,29 @@ TaskFunction dartDefinesTask() {
'--dart-define=test.valueA=Example,A',
'--dart-define=test.valueB=Value',
],
);
).call;
}

TaskFunction createEndToEndIntegrationTest() {
return IntegrationTest(
'${flutterDirectory.path}/dev/integration_tests/ui',
'integration_test/integration_test.dart',
);
).call;
}

TaskFunction createSpellCheckIntegrationTest() {
return IntegrationTest(
'${flutterDirectory.path}/dev/integration_tests/spell_check',
'integration_test/integration_test.dart',
);
).call;
}

TaskFunction createWindowsStartupDriverTest({String? deviceIdOverride}) {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/windows_startup_test',
'lib/main.dart',
deviceIdOverride: deviceIdOverride,
);
).call;
}

class DriverTest {
Expand Down
Loading

0 comments on commit fdd2d7d

Please sign in to comment.