Skip to content

Commit c3ddeaf

Browse files
Merge pull request #182 from Workiva/final_v2_tweaks
FEDX-8 Last tweaks for v2 rulesets
2 parents 88cc13b + 33557af commit c3ddeaf

File tree

6 files changed

+36
-33
lines changed

6 files changed

+36
-33
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.3.0
2+
3+
- Add `v2` rulesets:
4+
- `package:workiva_analysis_options/v2.yaml`
5+
- `package:workiva_analysis_options/v2.recommended.yaml`
6+
17
## 1.2.5
28

39
- CI tweaks.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2019 Workiva, Inc.
1+
Copyright 2019-2022 Workiva, Inc.
22

33
Redistribution and use in source and binary forms, with or without modification,
44
are permitted provided that the following conditions are met:

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
workiva_analysis_options
2-
Copyright 2019 Workiva, Inc.
2+
Copyright 2019-2022 Workiva, Inc.
33

44
Redistribution and use in source and binary forms, with or without modification,
55
are permitted provided that the following conditions are met:

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Workiva's Shared Dart Analysis Options
22

3-
This is our take on the Dart team's [`pedantic` package][pedantic] and is used
4-
in all Workiva Dart packages.
3+
This is our take on the Dart team's [`lints` package][lints] (originally
4+
inspired by the [`pendantic` package][pedantic]) and is used in all Workiva Dart
5+
packages.
56

67
This package (`package:workiva_analysis_options`) publicly exports
78
`analysis_options.yaml` files that can be included in a project's own
@@ -15,7 +16,7 @@ dev_dependencies:
1516
1617
```yaml
1718
# analysis_options.yaml
18-
include: package:workiva_analysis_options/v1.yaml
19+
include: package:workiva_analysis_options/v2.yaml
1920
```
2021
2122
Because most packages don't commit a `pubspec.lock`, CI may fail if updates to
@@ -40,8 +41,8 @@ This enables consumers to depend on this package with a version range like
4041

4142
## How lints and analyzer rules are evaluated
4243

43-
Periodically, Workiva's Client Platform team will evaluate the available lints
44-
and rules and attempt to categorize them into one of the following:
44+
Periodically, Workiva's Dart Community will evaluate the available lints and
45+
rules and attempt to categorize them into one of the following:
4546

4647
- Required
4748
- Should provide enough value that it is worth requiring them for all Workiva
@@ -83,7 +84,7 @@ and rules and attempt to categorize them into one of the following:
8384
investigation/experimentation can be done.
8485

