diff --git a/pkgs/ffi/analysis_options.yaml b/pkgs/ffi/analysis_options.yaml index 62cc9f2b0..de90abda0 100644 --- a/pkgs/ffi/analysis_options.yaml +++ b/pkgs/ffi/analysis_options.yaml @@ -1,9 +1,12 @@ include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: + errors: + todo: ignore language: strict-casts: true strict-inference: true + strict-raw-types: true linter: rules: diff --git a/pkgs/ffigen/analysis_options.yaml b/pkgs/ffigen/analysis_options.yaml index 3e3d1cc64..278f36d25 100644 --- a/pkgs/ffigen/analysis_options.yaml +++ b/pkgs/ffigen/analysis_options.yaml @@ -19,6 +19,7 @@ analyzer: language: strict-casts: true strict-inference: true + strict-raw-types: true linter: rules: diff --git a/pkgs/ffigen/lib/src/config_provider/config.dart b/pkgs/ffigen/lib/src/config_provider/config.dart index 2c38b8113..2fe710d7b 100644 --- a/pkgs/ffigen/lib/src/config_provider/config.dart +++ b/pkgs/ffigen/lib/src/config_provider/config.dart @@ -748,7 +748,7 @@ class Config { ); } - bool _libraryImportsPredefinedValidation(ConfigValue node) { + bool _libraryImportsPredefinedValidation(ConfigValue node) { if (node.value is YamlMap) { return (node.value as YamlMap).keys.where((key) { if (strings.predefinedLibraryImports.containsKey(key)) { diff --git a/pkgs/ffigen/lib/src/config_provider/config_spec.dart b/pkgs/ffigen/lib/src/config_provider/config_spec.dart index 1232027cb..9f79d211a 100644 --- a/pkgs/ffigen/lib/src/config_provider/config_spec.dart +++ b/pkgs/ffigen/lib/src/config_provider/config_spec.dart @@ -1,3 +1,7 @@ +// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file +// 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. + import 'package:logging/logging.dart'; import 'package:yaml/yaml.dart'; @@ -28,7 +32,7 @@ abstract class ConfigSpec { String? schemaDescription; /// Custom validation hook, called post validation if successful. - bool Function(ConfigValue node)? customValidation; + bool Function(ConfigValue node)? customValidation; /// Used to transform the payload to another type before passing to parent /// nodes and [result]. @@ -44,9 +48,9 @@ abstract class ConfigSpec { required this.result, }); - bool _validateNode(ConfigValue o, {bool log = true}); + bool _validateNode(ConfigValue o, {bool log = true}); - ConfigValue _extractNode(ConfigValue o); + ConfigValue _extractNode(ConfigValue o); /// ConfigSpec objects should call [_getJsonRefOrSchemaNode] instead to get /// the child json schema. @@ -82,7 +86,7 @@ abstract class ConfigSpec { /// all underlying ConfigSpecs if valid. /// Should ideally only be called if [validate] returns True. Throws /// [ConfigSpecExtractionError] if any validation fails. - ConfigValue extract(dynamic value) { + ConfigValue extract(dynamic value) { return _extractNode(ConfigValue(path: [], value: value)); } } @@ -159,7 +163,7 @@ class ConfigValue { } class ConfigSpecExtractionError extends Error { - final ConfigValue? item; + final ConfigValue? item; final String message; ConfigSpecExtractionError(this.item, [this.message = 'Invalid ConfigSpec']); @@ -216,8 +220,8 @@ class HeterogeneousMapConfigSpec allKeys = {for (final kv in entries) kv.key}; @override - bool _validateNode(ConfigValue o, {bool log = true}) { - if (!o.checkType(log: log)) { + bool _validateNode(ConfigValue o, {bool log = true}) { + if (!o.checkType>(log: log)) { return false; } @@ -266,7 +270,7 @@ class HeterogeneousMapConfigSpec return result; } - dynamic _getAllDefaults(ConfigValue o) { + dynamic _getAllDefaults(ConfigValue o) { final result = {}; for (final entry in entries) { final path = [...o.path, entry.key]; @@ -298,8 +302,8 @@ class HeterogeneousMapConfigSpec } @override - ConfigValue _extractNode(ConfigValue o) { - if (!o.checkType(log: false)) { + ConfigValue _extractNode(ConfigValue o) { + if (!o.checkType>(log: false)) { throw ConfigSpecExtractionError(o); } @@ -405,8 +409,8 @@ class MapConfigSpec }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { - if (!o.checkType(log: log)) { + bool _validateNode(ConfigValue o, {bool log = true}) { + if (!o.checkType>(log: log)) { return false; } @@ -457,8 +461,8 @@ class MapConfigSpec } @override - ConfigValue _extractNode(ConfigValue o) { - if (!o.checkType(log: false)) { + ConfigValue _extractNode(ConfigValue o) { + if (!o.checkType>(log: false)) { throw ConfigSpecExtractionError(o); } @@ -522,7 +526,7 @@ class ListConfigSpec }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { if (!o.checkType(log: log)) { return false; } @@ -544,7 +548,7 @@ class ListConfigSpec } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { if (!o.checkType(log: false)) { throw ConfigSpecExtractionError(o); } @@ -591,7 +595,7 @@ class StringConfigSpec extends ConfigSpec { }) : _regexp = pattern == null ? null : RegExp(pattern, dotAll: true); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { if (!o.checkType(log: log)) { return false; } @@ -610,7 +614,7 @@ class StringConfigSpec extends ConfigSpec { } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { if (!o.checkType(log: false)) { throw ConfigSpecExtractionError(o); } @@ -642,7 +646,7 @@ class IntConfigSpec extends ConfigSpec { }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { if (!o.checkType(log: log)) { return false; } @@ -653,7 +657,7 @@ class IntConfigSpec extends ConfigSpec { } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { if (!o.checkType(log: false)) { throw ConfigSpecExtractionError(o); } @@ -688,7 +692,7 @@ class EnumConfigSpec }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { if (!allowedValues.contains(o.value)) { if (log) { _logger.severe( @@ -704,7 +708,7 @@ class EnumConfigSpec } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { if (!allowedValues.contains(o.value)) { throw ConfigSpecExtractionError(o); } @@ -735,7 +739,7 @@ class BoolConfigSpec extends ConfigSpec { }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { if (!o.checkType(log: log)) { return false; } @@ -746,7 +750,7 @@ class BoolConfigSpec extends ConfigSpec { } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { if (!o.checkType(log: false)) { throw ConfigSpecExtractionError(o); } @@ -784,7 +788,7 @@ class OneOfConfigSpec }); @override - bool _validateNode(ConfigValue o, {bool log = true}) { + bool _validateNode(ConfigValue o, {bool log = true}) { // Running first time with no logs. for (final spec in childConfigSpecs) { if (spec._validateNode(o, log: false)) { @@ -806,7 +810,7 @@ class OneOfConfigSpec } @override - ConfigValue _extractNode(ConfigValue o) { + ConfigValue _extractNode(ConfigValue o) { for (final spec in childConfigSpecs) { if (spec._validateNode(o, log: false)) { return o diff --git a/pkgs/objective_c/example/pubspec.lock b/pkgs/objective_c/example/pubspec.lock index 8a8169699..0123173b9 100644 --- a/pkgs/objective_c/example/pubspec.lock +++ b/pkgs/objective_c/example/pubspec.lock @@ -203,10 +203,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" vector_math: dependency: transitive description: @@ -219,10 +219,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "360c4271613beb44db559547d02f8b0dc044741d0eeb9aa6ccdb47e8ec54c63a" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.3" + version: "14.2.4" yaml: dependency: transitive description: @@ -232,5 +232,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54"