Skip to content

Commit b308555

Browse files
authored
Enable dangling_library_doc_comments and library_annotations lints (#117365)
1 parent de35764 commit b308555

File tree

516 files changed

+554
-435
lines changed

Some content is hidden

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

516 files changed

+554
-435
lines changed

analysis_options.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ linter:
9595
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
9696
- control_flow_in_finally
9797
- curly_braces_in_flow_control_structures
98-
# - dangling_library_doc_comments # not yet tested
98+
- dangling_library_doc_comments
9999
- depend_on_referenced_packages
100100
- deprecated_consistency
101101
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
@@ -116,7 +116,7 @@ linter:
116116
- iterable_contains_unrelated_type
117117
# - join_return_with_assignment # not required by flutter style
118118
- leading_newlines_in_multiline_strings
119-
# - library_annotations # not yet tested
119+
- library_annotations
120120
- library_names
121121
- library_prefixes
122122
- library_private_types_in_public_api

dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart

+1
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,4 @@
166166
/// error (something about backticks)
167167
/// this must be the last error, since it aborts parsing of this file
168168
/// ```
169+
String? foo;

dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart

+2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
/// ```dart
1212
/// print(x);
1313
/// ```
14+
String? bar;
1415

1516
/// error: empty dart block
1617
/// ```dart
1718
/// ```
19+
String? foo;

dev/bots/test/analyze-test-input/root/packages/foo/golden_doc.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
/// ```
3636
/// {@end-tool}
3737
///
38-
38+
String? foo;
3939
// Other comments
4040
// matchesGoldenFile('comment.png');
4141

dev/bots/test/analyze-test-input/root/packages/foo/golden_ignore.dart

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// flutter_ignore_for_file: golden_tag (see analyze.dart)
77

88
@Tags(<String>['some-other-tag'])
9+
library;
910

1011
import 'package:test/test.dart';
1112

dev/bots/test/analyze-test-input/root/packages/foo/golden_missing_tag.dart

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// The reduced test set tag is missing. This should fail analysis.
66
@Tags(<String>['some-other-tag'])
7+
library;
78

89
import 'package:test/test.dart';
910

dev/bots/test/analyze_snippet_code_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const List<String> expectedMainErrors = <String>[
2929
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:161:7: (top-level declaration) (undefined_identifier)',
3030
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:165: Found "```" in code but it did not match RegExp: pattern=^ */// *```dart\$ flags= so something is wrong. Line was: "/// ```"',
3131
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:9:12: (statement) (invalid_assignment)',
32-
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:17:4: Empty ```dart block in snippet code.',
32+
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:18:4: Empty ```dart block in snippet code.',
3333
];
3434

3535
const List<String> expectedUiErrors = <String>[

dev/bots/unpublish_package.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
65
/// This script removes published archives from the cloud storage and the
76
/// corresponding JSON metadata file that the website uses to determine what
87
/// releases are available.
98
///
109
/// If asked to remove a release that is currently the release on that channel,
1110
/// it will replace that release with the next most recent release on that
1211
/// channel.
12+
library;
1313

1414
import 'dart:async';
1515
import 'dart:convert';

dev/conductor/core/test/codesign_integration_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// This test clones the framework and downloads pre-built binaries; it sometimes
66
// times out with the default 5 minutes: https://github.com/flutter/flutter/issues/100937
77
@Timeout(Duration(minutes: 10))
8+
library;
89

910
import 'package:args/command_runner.dart';
1011
import 'package:conductor_core/src/codesign.dart' show CodesignCommand;

dev/devicelab/bin/tasks/flutter_gallery__back_button_memory.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Measure application memory usage after pausing and resuming the app
6-
/// with the Android back button.
7-
85
import 'package:flutter_devicelab/framework/devices.dart';
96
import 'package:flutter_devicelab/framework/framework.dart';
107
import 'package:flutter_devicelab/framework/utils.dart';
@@ -13,6 +10,8 @@ import 'package:flutter_devicelab/tasks/perf_tests.dart';
1310
const String packageName = 'io.flutter.demo.gallery';
1411
const String activityName = 'io.flutter.demo.gallery.MainActivity';
1512

13+
/// Measure application memory usage after pausing and resuming the app
14+
/// with the Android back button.
1615
class BackButtonMemoryTest extends MemoryTest {
1716
BackButtonMemoryTest() : super('${flutterDirectory.path}/dev/integration_tests/flutter_gallery', 'test_memory/back_button.dart', packageName);
1817

dev/tools/localization/bin/gen_date_localizations.dart

+16-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'dart:async';
6+
import 'dart:convert';
7+
import 'dart:io';
8+
9+
import 'package:path/path.dart' as path;
10+
11+
import '../localizations_utils.dart';
12+
13+
const String _kCommandName = 'gen_date_localizations.dart';
14+
15+
// Used to let _jsonToMap know what locale it's date symbols converting for.
16+
// Date symbols for the Kannada locale ('kn') are handled specially because
17+
// some of the strings contain characters that can crash Emacs on Linux.
18+
// See packages/flutter_localizations/lib/src/l10n/README for more information.
19+
String? currentLocale;
20+
521
/// This program extracts localized date symbols and patterns from the intl
622
/// package for the subset of locales supported by the flutter_localizations
723
/// package.
@@ -25,23 +41,6 @@
2541
/// ```
2642
/// dart dev/tools/localization/bin/gen_date_localizations.dart --overwrite
2743
/// ```
28-
29-
import 'dart:async';
30-
import 'dart:convert';
31-
import 'dart:io';
32-
33-
import 'package:path/path.dart' as path;
34-
35-
import '../localizations_utils.dart';
36-
37-
const String _kCommandName = 'gen_date_localizations.dart';
38-
39-
// Used to let _jsonToMap know what locale it's date symbols converting for.
40-
// Date symbols for the Kannada locale ('kn') are handled specially because
41-
// some of the strings contain characters that can crash Emacs on Linux.
42-
// See packages/flutter_localizations/lib/src/l10n/README for more information.
43-
String? currentLocale;
44-
4544
Future<void> main(List<String> rawArgs) async {
4645
checkCwdIsRepoRoot(_kCommandName);
4746

dev/tools/mega_gallery.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Make `n` copies of flutter_gallery.
6-
75
import 'dart:io';
86

97
import 'package:args/args.dart';
@@ -12,6 +10,7 @@ import 'package:path/path.dart' as path;
1210
/// If no `copies` param is passed in, we scale the generated app up to 60k lines.
1311
const int kTargetLineCount = 60 * 1024;
1412

13+
/// Make `n` copies of flutter_gallery.
1514
void main(List<String> args) {
1615
// If we're run from the `tools` dir, set the cwd to the repo root.
1716
if (path.basename(Directory.current.path) == 'tools') {

examples/api/lib/animation/curves/curve2_d.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [Curve2D].
5+
// Flutter code sample for [Curve2D].
66

77
import 'package:flutter/material.dart';
88

examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoActivityIndicator].
5+
// Flutter code sample for [CupertinoActivityIndicator].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/bottom_tab_bar/cupertino_tab_bar.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoTabBar].
5+
// Flutter code sample for [CupertinoTabBar].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/button/cupertino_button.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoButton].
5+
// Flutter code sample for [CupertinoButton].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoContextMenu].
5+
// Flutter code sample for [CupertinoContextMenu].
66

77
import 'package:flutter/cupertino.dart';
88
import 'package:flutter/material.dart';

examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoContextMenu].
5+
// Flutter code sample for [CupertinoContextMenu].
66

77
import 'package:flutter/cupertino.dart';
88
import 'package:flutter/material.dart';

examples/api/lib/cupertino/date_picker/cupertino_date_picker.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoDatePicker].
5+
// Flutter code sample for [CupertinoDatePicker].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoTimerPicker].
5+
// Flutter code sample for [CupertinoTimerPicker].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/dialog/cupertino_action_sheet.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoActionSheet].
5+
// Flutter code sample for [CupertinoActionSheet].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/dialog/cupertino_alert_dialog.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoAlertDialog].
5+
// Flutter code sample for [CupertinoAlertDialog].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/form_row/cupertino_form_row.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoFormRow].
5+
// Flutter code sample for [CupertinoFormRow].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/list_section/list_section_base.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile].
5+
// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/list_section/list_section_inset.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile].
5+
// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/nav_bar/cupertino_navigation_bar.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoNavigationBar].
5+
// Flutter code sample for [CupertinoNavigationBar].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/nav_bar/cupertino_sliver_nav_bar.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoSliverNavigationBar].
5+
// Flutter code sample for [CupertinoSliverNavigationBar].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/page_scaffold/cupertino_page_scaffold.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoPageScaffold].
5+
// Flutter code sample for [CupertinoPageScaffold].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/picker/cupertino_picker.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoPicker].
5+
// Flutter code sample for [CupertinoPicker].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/refresh/cupertino_sliver_refresh_control.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoSliverRefreshControl].
5+
// Flutter code sample for [CupertinoSliverRefreshControl].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/route/show_cupertino_dialog.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [showCupertinoDialog].
5+
// Flutter code sample for [showCupertinoDialog].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/route/show_cupertino_modal_popup.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [showCupertinoModalPopup].
5+
// Flutter code sample for [showCupertinoModalPopup].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoScrollbar].
5+
// Flutter code sample for [CupertinoScrollbar].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoScrollbar].
5+
// Flutter code sample for [CupertinoScrollbar].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/search_field/cupertino_search_field.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoSearchTextField].
5+
// Flutter code sample for [CupertinoSearchTextField].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/search_field/cupertino_search_field.1.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoSearchTextField].
5+
// Flutter code sample for [CupertinoSearchTextField].
66

77
import 'package:flutter/cupertino.dart';
88

examples/api/lib/cupertino/segmented_control/cupertino_segmented_control.0.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
/// Flutter code sample for [CupertinoSegmentedControl].
5+
// Flutter code sample for [CupertinoSegmentedControl].
66

77
import 'package:flutter/cupertino.dart';
88

0 commit comments

Comments
 (0)