mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The `flutter_analyzer_plugin` implements rules previously enforced by the `dev/bots/analyze.dart` check run on the CI, allowing for earlier detection of custom lint violations before a change is uploaded for review. Currently, the plugin implements the following rules: - avoid_future_catch_error - no_double_clamp - no_stopwatches - protect_public_state_subtypes - render_box_intrinsics Towards https://github.com/flutter/flutter/issues/175276
29 lines
1.0 KiB
Dart
29 lines
1.0 KiB
Dart
// 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.
|
|
|
|
import 'package:analysis_server_plugin/plugin.dart';
|
|
import 'package:analysis_server_plugin/registry.dart';
|
|
import 'src/rules/avoid_future_catch_error.dart';
|
|
import 'src/rules/no_double_clamp.dart';
|
|
import 'src/rules/no_stopwatches.dart';
|
|
import 'src/rules/protect_public_state_subtypes.dart';
|
|
import 'src/rules/render_box_intrinsics.dart';
|
|
|
|
final FlutterAnalyzerPlugin plugin = FlutterAnalyzerPlugin();
|
|
|
|
class FlutterAnalyzerPlugin extends Plugin {
|
|
@override
|
|
void register(PluginRegistry registry) {
|
|
registry
|
|
..registerWarningRule(AvoidFutureCatchError())
|
|
..registerWarningRule(NoDoubleClamp())
|
|
..registerWarningRule(NoStopwatches())
|
|
..registerWarningRule(ProtectPublicStateSubtypes())
|
|
..registerWarningRule(RenderBoxIntrinsicCalculationRule());
|
|
}
|
|
|
|
@override
|
|
String get name => 'flutter/flutter analyzer plugin';
|
|
}
|