Skip to content

Commit

Permalink
Update to latest pkg:analyzer, bump SDK constraint (#1180)
Browse files Browse the repository at this point in the history
Use pkg:lints v2 and remove redundant entries in analysis_options
  • Loading branch information
kevmoo committed Aug 1, 2022
1 parent f50eb99 commit 5c26a0a
Show file tree
Hide file tree
Showing 29 changed files with 123 additions and 183 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ jobs:
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "analyzer_and_format; Dart 2.14.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
name: "analyzer_and_format; Dart 2.17.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:format-analyze"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:format-analyze"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: _test_yaml_pub_upgrade
Expand Down Expand Up @@ -206,22 +206,22 @@ jobs:
working-directory: json_serializable
run: dart analyze --fatal-infos .
job_004:
name: "unit_test; Dart 2.14.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`"
name: "unit_test; Dart 2.17.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: _test_yaml_pub_upgrade
Expand Down Expand Up @@ -265,22 +265,22 @@ jobs:
- job_002
- job_003
job_005:
name: "unit_test; Dart 2.14.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`"
name: "unit_test; Dart 2.17.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable;commands:test_3"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable;commands:test_3"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: json_serializable_pub_upgrade
Expand All @@ -297,22 +297,22 @@ jobs:
- job_002
- job_003
job_006:
name: "unit_test; Dart 2.14.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
name: "unit_test; Dart 2.17.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable;commands:test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable;commands:test_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: json_serializable_pub_upgrade
Expand All @@ -329,22 +329,22 @@ jobs:
- job_002
- job_003
job_007:
name: "unit_test; Dart 2.14.0; PKG: json_serializable; `dart test -p chrome`"
name: "unit_test; Dart 2.17.0; PKG: json_serializable; `dart test -p chrome`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable;commands:test_2"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable;commands:test_2"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: json_serializable_pub_upgrade
Expand Down Expand Up @@ -516,22 +516,22 @@ jobs:
- job_002
- job_003
job_012:
name: "ensure_build; Dart 2.14.0; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
name: "ensure_build; Dart 2.17.0; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
runs-on: ubuntu-latest
steps:
- name: Cache Pub hosted dependencies
uses: actions/cache@4504faf7e9bcf8f3ed0bc863c4e1d21499ab8ef8
with:
path: "~/.pub-cache/hosted"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example;commands:test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example;commands:test_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0;packages:_test_yaml-checked_yaml-example
os:ubuntu-latest;pub-cache-hosted;sdk:2.14.0
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0;packages:_test_yaml-checked_yaml-example
os:ubuntu-latest;pub-cache-hosted;sdk:2.17.0
os:ubuntu-latest;pub-cache-hosted
os:ubuntu-latest
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: "2.14.0"
sdk: "2.17.0"
- id: checkout
uses: actions/checkout@d0651293c4a5a52e711f25b41b05b2212f385d28
- id: _test_yaml_pub_upgrade
Expand Down
2 changes: 1 addition & 1 deletion _test_yaml/mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://github.com/google/mono_repo.dart for details on this file
sdk:
- 2.14.0
- 2.17.0
- dev

stages:
Expand Down
4 changes: 3 additions & 1 deletion _test_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: _test_yaml
publish_to: none

environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'

dev_dependencies:
_json_serial_shared_test:
Expand All @@ -12,6 +12,8 @@ dev_dependencies:
checked_yaml: any
json_annotation: ^4.4.0
json_serializable: any
lints: ^2.0.0
path: ^1.8.2
test: ^1.6.0
yaml: ^3.0.0

Expand Down
80 changes: 3 additions & 77 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,123 +1,49 @@
include: package:lints/recommended.yaml

analyzer:
language:
strict-casts: true

linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_catching_errors
- avoid_dynamic_calls
- avoid_empty_else
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_void
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_types_as_parameter_names
- avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- comment_references
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- directives_ordering
- empty_catches
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
- file_names
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- join_return_with_assignment
- library_names
- library_prefixes
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_duplicate_case_values
- no_runtimeType_toString
- non_constant_identifier_names
- null_closures
- omit_local_variable_types
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_declarations
- prefer_contains
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- recursive_getters
- slash_for_doc_comments
- sort_child_properties_last
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_is_even_rather_than_modulo
- use_rethrow_when_possible
- use_string_buffers
- valid_regexps
- void_checks
- use_super_parameters
2 changes: 1 addition & 1 deletion checked_yaml/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 2.0.2-dev

- Require `json_annotation` `^4.3.0`
- Require Dart SDK `>=2.14`
- Require Dart SDK `>=2.17`

## 2.0.1

Expand Down
2 changes: 1 addition & 1 deletion checked_yaml/mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://github.com/google/mono_repo.dart for details on this file
sdk:
- 2.14.0
- 2.17.0
- dev

stages:
Expand Down
3 changes: 2 additions & 1 deletion checked_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: >-
package:json_serializable and package:yaml.
repository: https://github.com/google/json_serializable.dart/tree/master/checked_yaml
environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'

dependencies:
json_annotation: ^4.3.0
Expand All @@ -17,6 +17,7 @@ dev_dependencies:
build_runner: ^2.0.0
build_verify: ^3.0.0
json_serializable: ^6.0.0
lints: ^2.0.0
path: ^1.0.0
test: ^1.16.0
test_process: ^2.0.0
Expand Down
2 changes: 1 addition & 1 deletion example/mono_pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://github.com/google/mono_repo.dart for details on this file
sdk:
- 2.14.0
- 2.17.0
- dev

stages:
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: example
publish_to: none

environment:
sdk: '>=2.14.0 <3.0.0'
sdk: '>=2.17.0 <3.0.0'

dependencies:
json_annotation: ^4.4.0
Expand All @@ -18,7 +18,7 @@ dev_dependencies:

json_serializable: ^6.0.0

# Used by tests. Not required to use `json_serializable`.
# Not required to use `json_serializable`.
lints: ^2.0.0
path: ^1.8.0
# Used by tests. Not required to use `json_serializable`.
test: ^1.16.0
4 changes: 4 additions & 0 deletions json_annotation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.6.1-dev

- Require Dart SDK 2.17

## 4.6.0

- Added `JsonSerializable(createFieldMap: true)`.
Expand Down

0 comments on commit 5c26a0a

Please sign in to comment.