8586
We will use feedback from the Dart developers at Workiva, other similar
86-
resources (like the [`pedantic` package][pedantic]), and the number of existing
87+
resources (like the [`lints` package][lints]), and the number of existing
8788
infractions across Workiva Dart projects (collected automatically) to inform our
8889
decisions. Each lint has its own issue in this repo that can be used to discuss
8990
changes and will serve as documentation of context and reasons that influenced
@@ -101,10 +102,6 @@ recommended rules.
101102
include: package:workiva_analysis_options/v1.recommended.yaml
102103
```
103104

104-
_Note: there is also a version provided by this library that includes the
105-
optional rules, but it is only intended for use in an automated fashion for the
106-
purpose of gathering data on the number of infractions in Workiva packages._
107-
108105
## Ensuring adoption of the latest shared options
109106

110107
An automated tool will be integrated into a CI check to verify that Workiva Dart
@@ -127,8 +124,8 @@ It is then expected (and enforced internally at Workiva) that CI and developers
127124
run analysis in a way that results in a non-zero exit code when errors or
128125
warnings are present.
129126

130-
With `dartanalyzer`, this means using `--fatal-warnings`. With `tuneup`, this is
131-
enforced by default.
127+
With `dartanalyzer`, this means using `--fatal-warnings`. With `dart analyze`
128+
and `tuneup`, this is enforced by default.
132129

133130
---
134131

@@ -137,4 +134,5 @@ enforced by default.
137134
[Lints & Rules Table of Contents][lints-toc]
138135

139136
[lints-toc]: https://github.com/Workiva/workiva_analysis_options/issues/2
137+
[lints]: https://pub.dev/packages/lints
140138
[pedantic]: https://pub.dev/packages/pedantic

lib/v2.recommended.yaml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,15 @@ analyzer:
7777
avoid_positional_boolean_parameters: warning
7878
avoid_relative_lib_imports: warning
7979
avoid_renaming_method_parameters: warning
80-
avoid_returning_this: warning
81-
avoid_returning_null: warning
8280
avoid_returning_null_for_future: warning
8381
avoid_returning_null_for_void: warning
82+
avoid_returning_null: warning
83+
avoid_returning_this: warning
8484
avoid_setters_without_getters: warning
8585
avoid_slow_async_io: warning
8686
avoid_type_to_string: warning
8787
avoid_types_on_closure_parameters: warning
8888
avoid_unused_constructor_parameters: warning
89-
cascade_invocations: warning
9089
comment_references: warning
9190
control_flow_in_finally: warning
9291
curly_braces_in_flow_control_structures: warning
@@ -96,8 +95,8 @@ analyzer:
9695
omit_local_variable_types: warning
9796
overridden_fields: warning
9897
package_api_docs: warning
99-
package_prefixed_library_names: warning
10098
package_names: warning
99+
package_prefixed_library_names: warning
101100
prefer_adjacent_string_concatenation: warning
102101
prefer_asserts_in_initializer_lists: warning
103102
prefer_collection_literals: warning
@@ -106,7 +105,6 @@ analyzer:
106105
prefer_const_declarations: warning
107106
prefer_const_literals_to_create_immutables: warning
108107
prefer_constructors_over_static_methods: warning
109-
prefer_typing_uninitialized_variables: warning
110108
prefer_final_fields: warning
111109
prefer_final_in_for_each: warning
112110
prefer_final_locals: warning
@@ -121,9 +119,9 @@ analyzer:
121119
prefer_null_aware_operators: warning
122120
prefer_single_quotes: warning
123121
prefer_spread_collections: warning
122+
prefer_typing_uninitialized_variables: warning
124123
prefer_void_to_null: warning
125124
provide_deprecation_message: warning
126-
sort_pub_dependencies: warning
127125
sort_unnamed_constructors_first: warning
128126
test_types_in_equals: warning
129127
throw_in_finally: warning
@@ -133,14 +131,13 @@ analyzer:
133131
unnecessary_brace_in_string_interps: warning
134132
unnecessary_getters_setters: warning
135133
unnecessary_lambdas: warning
136-
unnecessary_parenthesis: warning
137134
unnecessary_overrides: warning
135+
unnecessary_parenthesis: warning
138136
unnecessary_string_escapes: warning
139137
unnecessary_string_interpolations: warning
140138
unnecessary_this: warning
141139
use_function_type_syntax_for_parameters: warning
142140
use_rethrow_when_possible: warning
143-
use_string_buffers: warning
144141
use_to_and_as_if_applicable: warning
145142

146143
linter:
@@ -156,16 +153,15 @@ linter:
156153
- avoid_positional_boolean_parameters
157154
- avoid_relative_lib_imports
158155
- avoid_renaming_method_parameters
159-
- avoid_returning_this
160156
- avoid_returning_null
161157
- avoid_returning_null_for_future
162158
- avoid_returning_null_for_void
159+
- avoid_returning_this
163160
- avoid_setters_without_getters
164161
- avoid_slow_async_io
165162
- avoid_type_to_string
166163
- avoid_types_on_closure_parameters
167164
- avoid_unused_constructor_parameters
168-
- cascade_invocations
169165
- comment_references
170166
- control_flow_in_finally
171167
- curly_braces_in_flow_control_structures
@@ -175,8 +171,8 @@ linter:
175171
- omit_local_variable_types
176172
- overridden_fields
177173
- package_api_docs
178-
- package_prefixed_library_names
179174
- package_names
175+
- package_prefixed_library_names
180176
- prefer_adjacent_string_concatenation
181177
- prefer_asserts_in_initializer_lists
182178
- prefer_collection_literals
@@ -185,7 +181,6 @@ linter:
185181
- prefer_const_declarations
186182
- prefer_const_literals_to_create_immutables
187183
- prefer_constructors_over_static_methods
188-
- prefer_typing_uninitialized_variables
189184
- prefer_final_fields
190185
- prefer_final_in_for_each
191186
- prefer_final_locals
@@ -200,9 +195,9 @@ linter:
200195
- prefer_null_aware_operators
201196
- prefer_single_quotes
202197
- prefer_spread_collections
198+
- prefer_typing_uninitialized_variables
203199
- prefer_void_to_null
204200
- provide_deprecation_message
205-
- sort_pub_dependencies
206201
- sort_unnamed_constructors_first
207202
- test_types_in_equals
208203
- throw_in_finally
@@ -212,12 +207,11 @@ linter:
212207
- unnecessary_brace_in_string_interps
213208
- unnecessary_getters_setters
214209
- unnecessary_lambdas
215-
- unnecessary_parenthesis
216210
- unnecessary_overrides
211+
- unnecessary_parenthesis
217212
- unnecessary_string_escapes
218213
- unnecessary_string_interpolations
219214
- unnecessary_this
220215
- use_function_type_syntax_for_parameters
221216
- use_rethrow_when_possible
222-
- use_string_buffers
223217
- use_to_and_as_if_applicable

lib/v2.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ analyzer:
6464
errors:
6565
# Protect against using language features that are incompatible with the
6666
# minimum SDK version for the current project:
67-
sdk_version_async_exported_from_core: warning
6867
sdk_version_as_expression_in_const_context: warning
68+
sdk_version_async_exported_from_core: warning
6969
sdk_version_bool_operator_in_const_context: warning
7070
sdk_version_eq_eq_operator_in_const_context: warning
7171
sdk_version_extension_methods: warning
7272
sdk_version_is_expression_in_const_context: warning
7373
sdk_version_set_literal: warning
74-
sdk_version_ui_as_code: warning
7574
sdk_version_ui_as_code_in_const_context: warning
75+
sdk_version_ui_as_code: warning
7676

7777
# Promote some builtin hints to warnings:
7878
can_be_null_after_null_aware: warning
@@ -142,11 +142,16 @@ analyzer:
142142
unnecessary_null_aware_assignments: warning
143143
unnecessary_null_in_if_null_operators: warning
144144
unnecessary_statements: warning
145-
unsafe_html: warning
146145
unrelated_type_equality_checks: warning
146+
unsafe_html: warning
147147
valid_regexps: warning
148148
void_checks: warning
149149

150+
# Ignore sorting of pub deps because Workiva packages often have many public
151+
# and private dependencies. Interleaving them makes it harder to maintain
152+
# than keeping them separate.
153+
sort_pub_dependencies: ignore
154+
150155
# Ignore ungenerated uri error:
151156
# See: <https://github.com/Workiva/over_react/blob/new_boilerplate_wip/doc/new_boilerplate_migration.md#ignore-ungenerated-warnings-project-wide>.
152157
uri_has_not_been_generated: ignore
@@ -195,7 +200,7 @@ linter:
195200
- unnecessary_null_aware_assignments
196201
- unnecessary_null_in_if_null_operators
197202
- unnecessary_statements
198-
- unsafe_html
199203
- unrelated_type_equality_checks
204+
- unsafe_html
200205
- valid_regexps
201206
- void_checks

0 commit comments

Comments
 (0)