Commit 7093fba
analyzer: Use Registry.ruleRegistry instead of a rule provider in LinterRuleOptionsValidator.
The theme of this change is that the Registry.ruleRegistry is always
the source of truth for what lint rules are registered, even in tests.
Before this change, there was a mechanism for passing a "rule
provider" around different classes and functions, which is a function
that returns a list of lint rules. This mechanism only existed for one
test, `options_rule_validator_test.dart`.
So this change instead makes that test use Registry.ruleRegistry, and
removes all of the rule provider mechanisms. All in all:
* Remove the LintRuleProvider type alias.
* Remove the LinterRuleOptionsValidator constructor's `provider`
parameter and corresponding field.
* Remove the `provider` parameter from `analyzeAnalysisOptions()`.
* Remove the `provider` parameter from `OptionsFileValidator()`.
* In AbstractAnalysisOptionsTest, remove the `provider` parameter from
`assertErrorsInCode`.
* Rename `_validatePluginsOption` to `_validateLegacyPluginsOption`
while I'm there.
* In order to register the test LintRule classes, they need a proper
`lintCode` property. So create a super class for them, simplifying
each test LintRule class.
Change-Id: Ic153bba006fe0fe2a94abb08ac55723ffb2c356e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/393907
Reviewed-by: Phil Quitslund <[email protected]>
Commit-Queue: Samuel Rawlins <[email protected]>1 parent 526c575 commit 7093fba
File tree
6 files changed
+79
-113
lines changed- pkg
- analysis_server/test/services/linter
- analyzer
- lib/src
- lint
- task
- test/src
- diagnostics/analysis_options
- options
- task
6 files changed
+79
-113
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
| 29 | + | |
| 30 | + | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
75 | | - | |
| 73 | + | |
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | 17 | | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | | - | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | 25 | | |
30 | | - | |
31 | 26 | | |
32 | 27 | | |
33 | | - | |
| 28 | + | |
34 | 29 | | |
35 | 30 | | |
36 | 31 | | |
| |||
39 | 34 | | |
40 | 35 | | |
41 | 36 | | |
42 | | - | |
43 | | - | |
| 37 | + | |
| 38 | + | |
44 | 39 | | |
45 | 40 | | |
46 | 41 | | |
| |||
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | | - | |
56 | 50 | | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | | - | |
| 55 | + | |
62 | 56 | | |
63 | 57 | | |
64 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
| 73 | + | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
80 | | - | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
90 | | - | |
| 88 | + | |
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
| |||
145 | 143 | | |
146 | 144 | | |
147 | 145 | | |
148 | | - | |
| 146 | + | |
149 | 147 | | |
150 | 148 | | |
151 | 149 | | |
152 | 150 | | |
153 | | - | |
| 151 | + | |
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
| |||
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
192 | | - | |
| 190 | + | |
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
| |||
205 | 203 | | |
206 | 204 | | |
207 | 205 | | |
208 | | - | |
209 | | - | |
| 206 | + | |
| 207 | + | |
210 | 208 | | |
211 | 209 | | |
212 | 210 | | |
| |||
224 | 222 | | |
225 | 223 | | |
226 | 224 | | |
227 | | - | |
| 225 | + | |
228 | 226 | | |
229 | | - | |
| 227 | + | |
230 | 228 | | |
231 | 229 | | |
232 | 230 | | |
| |||
365 | 363 | | |
366 | 364 | | |
367 | 365 | | |
368 | | - | |
| 366 | + | |
369 | 367 | | |
370 | | - | |
371 | 368 | | |
372 | 369 | | |
373 | 370 | | |
374 | 371 | | |
375 | 372 | | |
376 | 373 | | |
377 | | - | |
378 | 374 | | |
379 | 375 | | |
380 | 376 | | |
| |||
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 21 | + | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
| |||
31 | 27 | | |
32 | 28 | | |
33 | 29 | | |
34 | | - | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
| |||
0 commit comments