From 5dca10ea324bb19f104126d72472280091829873 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Fri, 17 Nov 2023 15:24:31 +0100 Subject: [PATCH] [style] Enable `dangling_library_doc_comments` lint (#809) It looks like the pub scoring system enforces a new lint: https://pub.dev/packages/ffigen/score --- pkgs/ffigen/analysis_options.yaml | 5 +++-- pkgs/ffigen/lib/src/config_provider/config.dart | 3 ++- pkgs/ffigen/lib/src/config_provider/config_types.dart | 2 ++ pkgs/ffigen/lib/src/config_provider/path_finder.dart | 1 + pkgs/ffigen/lib/src/header_parser/includer.dart | 1 + .../lib/src/header_parser/type_extractor/extractor.dart | 2 ++ pkgs/ffigen/test/native_test/build_test_dylib.dart | 1 + pkgs/jni/analysis_options.yaml | 1 + pkgs/jni/example/analysis_options.yaml | 2 +- pkgs/jnigen/analysis_options.yaml | 1 + pkgs/jnigen/android_test_runner/analysis_options.yaml | 2 +- pkgs/jnigen/example/in_app_java/analysis_options.yaml | 2 +- .../notification_plugin/example/analysis_options.yaml | 2 +- .../example/pdfbox_plugin/dart_example/analysis_options.yaml | 5 +++-- .../example/pdfbox_plugin/example/analysis_options.yaml | 2 +- pkgs/native_assets_builder/analysis_options.yaml | 1 + pkgs/native_assets_cli/analysis_options.yaml | 1 + pkgs/native_toolchain_c/analysis_options.yaml | 1 + 18 files changed, 25 insertions(+), 10 deletions(-) diff --git a/pkgs/ffigen/analysis_options.yaml b/pkgs/ffigen/analysis_options.yaml index 8c036c9a8..80574fd0f 100644 --- a/pkgs/ffigen/analysis_options.yaml +++ b/pkgs/ffigen/analysis_options.yaml @@ -8,7 +8,7 @@ analyzer: exclude: - 'test/**_expected*' # Goldens cannot be generated outside MacOS causing analysis errors. - - test/native_objc_test/** + - test/native_objc_test/** language: strict-casts: true strict-inference: true @@ -16,10 +16,11 @@ analyzer: linter: rules: # Enabled. + dangling_library_doc_comments: true directives_ordering: true prefer_final_locals: true prefer_final_in_for_each: true use_super_parameters: true - + # Disabled. constant_identifier_names: false diff --git a/pkgs/ffigen/lib/src/config_provider/config.dart b/pkgs/ffigen/lib/src/config_provider/config.dart index 5109a0c80..d47e30e92 100644 --- a/pkgs/ffigen/lib/src/config_provider/config.dart +++ b/pkgs/ffigen/lib/src/config_provider/config.dart @@ -2,7 +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. -/// Validates the yaml input by the user, prints useful info for the user +/// Validates the yaml input by the user, prints useful info for the user. +library; import 'dart:io'; diff --git a/pkgs/ffigen/lib/src/config_provider/config_types.dart b/pkgs/ffigen/lib/src/config_provider/config_types.dart index a4cf1426f..ce6805122 100644 --- a/pkgs/ffigen/lib/src/config_provider/config_types.dart +++ b/pkgs/ffigen/lib/src/config_provider/config_types.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. /// Contains all the neccesary classes required by config. +library; + import 'dart:io'; import 'package:ffigen/src/code_generator.dart'; diff --git a/pkgs/ffigen/lib/src/config_provider/path_finder.dart b/pkgs/ffigen/lib/src/config_provider/path_finder.dart index 715e1ac1e..51044103b 100644 --- a/pkgs/ffigen/lib/src/config_provider/path_finder.dart +++ b/pkgs/ffigen/lib/src/config_provider/path_finder.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. /// Utils for finding header paths on system. +library; import 'dart:io'; diff --git a/pkgs/ffigen/lib/src/header_parser/includer.dart b/pkgs/ffigen/lib/src/header_parser/includer.dart index 5e55aa2fb..ebb7d3d59 100644 --- a/pkgs/ffigen/lib/src/header_parser/includer.dart +++ b/pkgs/ffigen/lib/src/header_parser/includer.dart @@ -4,6 +4,7 @@ /// Utility functions to check whether a binding should be parsed or not /// based on filters. +library; import '../config_provider/config_types.dart'; import '../strings.dart' as strings; diff --git a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart index 311c1e8b4..5eb7a0259 100644 --- a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart +++ b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. /// Extracts code_gen Type from type. +library; + import 'package:ffigen/src/code_generator.dart'; import 'package:ffigen/src/header_parser/sub_parsers/function_type_param_parser.dart'; import 'package:ffigen/src/header_parser/sub_parsers/typedefdecl_parser.dart'; diff --git a/pkgs/ffigen/test/native_test/build_test_dylib.dart b/pkgs/ffigen/test/native_test/build_test_dylib.dart index a41f6863b..0eb956858 100644 --- a/pkgs/ffigen/test/native_test/build_test_dylib.dart +++ b/pkgs/ffigen/test/native_test/build_test_dylib.dart @@ -25,6 +25,7 @@ /// ======================================================================= /// ======================================================================= /// ======================================================================= +library; import 'dart:io'; diff --git a/pkgs/jni/analysis_options.yaml b/pkgs/jni/analysis_options.yaml index e591be846..5c89b5804 100644 --- a/pkgs/jni/analysis_options.yaml +++ b/pkgs/jni/analysis_options.yaml @@ -7,6 +7,7 @@ analyzer: linter: rules: + - dangling_library_doc_comments - prefer_final_locals - prefer_const_declarations # Additional information about this file can be found at diff --git a/pkgs/jni/example/analysis_options.yaml b/pkgs/jni/example/analysis_options.yaml index 7f0b15f4f..6d1a072f5 100644 --- a/pkgs/jni/example/analysis_options.yaml +++ b/pkgs/jni/example/analysis_options.yaml @@ -27,10 +27,10 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + - dangling_library_doc_comments - prefer_final_locals - prefer_const_declarations # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/pkgs/jnigen/analysis_options.yaml b/pkgs/jnigen/analysis_options.yaml index 4bebf0eb6..b32c3d098 100644 --- a/pkgs/jnigen/analysis_options.yaml +++ b/pkgs/jnigen/analysis_options.yaml @@ -12,6 +12,7 @@ analyzer: linter: rules: + - dangling_library_doc_comments - prefer_final_locals - prefer_const_declarations - unawaited_futures diff --git a/pkgs/jnigen/android_test_runner/analysis_options.yaml b/pkgs/jnigen/android_test_runner/analysis_options.yaml index 61b6c4de1..ca60bc685 100644 --- a/pkgs/jnigen/android_test_runner/analysis_options.yaml +++ b/pkgs/jnigen/android_test_runner/analysis_options.yaml @@ -22,8 +22,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + - dangling_library_doc_comments # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/pkgs/jnigen/example/in_app_java/analysis_options.yaml b/pkgs/jnigen/example/in_app_java/analysis_options.yaml index 61b6c4de1..ca60bc685 100644 --- a/pkgs/jnigen/example/in_app_java/analysis_options.yaml +++ b/pkgs/jnigen/example/in_app_java/analysis_options.yaml @@ -22,8 +22,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + - dangling_library_doc_comments # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/pkgs/jnigen/example/notification_plugin/example/analysis_options.yaml b/pkgs/jnigen/example/notification_plugin/example/analysis_options.yaml index 61b6c4de1..ca60bc685 100644 --- a/pkgs/jnigen/example/notification_plugin/example/analysis_options.yaml +++ b/pkgs/jnigen/example/notification_plugin/example/analysis_options.yaml @@ -22,8 +22,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + - dangling_library_doc_comments # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/pkgs/jnigen/example/pdfbox_plugin/dart_example/analysis_options.yaml b/pkgs/jnigen/example/pdfbox_plugin/dart_example/analysis_options.yaml index dee8927aa..17d13a8f7 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/dart_example/analysis_options.yaml +++ b/pkgs/jnigen/example/pdfbox_plugin/dart_example/analysis_options.yaml @@ -15,8 +15,9 @@ include: package:lints/recommended.yaml # Uncomment the following section to specify additional rules. -# linter: -# rules: +linter: + rules: + - dangling_library_doc_comments # - camel_case_types # analyzer: diff --git a/pkgs/jnigen/example/pdfbox_plugin/example/analysis_options.yaml b/pkgs/jnigen/example/pdfbox_plugin/example/analysis_options.yaml index 61b6c4de1..ca60bc685 100644 --- a/pkgs/jnigen/example/pdfbox_plugin/example/analysis_options.yaml +++ b/pkgs/jnigen/example/pdfbox_plugin/example/analysis_options.yaml @@ -22,8 +22,8 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: + - dangling_library_doc_comments # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/pkgs/native_assets_builder/analysis_options.yaml b/pkgs/native_assets_builder/analysis_options.yaml index 89ab6f0b8..756a4a80d 100644 --- a/pkgs/native_assets_builder/analysis_options.yaml +++ b/pkgs/native_assets_builder/analysis_options.yaml @@ -9,6 +9,7 @@ analyzer: linter: rules: + - dangling_library_doc_comments - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_in_for_each diff --git a/pkgs/native_assets_cli/analysis_options.yaml b/pkgs/native_assets_cli/analysis_options.yaml index dd3dcdac5..f69a8643a 100644 --- a/pkgs/native_assets_cli/analysis_options.yaml +++ b/pkgs/native_assets_cli/analysis_options.yaml @@ -6,6 +6,7 @@ analyzer: linter: rules: + - dangling_library_doc_comments - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_in_for_each diff --git a/pkgs/native_toolchain_c/analysis_options.yaml b/pkgs/native_toolchain_c/analysis_options.yaml index dd3dcdac5..f69a8643a 100644 --- a/pkgs/native_toolchain_c/analysis_options.yaml +++ b/pkgs/native_toolchain_c/analysis_options.yaml @@ -6,6 +6,7 @@ analyzer: linter: rules: + - dangling_library_doc_comments - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_in_for_each