diff --git a/analysis_options.yaml b/analysis_options.yaml index 4fc319eb15..2af0e96ef0 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -8,72 +8,77 @@ analyzer: # https://dart.dev/lints linter: rules: - - always_declare_return_types - - annotate_overrides - - avoid_empty_else - - avoid_init_to_null - - avoid_null_checks_in_equality_operators - - avoid_relative_lib_imports - - avoid_return_types_on_setters - - avoid_shadowing_type_parameters - - avoid_types_as_parameter_names - - await_only_futures - - camel_case_extensions - - camel_case_types - - cancel_subscriptions - - close_sinks - - collection_methods_unrelated_type - - comment_references - - constant_identifier_names - - control_flow_in_finally - - curly_braces_in_flow_control_structures - - directives_ordering - - empty_catches - - empty_constructor_bodies - - empty_statements - - hash_and_equals - - implementation_imports - - library_names - - library_prefixes - - literal_only_boolean_expressions - - no_duplicate_case_values - - non_constant_identifier_names - - null_closures - #- omit_local_variable_types - - one_member_abstracts - - only_throw_errors - - overridden_fields - - package_names - - package_prefixed_library_names - - prefer_adjacent_string_concatenation - - prefer_collection_literals - - prefer_conditional_assignment - - prefer_contains - - prefer_final_fields - - prefer_final_locals - - prefer_for_elements_to_map_fromIterable - - prefer_generic_function_type_aliases - - prefer_if_null_operators - - prefer_is_empty - - prefer_is_not_empty - - prefer_iterable_whereType - - prefer_null_aware_operators - - prefer_single_quotes - - prefer_spread_collections - - prefer_typing_uninitialized_variables - - recursive_getters - - slash_for_doc_comments - - test_types_in_equals - - throw_in_finally - - type_init_formals - - unawaited_futures - - unnecessary_brace_in_string_interps - - unnecessary_const - - unnecessary_getters_setters - - unnecessary_new - - unnecessary_null_in_if_null_operators - - unnecessary_this - - unrelated_type_equality_checks - - use_function_type_syntax_for_parameters - - use_rethrow_when_possible - - valid_regexps + - always_declare_return_types + - annotate_overrides + - avoid_empty_else + - avoid_init_to_null + - avoid_null_checks_in_equality_operators + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names + - await_only_futures + - camel_case_extensions + - camel_case_types + - cancel_subscriptions + - close_sinks + - collection_methods_unrelated_type + - comment_references + - constant_identifier_names + - control_flow_in_finally + - curly_braces_in_flow_control_structures + - dangling_library_doc_comments + - directives_ordering + - empty_catches + - empty_constructor_bodies + - empty_statements + - hash_and_equals + - implementation_imports + - library_annotations + - library_names + - library_prefixes + - literal_only_boolean_expressions + - no_duplicate_case_values + - non_constant_identifier_names + - null_closures + #- omit_local_variable_types + - one_member_abstracts + - only_throw_errors + - overridden_fields + - package_names + - package_prefixed_library_names + - prefer_adjacent_string_concatenation + - prefer_collection_literals + - prefer_conditional_assignment + - prefer_contains + - prefer_final_fields + - prefer_final_locals + - prefer_for_elements_to_map_fromIterable + - prefer_generic_function_type_aliases + - prefer_if_null_operators + - prefer_is_empty + - prefer_is_not_empty + - prefer_iterable_whereType + - prefer_null_aware_operators + - prefer_single_quotes + - prefer_spread_collections + - prefer_typing_uninitialized_variables + - recursive_getters + - slash_for_doc_comments + - test_types_in_equals + - throw_in_finally + - type_init_formals + - unawaited_futures + - unnecessary_brace_in_string_interps + - unnecessary_const + - unnecessary_getters_setters + - unnecessary_library_name + - unnecessary_library_directive + - unnecessary_new + - unnecessary_null_in_if_null_operators + - unnecessary_this + - unrelated_type_equality_checks + - use_function_type_syntax_for_parameters + - use_rethrow_when_possible + - use_string_in_part_of_directives + - valid_regexps diff --git a/app/lib/account/session_cookie.dart b/app/lib/account/session_cookie.dart index 84ade8f213..8a503e2baf 100644 --- a/app/lib/account/session_cookie.dart +++ b/app/lib/account/session_cookie.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Logic to do with session cookie parsing and reading. -library session_cookie; +library; import 'dart:io' show HttpHeaders; diff --git a/app/lib/admin/tools/recent_uploaders.dart b/app/lib/admin/tools/recent_uploaders.dart index 9b63833c52..060affa369 100644 --- a/app/lib/admin/tools/recent_uploaders.dart +++ b/app/lib/admin/tools/recent_uploaders.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Creates a report about recent uploaders. +library; import 'dart:async'; import 'dart:convert'; diff --git a/app/lib/frontend/handlers.dart b/app/lib/frontend/handlers.dart index 98b33aeee6..cef03d9126 100644 --- a/app/lib/frontend/handlers.dart +++ b/app/lib/frontend/handlers.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.handlers; - import 'package:logging/logging.dart'; import 'package:shelf/shelf.dart' as shelf; import 'package:shelf_router/shelf_router.dart'; diff --git a/app/lib/frontend/handlers/atom_feed.dart b/app/lib/frontend/handlers/atom_feed.dart index d64793d0ea..07ef7da69d 100644 --- a/app/lib/frontend/handlers/atom_feed.dart +++ b/app/lib/frontend/handlers/atom_feed.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.atom_feed; - import 'dart:async'; import 'dart:convert'; diff --git a/app/lib/frontend/handlers/redirects.dart b/app/lib/frontend/handlers/redirects.dart index e353771145..4e75ce0de5 100644 --- a/app/lib/frontend/handlers/redirects.dart +++ b/app/lib/frontend/handlers/redirects.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.handlers_redirects; - import 'package:shelf/shelf.dart'; import 'package:shelf_router/shelf_router.dart'; diff --git a/app/lib/package/backend.dart b/app/lib/package/backend.dart index 60264070ea..03d65468e8 100644 --- a/app/lib/package/backend.dart +++ b/app/lib/package/backend.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.backend; - import 'dart:async'; import 'dart:io'; diff --git a/app/lib/package/model_properties.dart b/app/lib/package/model_properties.dart index 2223808078..5a148c5114 100644 --- a/app/lib/package/model_properties.dart +++ b/app/lib/package/model_properties.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.model_properties; - import 'dart:convert'; import 'package:pana/pana.dart' show SdkConstraintStatus; diff --git a/app/lib/package/models.dart b/app/lib/package/models.dart index 16b07ae000..83683e42f9 100644 --- a/app/lib/package/models.dart +++ b/app/lib/package/models.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.appengine_repository.models; - import 'dart:convert'; import 'package:_pub_shared/data/package_api.dart'; diff --git a/app/lib/package/upload_signer_service.dart b/app/lib/package/upload_signer_service.dart index aa0384b1e0..2e20417087 100644 --- a/app/lib/package/upload_signer_service.dart +++ b/app/lib/package/upload_signer_service.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.upload_signer_service; - import 'dart:async'; import 'dart:convert'; diff --git a/app/lib/service/openid/asn1_encoder.dart b/app/lib/service/openid/asn1_encoder.dart index d7f0086b14..12cce87c81 100644 --- a/app/lib/service/openid/asn1_encoder.dart +++ b/app/lib/service/openid/asn1_encoder.dart @@ -8,6 +8,7 @@ /// - https://pub.dev/packages/asn1lib /// - https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/ /// - https://lapo.it/asn1js/ +library; import 'package:meta/meta.dart'; diff --git a/app/lib/shared/exceptions.dart b/app/lib/shared/exceptions.dart index 26a07e5539..08f661e72a 100644 --- a/app/lib/shared/exceptions.dart +++ b/app/lib/shared/exceptions.dart @@ -11,7 +11,7 @@ /// /// All messages may contain markdown, and should be sensible for human /// consumption. -library exceptions; +library; import 'dart:io'; diff --git a/app/lib/shared/utils.dart b/app/lib/shared/utils.dart index 20f64f62f7..937204d26d 100644 --- a/app/lib/shared/utils.dart +++ b/app/lib/shared/utils.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.utils; - import 'dart:async'; import 'dart:collection'; import 'dart:convert'; diff --git a/app/test/ensure_all_pub_get_is_clean_test.dart b/app/test/ensure_all_pub_get_is_clean_test.dart index ba1f2a172a..7fe9007d79 100644 --- a/app/test/ensure_all_pub_get_is_clean_test.dart +++ b/app/test/ensure_all_pub_get_is_clean_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. @Tags(['build']) +library; import 'dart:io'; diff --git a/app/test/ensure_build_test.dart b/app/test/ensure_build_test.dart index e78c419928..b200b3c109 100644 --- a/app/test/ensure_build_test.dart +++ b/app/test/ensure_build_test.dart @@ -4,6 +4,7 @@ @Timeout.factor(2) @Tags(['build', 'presubmit-only']) +library; import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/app/test/frontend/handlers/_utils.dart b/app/test/frontend/handlers/_utils.dart index 4ef1722e1c..e63498992f 100644 --- a/app/test/frontend/handlers/_utils.dart +++ b/app/test/frontend/handlers/_utils.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.frontend.handlers_test; - import 'dart:async'; import 'dart:convert'; diff --git a/app/test/package/backend_test.dart b/app/test/package/backend_test.dart index c39008c23e..12d5a76986 100644 --- a/app/test/package/backend_test.dart +++ b/app/test/package/backend_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. @Timeout(Duration(seconds: 15)) -library pub_dartlang_org.backend_test; +library; import 'dart:async'; diff --git a/app/test/package/backend_test_utils.dart b/app/test/package/backend_test_utils.dart index a84f599041..cc6b03e9b6 100644 --- a/app/test/package/backend_test_utils.dart +++ b/app/test/package/backend_test_utils.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.backend_test_utils; - import 'dart:async'; import 'dart:io'; diff --git a/app/test/package/tarball_storage_namer_test.dart b/app/test/package/tarball_storage_namer_test.dart index 7b237a808b..b063dd4f39 100644 --- a/app/test/package/tarball_storage_namer_test.dart +++ b/app/test/package/tarball_storage_namer_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library pub_dartlang_org.tarball_storage_namer_test; - import 'package:gcloud/storage.dart'; import 'package:pub_dev/package/backend.dart'; import 'package:pub_dev/shared/configuration.dart'; diff --git a/app/test/service/openid/github_actions_id_token_test.dart b/app/test/service/openid/github_actions_id_token_test.dart index 67b3dfa226..9dcd073fcf 100644 --- a/app/test/service/openid/github_actions_id_token_test.dart +++ b/app/test/service/openid/github_actions_id_token_test.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. @Tags(['presubmit-only']) +library; + import 'dart:convert'; import 'dart:io'; diff --git a/app/test/task/cloudcompute/googlecloudcompute_test.dart b/app/test/task/cloudcompute/googlecloudcompute_test.dart index 7cf6062a12..129a8a791d 100644 --- a/app/test/task/cloudcompute/googlecloudcompute_test.dart +++ b/app/test/task/cloudcompute/googlecloudcompute_test.dart @@ -6,6 +6,8 @@ // slow, and something that could throw all sorts of exceptions, we don't want // run this as part of normal testing. @Tags(['fragile']) +library; + import 'dart:async'; import 'package:appengine/appengine.dart'; diff --git a/pkg/_popularity/lib/popularity.dart b/pkg/_popularity/lib/popularity.dart index afd3c1f7c5..3461e75dd7 100644 --- a/pkg/_popularity/lib/popularity.dart +++ b/pkg/_popularity/lib/popularity.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -library package_popularity; - import 'package:json_annotation/json_annotation.dart'; part 'popularity.g.dart'; diff --git a/pkg/_popularity/test/ensure_build_test.dart b/pkg/_popularity/test/ensure_build_test.dart index db2e9a871c..722af37222 100644 --- a/pkg/_popularity/test/ensure_build_test.dart +++ b/pkg/_popularity/test/ensure_build_test.dart @@ -4,6 +4,7 @@ @Timeout.factor(2) @Tags(['presubmit-only']) +library; import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/pkg/_pub_shared/test/ensure_build_test.dart b/pkg/_pub_shared/test/ensure_build_test.dart index 0a833a516e..6865c27ea4 100644 --- a/pkg/_pub_shared/test/ensure_build_test.dart +++ b/pkg/_pub_shared/test/ensure_build_test.dart @@ -4,6 +4,7 @@ @Timeout.factor(2) @Tags(['presubmit-only']) +library; import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart'; diff --git a/pkg/api_builder/lib/_client_utils.dart b/pkg/api_builder/lib/_client_utils.dart index 417390b1e2..4ee9a07284 100644 --- a/pkg/api_builder/lib/_client_utils.dart +++ b/pkg/api_builder/lib/_client_utils.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Utilities for use in generated client code. -library client_utils; +library; import 'dart:async'; import 'dart:convert'; diff --git a/pkg/indexed_blob/lib/indexed_blob.dart b/pkg/indexed_blob/lib/indexed_blob.dart index 1e699713e1..f3a485ba55 100644 --- a/pkg/indexed_blob/lib/indexed_blob.dart +++ b/pkg/indexed_blob/lib/indexed_blob.dart @@ -2,8 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -/// The `indexed_blob` library provides support for reading and writing -/// indexed-blobs. +/// The `indexed_blob.dart` library provides support for +/// reading and writing indexed-blobs. /// /// An _indexed blob_ is a blob-file and an index-file pointing into the blob. /// The index-file can be used to find _start_ and _end_ offset for a file @@ -16,7 +16,7 @@ /// /// To goal of this format is to support storing the many small files generated /// by `dartdoc` as an indexed-blob. -library indexed_blob; +library; import 'dart:async'; import 'dart:convert' show utf8; diff --git a/pkg/pub_worker/lib/src/testing/server.dart b/pkg/pub_worker/lib/src/testing/server.dart index 73b2184c0d..8efee3018a 100644 --- a/pkg/pub_worker/lib/src/testing/server.dart +++ b/pkg/pub_worker/lib/src/testing/server.dart @@ -1,5 +1,5 @@ -/// A test server for pub_worker -library server; +/// A test server for pub_worker. +library; import 'dart:async'; import 'dart:convert';