diff --git a/.github/readme.md b/.github/readme.md index 530deef9..351d32f8 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -2,14 +2,18 @@ [![Codecov](https://codecov.io/github/tsinis/sealed_world/branch/main/graph/badge.svg)](https://app.codecov.io/github/tsinis/sealed_world/flags) [![CodeRabbit](https://img.shields.io/badge/reviewed-code?style=flat&logo=vowpalwabbit&logoColor=orange&label=coderabbit&color=dark-green)](https://coderabbit.ai) [![Dart Code Metrics](https://img.shields.io/badge/passing-dcm?style=flat&logo=dart&logoColor=lightskyblue&label=dcm&color=dark-green)](https://dcm.dev) -![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world) -![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green) +[![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world)](https://github.com/tsinis/sealed_world/commits) +[![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green)](https://github.com/tsinis/sealed_world/stargazers) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## Sealed World A pure Dart, fully tested and ISO-driven ecosystem for the world's data in the form of compile-time, tree-shakable constant sealed classes. +[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/tsinis/sealed_world?hide_repo_select=true&ref=main) + +Open in IDX + > [!TIP] > Flutter packages follow a **world** prefix convention, whereas Dart packages utilize the **sealed** prefix. diff --git a/.github/workflows/publish_world_countries.yaml b/.github/workflows/publish_world_countries.yaml index 52879bb1..9adcf6d8 100644 --- a/.github/workflows/publish_world_countries.yaml +++ b/.github/workflows/publish_world_countries.yaml @@ -8,7 +8,6 @@ on: jobs: publish-world-countries: - if: false # Until: https://github.com/dart-lang/setup-dart/issues/68 uses: ./.github/workflows/publish_to_pub.yaml permissions: id-token: write diff --git a/.github/workflows/publish_world_flags.yaml b/.github/workflows/publish_world_flags.yaml new file mode 100644 index 00000000..bf885aac --- /dev/null +++ b/.github/workflows/publish_world_flags.yaml @@ -0,0 +1,16 @@ +name: publish_world_flags + +on: + push: + branches: [main] + tags: + - 'world_flags-v[0-9]+.[0-9]+.[0-9]+*' + +jobs: + publish-world-flags: + uses: ./.github/workflows/publish_to_pub.yaml + permissions: + id-token: write + with: + package_name: world_flags + tag: ${{ github.ref }} \ No newline at end of file diff --git a/.vscode/sealed_world.code-workspace b/.vscode/sealed_world.code-workspace index 90097a84..9f3cbfa6 100644 --- a/.vscode/sealed_world.code-workspace +++ b/.vscode/sealed_world.code-workspace @@ -1,7 +1,13 @@ { "folders": [ - { "name": "VS Code", "path": "../.vscode" }, - { "name": "Dev Container", "path": "../.devcontainer" }, + { + "name": "VS Code", + "path": "." + }, + { + "name": "Dev Container", + "path": "../.devcontainer" + }, { "name": "GitHub Setup", "path": "../.github" @@ -259,27 +265,27 @@ }, { "type": "shell", - "command": "dart run dart_code_linter:metrics analyze lib", + "command": "dcm analyze lib", "label": "Dart Code Metrics Analyze" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unnecessary-nullable lib", + "command": "dcm check-unnecessary-nullable lib", "label": "Dart Code Metrics Nullable" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-l10n lib", + "command": "dcm check-unused-l10n lib", "label": "Dart Code Metrics Unused L10N" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-files lib", + "command": "dcm check-unused-files lib", "label": "Dart Code Metrics Unused Files" }, { "type": "shell", - "command": "dart run dart_code_linter:metrics check-unused-code lib", + "command": "dcm check-unused-code lib", "label": "Dart Code Metrics Unused Code" }, { diff --git a/packages/_sealed_world_tests/README.md b/packages/_sealed_world_tests/README.md index 5becd253..b7307e0f 100644 --- a/packages/_sealed_world_tests/README.md +++ b/packages/_sealed_world_tests/README.md @@ -2,8 +2,8 @@ [![Codecov](https://codecov.io/github/tsinis/sealed_world/branch/main/graph/badge.svg)](https://app.codecov.io/github/tsinis/sealed_world/flags) [![CodeRabbit](https://img.shields.io/badge/reviewed-code?style=flat&logo=vowpalwabbit&logoColor=orange&label=coderabbit&color=dark-green)](https://coderabbit.ai) [![Dart Code Metrics](https://img.shields.io/badge/passing-dcm?style=flat&logo=dart&logoColor=lightskyblue&label=dcm&color=dark-green)](https://dcm.dev) -![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world) -![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green) +[![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world)](https://github.com/tsinis/sealed_world/commits) +[![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green)](https://github.com/tsinis/sealed_world/stargazers) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) # Internal Testing Package diff --git a/packages/_sealed_world_tests/pubspec.yaml b/packages/_sealed_world_tests/pubspec.yaml index 3ddde7d7..1cb95587 100644 --- a/packages/_sealed_world_tests/pubspec.yaml +++ b/packages/_sealed_world_tests/pubspec.yaml @@ -7,14 +7,13 @@ repository: https://github.com/tsinis/sealed_world/tree/main/packages/_sealed_wo issue_tracker: https://github.com/tsinis/sealed_world/issues environment: - sdk: ^3.5.3 + sdk: ^3.6.0 dependencies: meta: ^1.15.0 # Specific version for the flags package. From Google - test: ^1.25.7 # Specific version for the flags package. From Google + test: ^1.25.8 # Specific version for the flags package. From Google vm_service: ^14.2.5 # Specific version for the flags package. From Google dev_dependencies: - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google diff --git a/packages/analysis_options.yaml b/packages/analysis_options.yaml index 8406979e..f068811f 100644 --- a/packages/analysis_options.yaml +++ b/packages/analysis_options.yaml @@ -43,7 +43,7 @@ analyzer: dart_code_metrics: extends: - - package:dart_code_metrics_presets/all.yaml + - package:dart_code_metrics_presets/dart_all.yaml anti-patterns: - long-parameter-list: ignore-optional: true @@ -62,6 +62,7 @@ dart_code_metrics: rules: # Disabled: - arguments-ordering: false # This will be a breaking change. + - avoid-adjacent-strings: false # It's not being used on one line strings. - avoid-collection-equality-checks: false # Doesn't work for models exclude. - avoid-collection-mutating-methods: false # Mostly false positives. - avoid-duplicate-collection-elements: false # They are being used on purpose. @@ -97,8 +98,6 @@ dart_code_metrics: exceptions: ["a", "b", "e", "i", "k", "v", "x", "y", "io", "bc", "sb"] - avoid-long-parameter-list: ignore-optional: true - - prefer-widget-private-members: - ignore-static: true - avoid-type-casts: exclude: - "*_json.dart" @@ -153,20 +152,262 @@ dart_code_metrics: exclude: - "**/data/**.data.dart" - "**/translations/**.l10n.dart" + # Enabled: + - avoid-accessing-collections-by-constant-index + - avoid-accessing-other-classes-private-members + - avoid-assigning-to-static-field + - avoid-assignments-as-conditions + - avoid-async-call-in-sync-function + - avoid-barrel-files + - avoid-bottom-type-in-patterns + - avoid-bottom-type-in-records + - avoid-cascade-after-if-null + - avoid-casting-to-extension-type + - avoid-collapsible-if + - avoid-collection-equality-checks + - avoid-collection-methods-with-unrelated-types + - avoid-collection-mutating-methods + - avoid-complex-loop-conditions + - avoid-conditions-with-boolean-literals + - avoid-contradictory-expressions + - avoid-declaring-call-method + - avoid-double-slash-imports + - avoid-duplicate-cascades + - avoid-duplicate-collection-elements + - avoid-duplicate-constant-values + - avoid-duplicate-exports + - avoid-duplicate-initializers + - avoid-duplicate-map-keys + - avoid-duplicate-mixins + - avoid-duplicate-named-imports + - avoid-duplicate-patterns + - avoid-duplicate-switch-case-conditions + - avoid-duplicate-test-assertions + - avoid-dynamic + - avoid-empty-spread + - avoid-empty-test-groups + - avoid-equal-expressions + - avoid-excessive-expressions + - avoid-explicit-pattern-field-name + - avoid-explicit-type-declaration + - avoid-extensions-on-records + - avoid-function-type-in-records + - avoid-future-tostring + - avoid-generics-shadowing + - avoid-global-state + - avoid-high-cyclomatic-complexity + - avoid-identical-exception-handling-blocks + - avoid-implicitly-nullable-extension-types + - avoid-importing-entrypoint-exports + - avoid-incomplete-copy-with + - avoid-incorrect-uri + - avoid-inferrable-type-arguments + - avoid-inverted-boolean-checks + - avoid-keywords-in-wildcard-pattern + - avoid-late-final-reassignment + - avoid-local-functions + - avoid-long-files + - avoid-long-functions + - avoid-long-parameter-list + - avoid-long-records + - avoid-map-keys-contains + - avoid-missed-calls + - avoid-missing-completer-stack-trace + - avoid-missing-enum-constant-in-map + - avoid-missing-interpolation + - avoid-misused-set-literals + - avoid-misused-test-matchers + - avoid-misused-wildcard-pattern + - avoid-mixing-named-and-positional-fields + - avoid-multi-assignment + - avoid-mutating-parameters + - avoid-negated-conditions + - avoid-negations-in-equality-checks + - avoid-nested-conditional-expressions + - avoid-nested-extension-types + - avoid-nested-futures + - avoid-nested-records + - avoid-nested-streams-and-futures + - avoid-nested-switch-expressions + - avoid-nested-switches + - avoid-non-ascii-symbols + - avoid-non-empty-constructor-bodies + - avoid-non-final-exception-class-fields + - avoid-non-null-assertion + - avoid-not-encodable-in-to-json + - avoid-nullable-interpolation + - avoid-nullable-parameters-with-default-values + - avoid-nullable-tostring + - avoid-one-field-records + - avoid-only-rethrow + - avoid-passing-async-when-sync-expected + - avoid-passing-default-values + - avoid-passing-self-as-argument + - avoid-positional-record-field-access + - avoid-recursive-calls + - avoid-redundant-async + - avoid-redundant-else + - avoid-redundant-positional-field-name + - avoid-redundant-pragma-inline + - avoid-referencing-discarded-variables + - avoid-referencing-subclasses + - avoid-renaming-representation-getters + - avoid-returning-cascades + - avoid-returning-void + - avoid-self-assignment + - avoid-self-compare + - avoid-shadowed-extension-methods + - avoid-shadowing + - avoid-similar-names + - avoid-single-field-destructuring + - avoid-slow-collection-methods + - avoid-substring + - avoid-suspicious-super-overrides + - avoid-throw-in-catch-block + - avoid-throw-objects-without-tostring + - avoid-top-level-members-in-tests + - avoid-type-casts + - avoid-unassigned-late-fields + - avoid-unassigned-stream-subscriptions + - avoid-uncaught-future-errors + - avoid-unconditional-break + - avoid-unknown-pragma + - avoid-unnecessary-call + - avoid-unnecessary-collections + - avoid-unnecessary-conditionals + - avoid-unnecessary-constructor + - avoid-unnecessary-enum-arguments + - avoid-unnecessary-enum-prefix + - avoid-unnecessary-extends + - avoid-unnecessary-futures + - avoid-unnecessary-getter + - avoid-unnecessary-if + - avoid-unnecessary-local-late + - avoid-unnecessary-negations + - avoid-unnecessary-nullable-return-type + - avoid-unnecessary-overrides + - avoid-unnecessary-patterns + - avoid-unnecessary-reassignment + - avoid-unnecessary-return + - avoid-unnecessary-super + - avoid-unnecessary-type-assertions + - avoid-unnecessary-type-casts + - avoid-unrelated-type-assertions + - avoid-unrelated-type-casts + - avoid-unsafe-collection-methods + - avoid-unsafe-reduce + - avoid-unused-after-null-check + - avoid-unused-assignment + - avoid-unused-generics + - avoid-unused-instances + - avoid-unused-parameters + - avoid-weak-cryptographic-algorithms + - avoid-wildcard-cases-with-enums + - binary-expression-operand-order + - dispose-class-fields + - double-literal-format + - format-comment + - function-always-returns-null + - function-always-returns-same-value + - handle-throwing-invocations + - map-keys-ordering + - match-getter-setter-field-names + - match-lib-folder-structure + - match-positional-field-names-on-assignment + - missing-test-assertion + - move-records-to-typedefs + - move-variable-closer-to-its-usage + - move-variable-outside-iteration + - newline-before-case + - newline-before-method + - newline-before-return + - no-boolean-literal-compare + - no-empty-block + - no-equal-arguments + - no-equal-conditions + - no-equal-nested-conditions + - no-equal-switch-case + - no-equal-switch-expression-cases + - no-equal-then-else + - no-object-declaration + - prefer-abstract-final-static-class + - prefer-add-all + - prefer-addition-subtraction-assignments + - prefer-any-or-every + - prefer-assigning-await-expressions + - prefer-async-await + - prefer-boolean-prefixes + - prefer-both-inlining-annotations + - prefer-bytes-builder + - prefer-commenting-analyzer-ignores + - prefer-conditional-expressions + - prefer-contains + - prefer-correct-callback-field-name + - prefer-correct-error-name + - prefer-correct-for-loop-increment + - prefer-correct-future-return-type + - prefer-correct-handler-name + - prefer-correct-json-casts + - prefer-correct-setter-parameter-name + - prefer-correct-stream-return-type + - prefer-correct-switch-length + - prefer-correct-test-file-name + - prefer-correct-type-name + - prefer-declaring-const-constructor + - prefer-early-return + - prefer-enums-by-name + - prefer-explicit-function-type + - prefer-explicit-parameter-names + - prefer-explicit-type-arguments + - prefer-extracting-function-callbacks + - prefer-first + - prefer-for-in + - prefer-getter-over-method + - prefer-immediate-return + - prefer-iterable-of + - prefer-last + - prefer-match-file-name + - prefer-moving-to-variable + - prefer-named-boolean-parameters + - prefer-null-aware-spread + - prefer-overriding-parent-equality + - prefer-parentheses-with-if-null + - prefer-prefixed-global-constants + - prefer-private-extension-type-field + - prefer-public-exception-classes + - prefer-return-await + - prefer-returning-conditional-expressions + - prefer-simpler-boolean-expressions + - prefer-simpler-patterns-null-check + - prefer-single-declaration-per-file + - prefer-specific-cases-first + - prefer-static-class + - prefer-switch-with-enums + - prefer-switch-with-sealed-classes + - prefer-trailing-comma + - prefer-type-over-var + - prefer-typedefs-for-callbacks + - prefer-unique-test-names + - prefer-unwrapping-future-or + - prefer-visible-for-testing-on-members + - prefer-wildcard-pattern + - record-fields-ordering + - unnecessary-trailing-comma + - use-existing-variable linter: rules: # Disabled: always_put_control_body_on_new_line: false # Makes code harder to read. - omit_local_variable_types: false # Conflicts with: prefer-type-over-var. always_specify_types: false # Conflicts with: omit_local_variable_types. always_use_package_imports: false # Conflicts with: prefer_relative_imports. avoid_classes_with_only_static_members: false # Conflicts with: prefer-static-class avoid_equals_and_hash_code_on_mutable_classes: false # We have no access to meta here. flutter_style_todos: false # Not a Flutter team. - # omit_obvious_local_variable_types: true # Conflicts with: specify_nonobvious_local_variable_types. #TODO! After Dart 3.6 is released. + omit_local_variable_types: false # Conflicts with: prefer-type-over-var prefer_final_parameters: false # Conflicts with: avoid_final_parameters. prefer_single_quotes: false # Conflicts with: prefer_double_quotes. + specify_nonobvious_local_variable_types: false # Conflicts with: avoid-explicit-type-declaration. unnecessary_final: false # Conflicts with: prefer_final_locals. unnecessary_library_name: false # To prevent breaking changes for those who use this libs. @@ -271,6 +512,7 @@ linter: noop_primitive_operations: true null_check_on_nullable_type_parameter: true null_closures: true + omit_obvious_local_variable_types: true one_member_abstracts: true only_throw_errors: true overridden_fields: true @@ -278,6 +520,7 @@ linter: package_names: true package_prefixed_library_names: true parameter_assignments: true + prefer-assigning-await-expressions: true prefer_adjacent_string_concatenation: true prefer_asserts_in_initializer_lists: true prefer_asserts_with_message: true @@ -318,6 +561,7 @@ linter: prefer_void_to_null: true provide_deprecation_message: true public_member_api_docs: true + record-fields-ordering: true recursive_getters: true require_trailing_commas: true secure_pubspec_urls: true @@ -325,7 +569,6 @@ linter: sort_constructors_first: true sort_pub_dependencies: true sort_unnamed_constructors_first: true - # specify_nonobvious_local_variable_types: true #TODO! After Dart 3.6 is released. test_types_in_equals: true throw_in_finally: true tighten_type_of_initializing_formals: true @@ -374,6 +617,6 @@ linter: use_super_parameters: true use_test_throws_matchers: true use_to_and_as_if_applicable: true - # use_truncating_division: true #TODO! After Dart 3.6 is released. + use_truncating_division: true valid_regexps: true void_checks: true diff --git a/packages/flutter_analysis_options.yaml b/packages/flutter_analysis_options.yaml index 6e6cb544..4efe8382 100644 --- a/packages/flutter_analysis_options.yaml +++ b/packages/flutter_analysis_options.yaml @@ -8,10 +8,55 @@ dart_code_metrics: - avoid-long-files: exclude: - lib/**/*_painter.dart + - avoid-returning-widgets: + allow-nullable: true - avoid-similar-names: similarity-threshold: 0.8 ignored-names: - path + - prefer-widget-private-members: + ignore-static: true + - always-remove-listener + - avoid-border-all + - avoid-empty-setstate + - avoid-expanded-as-spacer + - avoid-flexible-outside-flex + - avoid-incorrect-image-opacity + - avoid-inherited-widget-in-initstate + - avoid-late-context + - avoid-missing-controller + - avoid-missing-image-alt + - avoid-recursive-widget-calls + - avoid-shrink-wrap-in-lists + - avoid-single-child-column-or-row + - avoid-state-constructors + - avoid-stateless-widget-initialized-fields + - avoid-undisposed-instances + - avoid-unnecessary-gesture-detector + - avoid-unnecessary-overrides-in-state + - avoid-unnecessary-setstate + - avoid-unnecessary-stateful-widgets + - avoid-wrapping-in-padding + - check-for-equals-in-render-object-setters + - consistent-update-render-object + - dispose-fields + - prefer-action-button-tooltip + - prefer-center-over-align + - prefer-const-border-radius + - prefer-container + - prefer-correct-edge-insets-constructor + - prefer-dedicated-media-query-methods + - prefer-define-hero-tag + - prefer-extracting-callbacks + - prefer-for-loop-in-children + - prefer-padding-over-container + - prefer-single-widget-per-file + - prefer-sized-box-square + - prefer-sliver-prefix + - prefer-text-rich + - prefer-using-list-view + - proper-super-calls + - use-setstate-synchronously linter: rules: diff --git a/packages/sealed_countries/README.md b/packages/sealed_countries/README.md index b26d3eef..42cb81c7 100644 --- a/packages/sealed_countries/README.md +++ b/packages/sealed_countries/README.md @@ -3,10 +3,10 @@ [![CodeRabbit](https://img.shields.io/badge/reviewed-code?style=flat&logo=vowpalwabbit&logoColor=orange&label=coderabbit&color=dark-green)](https://coderabbit.ai) [![Dart Code Metrics](https://img.shields.io/badge/passing-dcm?style=flat&logo=dart&logoColor=lightskyblue&label=dcm&color=dark-green)](https://dcm.dev) [![CI checks](https://github.com/tsinis/sealed_world/actions/workflows/sealed_countries.yaml/badge.svg)](https://github.com/tsinis/sealed_world/actions/workflows/sealed_countries.yaml) -![Pub points](https://img.shields.io/pub/points/sealed_countries) -![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world) -![Pub popularity](https://img.shields.io/pub/popularity/sealed_countries) -![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green) +[![Pub points](https://img.shields.io/pub/points/sealed_countries)](https://pub.dev/packages/sealed_countries/score) +[![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world)](https://github.com/tsinis/sealed_world/commits/main/packages/sealed_countries) +[![Pub popularity](https://img.shields.io/pub/popularity/sealed_countries)](https://pub.dev/packages/sealed_countries/score) +[![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green)](https://github.com/tsinis/sealed_world/stargazers) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Pub package](https://img.shields.io/pub/v/sealed_countries.svg)](https://pub.dev/packages/sealed_countries) diff --git a/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart b/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart index 3f874884..9e8008e0 100644 --- a/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart +++ b/packages/sealed_countries/lib/src/model/country/submodels/world_country.dart @@ -213,6 +213,7 @@ class WorldCountry extends Country factory WorldCountry.fromCodeNumeric( Object codeNumeric, [ Iterable? countries, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { if (countries == null) return codeNumericMap.findByCodeOrThrow(codeNumeric); final trimmedCode = codeNumeric.toUpperCaseIsoCode(); diff --git a/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart b/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart index 7d9afbc9..b78fadfb 100644 --- a/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart +++ b/packages/sealed_countries/lib/src/model/regional_bloc/regional_bloc.dart @@ -40,6 +40,7 @@ class RegionalBloc extends WorldBloc { factory RegionalBloc.fromAcronym( Object acronym, [ Iterable? blocs, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final string = acronym.toUpperCaseIsoCode(); if (blocs == null) return map[string]!; diff --git a/packages/sealed_countries/pubspec.yaml b/packages/sealed_countries/pubspec.yaml index d238abe6..40087ec1 100644 --- a/packages/sealed_countries/pubspec.yaml +++ b/packages/sealed_countries/pubspec.yaml @@ -26,9 +26,8 @@ dependencies: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - coverage: ^1.9.2 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google - test: ^1.25.8 # From Google + build_runner: ^2.4.14 # From Google + coverage: ^1.11.1 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google + test: ^1.25.14 # From Google diff --git a/packages/sealed_currencies/README.md b/packages/sealed_currencies/README.md index b36f5b7d..5b724d64 100644 --- a/packages/sealed_currencies/README.md +++ b/packages/sealed_currencies/README.md @@ -3,10 +3,10 @@ [![CodeRabbit](https://img.shields.io/badge/reviewed-code?style=flat&logo=vowpalwabbit&logoColor=orange&label=coderabbit&color=dark-green)](https://coderabbit.ai) [![Dart Code Metrics](https://img.shields.io/badge/passing-dcm?style=flat&logo=dart&logoColor=lightskyblue&label=dcm&color=dark-green)](https://dcm.dev) [![CI checks](https://github.com/tsinis/sealed_world/actions/workflows/sealed_currencies.yaml/badge.svg)](https://github.com/tsinis/sealed_world/actions/workflows/sealed_currencies.yaml) -![Pub points](https://img.shields.io/pub/points/sealed_currencies) -![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world) -![Pub popularity](https://img.shields.io/pub/popularity/sealed_currencies) -![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green) +[![Pub points](https://img.shields.io/pub/points/sealed_currencies)](https://pub.dev/packages/sealed_currencies/score) +[![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world)](https://github.com/tsinis/sealed_world/commits/main/packages/sealed_currencies) +[![Pub popularity](https://img.shields.io/pub/popularity/sealed_currencies)](https://pub.dev/packages/sealed_currencies/score) +[![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green)](https://github.com/tsinis/sealed_world/stargazers) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Pub package](https://img.shields.io/pub/v/sealed_currencies.svg)](https://pub.dev/packages/sealed_currencies) diff --git a/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart b/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart index 80cdfaa0..5180d9fa 100644 --- a/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart +++ b/packages/sealed_currencies/lib/src/model/currency/submodels/fiat_currency.dart @@ -152,6 +152,7 @@ class FiatCurrency extends Currency factory FiatCurrency.fromName( Object name, [ Iterable currencies = listExtended, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final upperCaseName = name.toUpperCaseIsoCode(); diff --git a/packages/sealed_currencies/pubspec.yaml b/packages/sealed_currencies/pubspec.yaml index 6cc921e5..a7c1729e 100644 --- a/packages/sealed_currencies/pubspec.yaml +++ b/packages/sealed_currencies/pubspec.yaml @@ -26,9 +26,8 @@ dependencies: dev_dependencies: _sealed_world_tests: path: ../_sealed_world_tests - build_runner: ^2.4.13 # From Google - coverage: ^1.9.2 # From Google - dart_code_linter: ^1.1.5 # Ex-DCM. - dart_code_metrics_presets: ^2.17.0 - lints: ^5.0.0 # From Google - test: ^1.25.8 # From Google + build_runner: ^2.4.14 # From Google + coverage: ^1.11.1 # From Google + dart_code_metrics_presets: ^2.19.0 + lints: ^5.1.1 # From Google + test: ^1.25.14 # From Google diff --git a/packages/sealed_languages/README.md b/packages/sealed_languages/README.md index 0cf24b52..9443589c 100644 --- a/packages/sealed_languages/README.md +++ b/packages/sealed_languages/README.md @@ -3,10 +3,10 @@ [![CodeRabbit](https://img.shields.io/badge/reviewed-code?style=flat&logo=vowpalwabbit&logoColor=orange&label=coderabbit&color=dark-green)](https://coderabbit.ai) [![Dart Code Metrics](https://img.shields.io/badge/passing-dcm?style=flat&logo=dart&logoColor=lightskyblue&label=dcm&color=dark-green)](https://dcm.dev) [![CI checks](https://github.com/tsinis/sealed_world/actions/workflows/sealed_languages.yaml/badge.svg)](https://github.com/tsinis/sealed_world/actions/workflows/sealed_languages.yaml) -![Pub points](https://img.shields.io/pub/points/sealed_languages) -![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world) -![Pub popularity](https://img.shields.io/pub/popularity/sealed_languages) -![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green) +[![Pub points](https://img.shields.io/pub/points/sealed_languages)](https://pub.dev/packages/sealed_languages/score) +[![Last commit](https://img.shields.io/github/last-commit/tsinis/sealed_world)](https://github.com/tsinis/sealed_world/commits/main/packages/sealed_languages) +[![Pub popularity](https://img.shields.io/pub/popularity/sealed_languages)](https://pub.dev/packages/sealed_languages/score) +[![GitHub stars](https://img.shields.io/github/stars/tsinis/sealed_world?style=flat&color=green)](https://github.com/tsinis/sealed_world/stargazers) [![License MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Pub package](https://img.shields.io/pub/v/sealed_languages.svg)](https://pub.dev/packages/sealed_languages) diff --git a/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart b/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart index 92a17844..c513339d 100644 --- a/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart +++ b/packages/sealed_languages/lib/src/helpers/extensions/iso_standardized_string_extension.dart @@ -108,13 +108,13 @@ extension IsoStandardizedStringExtension on String { T Function(String code)? regular, T Function(String code)? short, }) { - final code = minLength == maxLength + final code = (minLength == maxLength) ? maybeToValidIsoCode(exactLength: minLength) : maybeToValidIsoCode(maxLength: maxLength, minLength: minLength); if (code == null) return orElse(this); return code.length == IsoStandardized.codeShortLength - ? short?.call(code.toUpperCase()) ?? orElse(code) + ? (short?.call(code.toUpperCase()) ?? orElse(code)) : _onNumericOrRegular(code, orElse, regular: regular, numeric: numeric); } @@ -127,7 +127,7 @@ extension IsoStandardizedStringExtension on String { if (numeric == null && regular == null) return orElse(code); return RegExp("[a-z]", caseSensitive: false).hasMatch(code) - ? regular?.call(code) ?? orElse(code) - : numeric?.call(code) ?? orElse(code); + ? (regular?.call(code) ?? orElse(code)) + : (numeric?.call(code) ?? orElse(code)); } } diff --git a/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart b/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart index a1d11205..0a8c11dd 100644 --- a/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart +++ b/packages/sealed_languages/lib/src/model/language/submodels/natural_language.dart @@ -167,6 +167,7 @@ class NaturalLanguage extends Language factory NaturalLanguage.fromName( Object name, [ Iterable languages = list, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { final upperCaseName = name.toUpperCaseIsoCode(); diff --git a/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart b/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart index 50a5a93d..e7977be7 100644 --- a/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart +++ b/packages/sealed_languages/lib/src/model/language_family/submodels/natural_language_family.dart @@ -31,6 +31,7 @@ class NaturalLanguageFamily extends LanguageFamily { factory NaturalLanguageFamily.fromName( String name, [ Iterable families = list, + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. ]) { assert(families.isNotEmpty, "`families` should not be empty!"); diff --git a/packages/sealed_languages/lib/src/model/script/submodels/script.dart b/packages/sealed_languages/lib/src/model/script/submodels/script.dart index db0d7e29..9ea4b6b5 100644 --- a/packages/sealed_languages/lib/src/model/script/submodels/script.dart +++ b/packages/sealed_languages/lib/src/model/script/submodels/script.dart @@ -52,6 +52,7 @@ class Script extends WritingSystem /// {@macro optional_instances_array_parameter} /// This method returns the [Script] instance that corresponds to the /// given code, or throws a [StateError] if no such instance exists. + // ignore: avoid-non-empty-constructor-bodies, more clear for factory methods. factory Script.fromCode(Object code, [Iterable