Skip to content

Commit

Permalink
Enable dangling_library_doc_comments and library_annotations lint…
Browse files Browse the repository at this point in the history
…s (#117365)
  • Loading branch information
goderbauer authored Dec 21, 2022
1 parent de35764 commit b308555
Show file tree
Hide file tree
Showing 516 changed files with 554 additions and 435 deletions.
4 changes: 2 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ linter:
# - 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
- dangling_library_doc_comments
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
Expand All @@ -116,7 +116,7 @@ linter:
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
# - library_annotations # not yet tested
- library_annotations
- library_names
- library_prefixes
- library_private_types_in_public_api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,4 @@
/// error (something about backticks)
/// this must be the last error, since it aborts parsing of this file
/// ```
String? foo;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
/// ```dart
/// print(x);
/// ```
String? bar;

/// error: empty dart block
/// ```dart
/// ```
String? foo;
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/// ```
/// {@end-tool}
///
String? foo;
// Other comments
// matchesGoldenFile('comment.png');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// flutter_ignore_for_file: golden_tag (see analyze.dart)

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

import 'package:test/test.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

import 'package:test/test.dart';

Expand Down
2 changes: 1 addition & 1 deletion dev/bots/test/analyze_snippet_code_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const List<String> expectedMainErrors = <String>[
'dev/bots/test/analyze-snippet-code-test-input/known_broken_documentation.dart:161:7: (top-level declaration) (undefined_identifier)',
'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: "/// ```"',
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:9:12: (statement) (invalid_assignment)',
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:17:4: Empty ```dart block in snippet code.',
'dev/bots/test/analyze-snippet-code-test-input/short_but_still_broken.dart:18:4: Empty ```dart block in snippet code.',
];

const List<String> expectedUiErrors = <String>[
Expand Down
2 changes: 1 addition & 1 deletion dev/bots/unpublish_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


/// This script removes published archives from the cloud storage and the
/// corresponding JSON metadata file that the website uses to determine what
/// releases are available.
///
/// If asked to remove a release that is currently the release on that channel,
/// it will replace that release with the next most recent release on that
/// channel.
library;

import 'dart:async';
import 'dart:convert';
Expand Down
1 change: 1 addition & 0 deletions dev/conductor/core/test/codesign_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// This test clones the framework and downloads pre-built binaries; it sometimes
// times out with the default 5 minutes: https://github.com/flutter/flutter/issues/100937
@Timeout(Duration(minutes: 10))
library;

import 'package:args/command_runner.dart';
import 'package:conductor_core/src/codesign.dart' show CodesignCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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

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

Expand Down
33 changes: 16 additions & 17 deletions dev/tools/localization/bin/gen_date_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:path/path.dart' as path;

import '../localizations_utils.dart';

const String _kCommandName = 'gen_date_localizations.dart';

// Used to let _jsonToMap know what locale it's date symbols converting for.
// Date symbols for the Kannada locale ('kn') are handled specially because
// some of the strings contain characters that can crash Emacs on Linux.
// See packages/flutter_localizations/lib/src/l10n/README for more information.
String? currentLocale;

/// This program extracts localized date symbols and patterns from the intl
/// package for the subset of locales supported by the flutter_localizations
/// package.
Expand All @@ -25,23 +41,6 @@
/// ```
/// dart dev/tools/localization/bin/gen_date_localizations.dart --overwrite
/// ```
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:path/path.dart' as path;

import '../localizations_utils.dart';

const String _kCommandName = 'gen_date_localizations.dart';

// Used to let _jsonToMap know what locale it's date symbols converting for.
// Date symbols for the Kannada locale ('kn') are handled specially because
// some of the strings contain characters that can crash Emacs on Linux.
// See packages/flutter_localizations/lib/src/l10n/README for more information.
String? currentLocale;

Future<void> main(List<String> rawArgs) async {
checkCwdIsRepoRoot(_kCommandName);

Expand Down
3 changes: 1 addition & 2 deletions dev/tools/mega_gallery.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.

/// Make `n` copies of flutter_gallery.
import 'dart:io';

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

/// Make `n` copies of flutter_gallery.
void main(List<String> args) {
// If we're run from the `tools` dir, set the cwd to the repo root.
if (path.basename(Directory.current.path) == 'tools') {
Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/animation/curves/curve2_d.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [Curve2D].
// Flutter code sample for [Curve2D].

import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoActivityIndicator].
// Flutter code sample for [CupertinoActivityIndicator].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoTabBar].
// Flutter code sample for [CupertinoTabBar].

import 'package:flutter/cupertino.dart';

Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/cupertino/button/cupertino_button.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoButton].
// Flutter code sample for [CupertinoButton].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoContextMenu].
// Flutter code sample for [CupertinoContextMenu].

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoContextMenu].
// Flutter code sample for [CupertinoContextMenu].

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoDatePicker].
// Flutter code sample for [CupertinoDatePicker].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoTimerPicker].
// Flutter code sample for [CupertinoTimerPicker].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoActionSheet].
// Flutter code sample for [CupertinoActionSheet].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoAlertDialog].
// Flutter code sample for [CupertinoAlertDialog].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoFormRow].
// Flutter code sample for [CupertinoFormRow].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile].
// Flutter code sample for base [CupertinoListSection] and [CupertinoListTile].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile].
// Flutter code sample for inset [CupertinoListSection] and [CupertinoListTile].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoNavigationBar].
// Flutter code sample for [CupertinoNavigationBar].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoSliverNavigationBar].
// Flutter code sample for [CupertinoSliverNavigationBar].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoPageScaffold].
// Flutter code sample for [CupertinoPageScaffold].

import 'package:flutter/cupertino.dart';

Expand Down
2 changes: 1 addition & 1 deletion examples/api/lib/cupertino/picker/cupertino_picker.0.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoPicker].
// Flutter code sample for [CupertinoPicker].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoSliverRefreshControl].
// Flutter code sample for [CupertinoSliverRefreshControl].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [showCupertinoDialog].
// Flutter code sample for [showCupertinoDialog].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [showCupertinoModalPopup].
// Flutter code sample for [showCupertinoModalPopup].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoScrollbar].
// Flutter code sample for [CupertinoScrollbar].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoScrollbar].
// Flutter code sample for [CupertinoScrollbar].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoSearchTextField].
// Flutter code sample for [CupertinoSearchTextField].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoSearchTextField].
// Flutter code sample for [CupertinoSearchTextField].

import 'package:flutter/cupertino.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/// Flutter code sample for [CupertinoSegmentedControl].
// Flutter code sample for [CupertinoSegmentedControl].

import 'package:flutter/cupertino.dart';

Expand Down
Loading

0 comments on commit b308555

Please sign in to comment.