Skip to content

Commit 93f7149

Browse files
feat: support Dart 3.8.0 (#152)
* feat: update `VGA` for Dart v3.8.0 * feat: update `VGA` for Dart v3.8.0 * feat: add `trailing_commas` to the formatter * feat: update `VGA` for Dart v3.8.0 * feat: update `VGA` for Dart v3.8.0 * feat: add v8.1.0 * revert changes to README * chore: rename 8.1.0 to 9.0.0 --------- Co-authored-by: Marcos Sevilla <[email protected]>
1 parent cb79f4c commit 93f7149

14 files changed

+274
-62
lines changed

.github/workflows/tool_linter_rules.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
- name: 🎯 Setup Dart
1818
uses: dart-lang/setup-dart@v1
1919
with:
20-
sdk: 3.7.0
20+
sdk: 3.8.0
2121

2222
- name: 📦 Install Dependencies
2323
run: dart pub get
2424

2525
- name: ✨ Check Formatting
26-
run: dart format --line-length 80 --set-exit-if-changed .
26+
run: dart format --set-exit-if-changed .
2727

2828
- name: 🕵️ Analyze
2929
run: dart analyze --fatal-infos --fatal-warnings

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ include: package:very_good_analysis/analysis_options.yaml
3535
This will ensure you always use the latest version of the lints. If you wish to restrict the lint version, specify a version of `analysis_options.yaml` instead:
3636

3737
```yaml
38-
include: package:very_good_analysis/analysis_options.7.0.0.yaml
38+
include: package:very_good_analysis/analysis_options.9.0.0.yaml
3939
```
4040

4141
## Suppressing Lints
@@ -134,7 +134,7 @@ Below is a list of rules that are not enabled by default together with the reaso
134134
| [`use_truncating_division`](https://dart.dev/tools/linter-rules/use_truncating_division) | Not specified |
135135
<!-- end:excluded_rules_table -->
136136

137-
[analysis_options_yaml]: https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/lib/analysis_options.7.0.0.yaml
137+
[analysis_options_yaml]: https://github.com/VeryGoodOpenSource/very_good_analysis/blob/main/lib/analysis_options.9.0.0.yaml
138138
[ci_badge]: https://github.com/VeryGoodOpenSource/very_good_analysis/workflows/ci/badge.svg
139139
[ci_badge_link]: https://github.com/VeryGoodOpenSource/very_good_analysis/actions
140140
[badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 0.0.1
33
publish_to: none
44

55
environment:
6-
sdk: ">=2.18.0 <3.0.0"
6+
sdk: ^3.8.0
77

88
dependencies:
99
very_good_analysis:

lib/analysis_options.9.0.0.yaml

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
analyzer:
2+
language:
3+
strict-casts: true
4+
strict-inference: true
5+
strict-raw-types: true
6+
7+
errors:
8+
close_sinks: ignore
9+
missing_required_param: error
10+
missing_return: error
11+
record_literal_one_positional_no_trailing_comma: error
12+
collection_methods_unrelated_type: warning
13+
unrelated_type_equality_checks: warning
14+
15+
exclude:
16+
- test/.test_coverage.dart
17+
- lib/generated_plugin_registrant.dart
18+
19+
formatter:
20+
trailing_commas: preserve
21+
22+
linter:
23+
rules:
24+
- always_declare_return_types
25+
- always_put_required_named_parameters_first
26+
- always_use_package_imports
27+
- annotate_overrides
28+
- avoid_bool_literals_in_conditional_expressions
29+
- avoid_catches_without_on_clauses
30+
- avoid_catching_errors
31+
- avoid_double_and_int_checks
32+
- avoid_dynamic_calls
33+
- avoid_empty_else
34+
- avoid_equals_and_hash_code_on_mutable_classes
35+
- avoid_escaping_inner_quotes
36+
- avoid_field_initializers_in_const_classes
37+
- avoid_final_parameters
38+
- avoid_function_literals_in_foreach_calls
39+
- avoid_init_to_null
40+
- avoid_js_rounded_ints
41+
- avoid_multiple_declarations_per_line
42+
- avoid_positional_boolean_parameters
43+
- avoid_print
44+
- avoid_private_typedef_functions
45+
- avoid_redundant_argument_values
46+
- avoid_relative_lib_imports
47+
- avoid_renaming_method_parameters
48+
- avoid_return_types_on_setters
49+
- avoid_returning_null_for_void
50+
- avoid_returning_this
51+
- avoid_setters_without_getters
52+
- avoid_shadowing_type_parameters
53+
- avoid_single_cascade_in_expression_statements
54+
- avoid_slow_async_io
55+
- avoid_type_to_string
56+
- avoid_types_as_parameter_names
57+
- avoid_unnecessary_containers
58+
- avoid_unused_constructor_parameters
59+
- avoid_void_async
60+
- avoid_web_libraries_in_flutter
61+
- await_only_futures
62+
- camel_case_extensions
63+
- camel_case_types
64+
- cancel_subscriptions
65+
- cascade_invocations
66+
- cast_nullable_to_non_nullable
67+
- collection_methods_unrelated_type
68+
- combinators_ordering
69+
- comment_references
70+
- conditional_uri_does_not_exist
71+
- constant_identifier_names
72+
- control_flow_in_finally
73+
- curly_braces_in_flow_control_structures
74+
- dangling_library_doc_comments
75+
- depend_on_referenced_packages
76+
- deprecated_consistency
77+
- directives_ordering
78+
- document_ignores
79+
- empty_catches
80+
- empty_constructor_bodies
81+
- empty_statements
82+
- eol_at_end_of_file
83+
- exhaustive_cases
84+
- file_names
85+
- flutter_style_todos
86+
- hash_and_equals
87+
- implicit_call_tearoffs
88+
- implementation_imports
89+
- implicit_reopen
90+
- invalid_case_patterns
91+
- invalid_runtime_check_with_js_interop_types
92+
- join_return_with_assignment
93+
- leading_newlines_in_multiline_strings
94+
- library_annotations
95+
- library_prefixes
96+
- library_private_types_in_public_api
97+
- lines_longer_than_80_chars
98+
- literal_only_boolean_expressions
99+
- missing_code_block_language_in_doc_comment
100+
- missing_whitespace_between_adjacent_strings
101+
- no_adjacent_strings_in_list
102+
- no_default_cases
103+
- no_duplicate_case_values
104+
- no_leading_underscores_for_library_prefixes
105+
- no_leading_underscores_for_local_identifiers
106+
- no_logic_in_create_state
107+
- no_runtimeType_toString
108+
- no_self_assignments
109+
- no_wildcard_variable_uses
110+
- non_constant_identifier_names
111+
- noop_primitive_operations
112+
- null_check_on_nullable_type_parameter
113+
- null_closures
114+
- omit_local_variable_types
115+
- one_member_abstracts
116+
- only_throw_errors
117+
- overridden_fields
118+
- package_names
119+
- parameter_assignments
120+
- prefer_adjacent_string_concatenation
121+
- prefer_asserts_in_initializer_lists
122+
- prefer_asserts_with_message
123+
- prefer_collection_literals
124+
- prefer_conditional_assignment
125+
- prefer_const_constructors
126+
- prefer_const_constructors_in_immutables
127+
- prefer_const_declarations
128+
- prefer_const_literals_to_create_immutables
129+
- prefer_constructors_over_static_methods
130+
- prefer_contains
131+
- prefer_final_fields
132+
- prefer_final_in_for_each
133+
- prefer_final_locals
134+
- prefer_for_elements_to_map_fromIterable
135+
- prefer_function_declarations_over_variables
136+
- prefer_generic_function_type_aliases
137+
- prefer_if_elements_to_conditional_expressions
138+
- prefer_if_null_operators
139+
- prefer_initializing_formals
140+
- prefer_inlined_adds
141+
- prefer_int_literals
142+
- prefer_interpolation_to_compose_strings
143+
- prefer_is_empty
144+
- prefer_is_not_empty
145+
- prefer_is_not_operator
146+
- prefer_iterable_whereType
147+
- prefer_null_aware_method_calls
148+
- prefer_null_aware_operators
149+
- prefer_single_quotes
150+
- prefer_spread_collections
151+
- prefer_typing_uninitialized_variables
152+
- provide_deprecation_message
153+
- public_member_api_docs
154+
- recursive_getters
155+
- secure_pubspec_urls
156+
- sized_box_for_whitespace
157+
- sized_box_shrink_expand
158+
- slash_for_doc_comments
159+
- sort_child_properties_last
160+
- sort_constructors_first
161+
- sort_pub_dependencies
162+
- sort_unnamed_constructors_first
163+
- specify_nonobvious_property_types
164+
- strict_top_level_inference
165+
- test_types_in_equals
166+
- throw_in_finally
167+
- tighten_type_of_initializing_formals
168+
- type_annotate_public_apis
169+
- type_init_formals
170+
- type_literal_in_constant_pattern
171+
- unawaited_futures
172+
- unintended_html_in_doc_comment
173+
- unnecessary_await_in_return
174+
- unnecessary_breaks
175+
- unnecessary_brace_in_string_interps
176+
- unnecessary_const
177+
- unnecessary_constructor_name
178+
- unnecessary_getters_setters
179+
- unnecessary_lambdas
180+
- unnecessary_late
181+
- unnecessary_library_directive
182+
- unnecessary_library_name
183+
- unnecessary_new
184+
- unnecessary_null_aware_assignments
185+
- unnecessary_null_checks
186+
- unnecessary_null_in_if_null_operators
187+
- unnecessary_nullable_for_final_variable_declarations
188+
- unnecessary_overrides
189+
- unnecessary_parenthesis
190+
- unnecessary_raw_strings
191+
- unnecessary_statements
192+
- unnecessary_string_escapes
193+
- unnecessary_string_interpolations
194+
- unnecessary_this
195+
- unnecessary_to_list_in_spreads
196+
- unnecessary_underscores
197+
- unrelated_type_equality_checks
198+
- use_build_context_synchronously
199+
- use_colored_box
200+
- use_enums
201+
- use_full_hex_values_for_flutter_colors
202+
- use_function_type_syntax_for_parameters
203+
- use_if_null_to_convert_nulls_to_bools
204+
- use_is_even_rather_than_modulo
205+
- use_key_in_widget_constructors
206+
- use_late_for_private_fields_and_variables
207+
- use_named_constants
208+
- use_raw_strings
209+
- use_rethrow_when_possible
210+
- use_setters_to_change_properties
211+
- use_string_buffers
212+
- use_string_in_part_of_directives
213+
- use_super_parameters
214+
- use_test_throws_matchers
215+
- use_to_and_as_if_applicable
216+
- valid_regexps
217+
- void_checks

lib/analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include: package:very_good_analysis/analysis_options.8.0.0.yaml
1+
include: package:very_good_analysis/analysis_options.9.0.0.yaml

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ documentation: https://github.com/VeryGoodOpenSource/very_good_analysis
88
topics: [lints, analyzer, analysis]
99

1010
environment:
11-
sdk: ^3.7.0
11+
sdk: ^3.8.0

tool/bump_version/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// ```
1414
///
1515
/// Where `<new_version>` is the new version to bump to in the format `x.y.z`.
16-
/// For example: `7.0.0`.
16+
/// For example: `9.0.0`.
1717
library;
1818

1919
import 'dart:io';
@@ -23,10 +23,10 @@ import 'dart:io';
2323
/// Given the following:
2424
///
2525
/// ```sh
26-
/// include: package:very_good_analysis/analysis_options.6.0.0.yaml
26+
/// include: package:very_good_analysis/analysis_options.9.0.0.yaml
2727
/// ```
2828
///
29-
/// It is expected that the first matched group will be `6.0.0`.
29+
/// It is expected that the first matched group will be `9.0.0`.
3030
final _latestAnalysisVersionRegExp = RegExp(
3131
r'analysis_options\.(\d+\.\d+\.\d+)\.yaml',
3232
);

tool/linter_rules/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ To run the `inspect` script, run the following command (from `tool/linter_rules`
5454
dart bin/inspect.dart $version
5555
```
5656

57-
Where version is the existing Very Good Analysis version you would like to inspect, for example `7.0.0`.
57+
Where version is the existing Very Good Analysis version you would like to inspect, for example `9.0.0`.

tool/linter_rules/bin/inspect.dart

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,22 @@ Future<void> main(
4343
final response = await get(_allLinterRulesUri);
4444
final json = jsonDecode(response.body) as List<dynamic>;
4545

46-
final dartRules =
47-
json
48-
.map((rule) => LinterRule.fromJson(rule as Map<String, dynamic>))
49-
.toList();
46+
final dartRules = json
47+
.map((rule) => LinterRule.fromJson(rule as Map<String, dynamic>))
48+
.toList();
5049
log('Fetched ${dartRules.length} Dart linter rules');
5150

5251
final vgaRules = await allVeryGoodAnalysisRules(version: version);
5352
log('Fetched ${vgaRules.length} Very Good Analysis rules');
5453
log('');
5554

56-
final deprecatedDartRules =
57-
dartRules
58-
.where((rule) => rule.state == LinterRuleState.deprecated)
59-
.map((rule) => rule.name)
60-
.toSet();
61-
final deprecatedVgaRules =
62-
vgaRules.where(deprecatedDartRules.contains).toList();
55+
final deprecatedDartRules = dartRules
56+
.where((rule) => rule.state == LinterRuleState.deprecated)
57+
.map((rule) => rule.name)
58+
.toSet();
59+
final deprecatedVgaRules = vgaRules
60+
.where(deprecatedDartRules.contains)
61+
.toList();
6362
final deprecationMessage = StringBuffer(
6463
'''Found ${deprecatedVgaRules.length} deprecated Dart rules (out of ${deprecatedDartRules.length} deprecated Dart rules) in Very Good Analysis ($version)${deprecatedVgaRules.isEmpty ? '.' : ':'}''',
6564
);

tool/linter_rules/exclusion_reasons.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
"prefer_void_to_null": "[Has unresolved false positives](https://github.com/dart-lang/linter/issues/4758)",
2929
"require_trailing_commas": "Not specified",
3030
"specify_nonobvious_local_variable_types": "Not specified",
31-
"switch_on_type": "Not specified",
31+
"switch_on_type": "Available on Dart SDK 3.8.1, current minimum is Dart SDK 3.8.0.",
3232
"unnecessary_async": "Not specified",
3333
"unnecessary_final": "Incompatible with [prefer_final_locals](https://dart.dev/tools/linter-rules/prefer_final_locals)",
3434
"unnecessary_ignore": "Not specified",
3535
"unnecessary_null_aware_operator_on_extension_on_nullable": "Not specified",
36-
"unnecessary_unawaited": "Not specified",
36+
"unnecessary_unawaited": "Available on Dart SDK 3.8.1, current minimum is Dart SDK 3.8.0.",
3737
"unreachable_from_main": "Not specified",
3838
"unsafe_variance": "Not specified",
3939
"use_decorated_box": "[Has unresolved malfunctions](https://github.com/dart-lang/linter/issues/3286)",

0 commit comments

Comments
 (0)